Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql unknown error

Status
Not open for further replies.

desert19

Programmer
Aug 1, 2001
3
US
why do I get this message when I run the given example script, demobld.sql on Oracle 8i, personal ed.?
First the error, then the code:

SET TERMOUT ON
*
ERROR at line 17:
ORA-00922: missing or invalid option

1 --
2 -- Copyright (c) Oracle Corporation 1988, 1999. All Rights Reserved.
3 --
4 -- NAME
5 -- demobld.sql
6 --
7 -- DESCRIPTION
8 -- This script creates the SQL*Plus demonstration tables in the
9 -- current schema. It should be STARTed by each user wishing to
10 -- access the tables. To remove the tables use the demodrop.sql
11 -- script.
12 --
13 -- USAGE
14 -- SQL> START demobld.sql
15 --
16 --
17 SET TERMOUT ON
18 PROMPT Building demonstration tables. Please wait.
19 SET TERMOUT OFF
20 DROP TABLE EMP;
21 DROP TABLE DEPT;
22 DROP TABLE BONUS;
23 DROP TABLE SALGRADE;
24 DROP TABLE DUMMY;
25 CREATE TABLE EMP
26 (EMPNO NUMBER(4) NOT NULL,
27 ENAME VARCHAR2(10),
28 JOB VARCHAR2(9),
29 MGR NUMBER(4),
30 HIREDATE DATE,
31 SAL NUMBER(7, 2),
32 COMM NUMBER(7, 2),
33 DEPTNO NUMBER(2));
34 INSERT INTO EMP VALUES
35 (7369, 'SMITH', 'CLERK', 7902,
36 TO_DATE('17-DEC-1980', 'DD-MON-YYYY'), 800, NULL, 20);
37 INSERT INTO EMP VALUES
38 (7499, 'ALLEN', 'SALESMAN', 7698,
39 TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600, 300, 30);
40 INSERT INTO EMP VALUES
41 (7521, 'WARD', 'SALESMAN', 7698,
42 TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250, 500, 30);
43 INSERT INTO EMP VALUES
44 (7566, 'JONES', 'MANAGER', 7839,
45 TO_DATE('2-APR-1981', 'DD-MON-YYYY'), 2975, NULL, 20);
46 INSERT INTO EMP VALUES
47 (7654, 'MARTIN', 'SALESMAN', 7698,
48 TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
49 INSERT INTO EMP VALUES
50 (7698, 'BLAKE', 'MANAGER', 7839,
51 TO_DATE('1-MAY-1981', 'DD-MON-YYYY'), 2850, NULL, 30);
52 INSERT INTO EMP VALUES
53 (7782, 'CLARK', 'MANAGER', 7839,
54 TO_DATE('9-JUN-1981', 'DD-MON-YYYY'), 2450, NULL, 10);
55 INSERT INTO EMP VALUES
56 (7788, 'SCOTT', 'ANALYST', 7566,
57 TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
58 INSERT INTO EMP VALUES
59 (7839, 'KING', 'PRESIDENT', NULL,
60 TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
61 INSERT INTO EMP VALUES
62 (7844, 'TURNER', 'SALESMAN', 7698,
63 TO_DATE('8-SEP-1981', 'DD-MON-YYYY'), 1500, 0, 30);
64 INSERT INTO EMP VALUES
65 (7876, 'ADAMS', 'CLERK', 7788,
66 TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
67 INSERT INTO EMP VALUES
68 (7900, 'JAMES', 'CLERK', 7698,
69 TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 950, NULL, 30);
70 INSERT INTO EMP VALUES
71 (7902, 'FORD', 'ANALYST', 7566,
72 TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 3000, NULL, 20);
73 INSERT INTO EMP VALUES
74 (7934, 'MILLER', 'CLERK', 7782,
75 TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);
76 CREATE TABLE DEPT
77 (DEPTNO NUMBER(2),
78 DNAME VARCHAR2(14),
79 LOC VARCHAR2(13) );
80 INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
81 INSERT INTO DEPT VALUES (20, 'RESEARCH', 'DALLAS');
82 INSERT INTO DEPT VALUES (30, 'SALES', 'CHICAGO');
83 INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');
84 CREATE TABLE BONUS
85 (ENAME VARCHAR2(10),
86 JOB VARCHAR2(9),
87 SAL NUMBER,
88 COMM NUMBER);
89 CREATE TABLE SALGRADE
90 (GRADE NUMBER,
91 LOSAL NUMBER,
92 HISAL NUMBER);
93 INSERT INTO SALGRADE VALUES (1, 700, 1200);
94 INSERT INTO SALGRADE VALUES (2, 1201, 1400);
95 INSERT INTO SALGRADE VALUES (3, 1401, 2000);
96 INSERT INTO SALGRADE VALUES (4, 2001, 3000);
97 INSERT INTO SALGRADE VALUES (5, 3001, 9999);
98 CREATE TABLE DUMMY
99 (DUMMY NUMBER);
100 INSERT INTO DUMMY VALUES (0);
101 COMMIT;
102 SET TERMOUT ON
103 PROMPT Demonstration table build is complete.
104 EXIT
105*

????????????????????

 

It doesn't hurt if you just put a remark on the script where environment var TERMOUT is set.

For example:

-- SET TERMOUT ON
and
-- SET TERMOUT OFF

See if this one works.

 
If you're getting an ORAcle error on Sql*Plus command, it's probably being executed from within pl/sql. Try to look for extra begin/end statements. This problem may occur if executing script not by start (@) command, but from line editor. Do you invoke it by START demobld.sql?
 
you must execute this kind of a script as

@demobld.sql

the error that you received is probably because you tried to RUN the script. The @ allows you to build a collection of individual sql commands and batch execute them. Because of the SET TERMOUT ON command, it would indicate that this must be run in a SQLPlus or SVRMGRL session.

I hope that this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top