HP (Hewlett-Packard) 544530-001 Manuale Utente

Pagina di 142
Considerations
In the Neoview Script interface, you must enter the command on one line. The command
does not require an SQL terminator.
Put a space between OBEY and the first character of the file name.
You can execute this command in a script file.
You can specify only one script file at a time using the OBEY command. To run multiple
script files in parallel, see
.
Examples
This OBEY command runs the script file from the local directory (the same directory where
you are running Neoview Script):
SQL>obey ddl.sql
This OBEY command runs the script file in the specified directory on Windows.
SQL>obey c:\my_files\ddl.sql
This OBEY command runs the script file in the specified directory on a Linux or UNIX
workstation:
SQL>obey ./my_files/ddl.sql
This sample file contains sections to be used in conjunction with the OBEY command:
?section droptable
DROP TABLE COURSE
?section create
CREATE TABLE COURSE
(
  CNO     VARCHAR(3)       NOT NULL,
  CNAME   VARCHAR(22)      NOT NULL,
  CDESCP  VARCHAR(25)      NOT NULL,
  CRED    INT,
  CLABFEE NUMERIC(5,2),
  CDEPT   VARCHAR(4)       NOT NULL,
primary key (cno)
) ;
?section insert
INSERT INTO COURSE VALUES
     ('C11', 'INTRO TO CS','FOR ROOKIES',3, 100, 'CIS');
INSERT INTO COURSE VALUES
     ('C22', 'DATA STRUCTURES','VERY USEFUL',3, 50, 'CIS');
INSERT INTO COURSE VALUES
     ('C33', 'DISCRETE MATHEMATICS',
      'ABSOLUTELY NECESSARY',3, 0,'CIS');
?section select
SELECT * FROM course;
?section delete
purgedata course;
To run only the commands in section create, execute the following :
SQL>obey C:\Scripts\course.sql (create)
SQL>?section create
SQL>CREATE TABLE COURSE
+>(
94
Neoview Script Interface Commands