Shrey Garg
Shrey Garg

Reputation: 82

SQL create table statement as it is showing right parenthesis error

create table customer
(
    cusno int Primary key auto increment,
    custname varchar(32),
    address varchar(200),
    internal varchar(55),
    contact varchar(11),
    phone  varchar(12), 
    city varchar (24),
    state varchar(23), 
    zip varchar(10) 
);

Please ignore other things.

Upvotes: 0

Views: 53

Answers (1)

user330315
user330315

Reputation:

To create an "auto increment" in Oracle (12.1 and later) use an identity column.

CREATE TABLE customer
(
    cusno    number generated BY DEFAULT AS identity,
    custname VARCHAR(32),
    address  VARCHAR(200),
    internal VARCHAR(55),
    contact  VARCHAR(11),
    phone    VARCHAR(12),
    city     VARCHAR (24),
    state    VARCHAR(23),
    zip      VARCHAR(10)
);

While int or integer are accepted as a data type, they are only an alias for the native data type number

Upvotes: 3

Related Questions