Home » SQL & PL/SQL » SQL & PL/SQL » CREATE TABLE s_dept gets ORA-00900 ERR (ORACLE 10G)
CREATE TABLE s_dept gets ORA-00900 ERR [message #409705] Tue, 23 June 2009 10:01 Go to next message
manningda
Messages: 31
Registered: January 2008
Member
Friends:

Many will recognize precisely what is "going-on" from the title.

I am attempting to work through some of the original ORACLE guidance and the SCOTT schema to prep/refresh for some future work.

In reviewing the scripts for CREATE TABLE s_dept, I am consistently getting an INVALID SQL STATEMENT error (ora-00900).

Here is the code I'm attempting:
CREATE TABLE s_dept
     (id   NUMBER(7)
          CONSTRAINT s_dept_id_pk PRIMARY KEY,
      
      name VARCHAR(25)
           CONSTRAINT s_dept_name_nn NOT NULL,
      
      region_id NUMBER(14)
           CONSTRAINT s_dept_region_id_fk REFERENCES 
             s_region (id),
           CONSTRAINT s_dept_name_region_id_uk UNIQUE 
             (name, region_id));


Please keep in mind that I have already successfully created the s_region table; so I think the foreign key reference should be there. But...

The script is consistently failing at Line:8

region_id NUMBER(14)
           CONSTRAINT s_dept_region_id_fk REFERENCES
             s_region (id),
           CONSTRAINT s_dept_name_region_id_uk UNIQUE
             (name, region_id))


To my review I am reproducing the correct scripts from the lesson, but I am failing to see where the "invalid sql" would be.

Admittidly this is a ORACLE 7 tutorial and I'm applying against a ORACLE 10g db; have i "tripped" over a difference in 10g I don't understand?

Thank you in advance for all input, suggestions, and guidance!!
Re: CREATE TABLE s_dept gets ORA-00900 ERR [message #409706 is a reply to message #409705] Tue, 23 June 2009 10:03 Go to previous messageGo to next message
BlackSwan
Messages: 25035
Registered: January 2009
Location: SoCal
Senior Member
sqlplus behaves badly with blank lines within a single SQL statement.
Re: CREATE TABLE s_dept gets ORA-00900 ERR [message #409711 is a reply to message #409705] Tue, 23 June 2009 10:14 Go to previous message
manningda
Messages: 31
Registered: January 2008
Member
BlackSwan:
(I thought about using an acronym B.S. but that seemed disrespectful Laughing )

You nailed it!

Trying to format script for a little readability for future ref.

Thank you for pointing out the effect!!

Happy Tuesday!!!
Previous Topic: finding default constraint
Next Topic: Update two tables using single query
Goto Forum:
  


Current Time: Sat Dec 03 18:15:18 CST 2016

Total time taken to generate the page: 0.09518 seconds