Q
Problem solve Get help with specific problems with your technologies, process and projects.

Tracking down SQL errors, part 3

I'm simply trying to create a table and I get this error saying ORA-00922. What's wrong with my code and is there a site where I can look at all ORA- errors?

CREATE TABLE  customer
(
    cus_id            NUMBER (6),
    cus_address       VARCHAR2 (30) 
                      CONSTRAINT customer_cus_address_nn NOT NULL,
    cus_phone_Number  VARCHAR2 (12)
                      CONSTRAINT customer_cus_phone_number_nn NOT NULL,
    cus_lname         VARCHAR2 (15)
                      CONSTRAINT customer_cus_lname_nn NOT NULL,
    cus_f_name        VARCHAR2 (15) customer_cus_fname,
    CONSTRAINT  customer_cus_id_pk  PRIMARY KEY (cus_id)
);

(cus_id NUMBER(6),
*
ERROR at line 2:
ORA-00922: missing or invalid option

Continued from part 2.

Footnote

You wrote your query with commas at the end of lines, which looks like normal text. If you comment out the last item, you have to remember to comment out the comma that precedes it. Since you may have to remove and add lines several times, it's easier to always include that last item, so text can be manipulated in entire lines. This is one reason why some people use the notation where lines begin with commas:

CREATE TABLE  customer
(
    cus_id            NUMBER (6)
  , cus_address       VARCHAR2 (30) 
                      CONSTRAINT customer_cus_address_nn NOT NULL
  , cus_phone_Number  VARCHAR2 (12)
                      CONSTRAINT customer_cus_phone_number_nn NOT NULL
--  , cus_lname         VARCHAR2 (15)
--                      CONSTRAINT customer_cus_lname_nn NOT NULL
--  , cus_f_name        VARCHAR2 (15) customer_cus_fname
--  , CONSTRAINT  customer_cus_id_pk  PRIMARY KEY (cus_id)
);

Dig Deeper on Using Oracle PL-SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close