Previous Topic

Next Topic

Dropping Views

The DROP VIEW statement deletes an existing view from the database. The following example shows the use of a DROP VIEW statement to drop the view, ne_customer on the table customer.

Example Dropping Views


...
/* connect to a default database */
EXEC SQL CONNECT TO DEFAULT ;

/* drop a view, newcust, from the database */
EXEC SQL DROP VIEW ne_customer ;
if (sqlca.sqlcode)
{
  fprintf (stderr,
  "Drop view statement failed (%ld : %s). \n",
  sqlca.sqlcode, sqlca.sqlerrm);
  EXEC SQL ROLLBACK WORK ;
  EXEC SQL DISCONNECT DEFAULT ;
  exit (1);
}
/* Commit changes */
EXEC SQL COMMIT WORK ;

printf ("View dropped. \n");

/* Disconnect from the database */
EXEC SQL DISCONNECT DEFAULT ;
...