Progress
Embedded SQL-92
Guide and Reference


CREATE VIEW

Use the CREATE VIEW statement to create a view on existing tables or views. You specify the name for the VIEW.

EXAMPLE

The following code fragment shows how to use a CREATE VIEW statement in an ESQL program. This CREATE VIEW statement creates the ne_customer view of the customer table:

/* 
** CONNECT to the DEFAULT database. 
*/ 
EXEC SQL 
     CONNECT TO DEFAULT ;  
/* 
** Create the ne_customer view. 
*/ 
EXEC SQL 
     CREATE VIEW ne_customer AS 
     SELECT cust_no, last_name, street, city, state 
     FROM customer 
     WHERE state in ('NH', 'MA', 'ME', 'CT', 'RI', 'VT') ; 
if (sqlca.sqlcode < 0) 
{ 
     printf ("CREATE VIEW statement failed (%ld : %s) \n", 
             sqlca.sqlcode, sqlca.sqlerrm) ;  
     EXEC SQL ROLLBACK WORK ;  
     EXEC SQL DISCONNECT DEFAULT ;  
     exit (1) ; 
} 
/*  
** Successful create view; commit the operation. 
*/ 
EXEC SQL 
     COMMIT WORK ;  
printf ("CREATE VIEW ne_customer successful. \n");  
/* 
** Disconnect from the default database. 
*/ 
EXEC SQL  
     DISCONNECT DEFAULT ; 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095