Home > Blockchain >  I am getting an error as invalid identifier but i couldnt find how
I am getting an error as invalid identifier but i couldnt find how

Time:12-31

CREATE TABLE customer_details_1035
(
    cust_ID Number(5) NOT NULL,
    cust_last_name Varchar2(20) NOT NULL,
    cust_mid_name Varchar2(4),
    cust_first_name Varchar2(20),
    account_no Number(5) Primary key,
    account_type Varchar2(10) NOT NULL,
    bank_branch Varchar2(25) NOT NULL,
    cust_email Varchar2(30),
)

This is the error I get:

ORA-00904: : invalid identifier

CodePudding user response:

Some dialects of SQL allow (or tolerate) a comma (,) after the last column specification in a create table statement.

According to the syntax diagrams, Oracle SQL doesn't allow this.

(So, the SQL parser will be looking for a column name (identifier) after the last ,. It finds a ) instead ... which is not a valid identifier.)

Solution: remove the extraneous comma.

CodePudding user response:

CREATE TABLE customer_details_1035
(
    cust_ID Number(5) NOT NULL,
    cust_last_name Varchar2(20) NOT NULL,
    cust_mid_name Varchar2(4),
    cust_first_name Varchar2(20),
    account_no Number(5) Primary key,
    account_type Varchar2(10) NOT NULL,
    bank_branch Varchar2(25) NOT NULL,
    cust_email Varchar2(30), --Remove this comma(,)
);
  • Related