Tracking down SQL errors, part 1

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

    Requires Free Membership to View

Here are the steps I use in attacking problems like this:
  1. Apply the given error message to the given line.
    Without looking anything up, try to see if there is something obviously wrong concerning an option at line 2 or the end of line 1. (If the error message does not locate the error exactly, then most often the error occurred immediately before the given line.) Unfortunately, this is one of those cases where the line number given in the error message is meaningless.
  2. Look up the error message
    Do so using any of these sources:
    1. The documentation CD that came with the database installation disks. Ask your DBA to have this copied to your network or to let you borrow the disk.
    2. Oracle Technology Network. You can set up an account for free. Error messages are found under the database documentation.
    3. A printed Server Messages manual, available from Oracle Store. At $202 a copy, this is very expensive, even by computer book standards.
    In this case, the explanation in the error message documentation isn't much help. ORA-00922 covers a lot of errors in defining columns sizes, constraints and storage clauses. The manual gives a couple of specific examples, but none of them match your problem.

Continued in part 2.

This was first published in November 2003

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.