SQL/MX Programming Manual for Java
Sample Programs
HP NonStop SQL/MX Programming Manual for Java—523726-003
C-7
SQLJ Source File
 #sql [ctx1] {CREATE TABLE project_internatl
 ( projcode NUMERIC (4) UNSIGNED
 NO DEFAULT
 NOT NULL NOT DROPPABLE
 HEADING 'Project/Code'
 ,empnum NUMERIC (4) UNSIGNED
 NO DEFAULT
 NOT NULL NOT DROPPABLE
 HEADING 'Employee/Number'
 ,projdesc VARCHAR (18) CHARACTER SET UCS2
 NO DEFAULT
 NOT NULL NOT DROPPABLE
 HEADING 'Project/Description'
 ,start_date DATE
 DEFAULT DATE '2004-07-01'
 NOT NULL NOT DROPPABLE
 HEADING 'Start/Date'
 ,ship_timestamp TIMESTAMP
 DEFAULT TIMESTAMP 
 '2004-08-01:12:00:00.000000'
 NOT NULL NOT DROPPABLE
 HEADING 'Timestamp/Shipped'
 ,est_complete INTERVAL DAY
 DEFAULT INTERVAL '30' DAY
 NOT NULL NOT DROPPABLE
 HEADING 'Estimated/Completion'
 ,PRIMARY KEY (projcode) NOT DROPPABLE
 )
 };
 System.out.println("The PROJECT_INTERNATL table was created.");
 /* Set the default catalog and schema for a set of 
 * database objects to be created. */
 // #sql [ctx2] {DECLARE CATALOG 'SAMDBCAT2'};
 // #sql [ctx2] {DECLARE SCHEMA 'SALES2'};
 // Create tables in the schema
 // #sql [ctx2] {CREATE TABLE...};
 // System.out.println("The ... table was created.");
 // #sql [ctx2] {CREATE TABLE...};
 // System.out.println("The ... table was created.");
 // #sql [ctx2] {CREATE TABLE...};
 // System.out.println("The ... table was created.");
 // #sql [ctx2] {CREATE TABLE...};
 // System.out.println("The ... table was created.");
Example C-1. SampleDDL.sqlj—Creating Tables From an SQLJ 
Program (page 6 of 7)










