Can't create table in Oracle using tera term
This is my text file which I am executing in tera term.
DROP TABLE purchase; CREATE TABLE purchase
( ID NUMBER(4) NOT NULL,
Fname VARCHAR2(10),
Lname VARCHAR2(10),
Vin NUMBER(10),
Email VARCHAR(10),
unit NUMBER(10),
Street VARCHAR2(50),
Suburb VARCHAR2(50),
Pcode NUMBER(4),
credit VARCHAR2(20),
holder VARCHAR2(20),
Expiry NUMBER(4)
Primary key (ID) 开发者_开发知识库
); commit;
I'm getting the error
DROP TABLE purchase
*
ERROR at line 1:
ORA-00942: table or view does not exist
Primary key (ID)
*
ERROR at line 14:
ORA-00907: missing right parenthesis
use this
DROP TABLE purchase;
CREATE TABLE purchase
( ID NUMBER(4) NOT NULL,
Fname VARCHAR2(10),
Lname VARCHAR2(10),
Vin NUMBER(10),
Email VARCHAR(10),
unit NUMBER(10),
Street VARCHAR2(50),
Suburb VARCHAR2(50),
Pcode NUMBER(4),
credit VARCHAR2(20),
holder VARCHAR2(20),
Expiry NUMBER(4),
CONSTRAINT purchase_pk PRIMARY KEY (ID)
);
BEWARE the first error (ORA-00942) about purchase
not existing is no problem... this happens when you run this the first time.
or this:
DROP TABLE purchase;
CREATE TABLE purchase
( ID NUMBER(4) PRIMARY KEY,
Fname VARCHAR2(10),
Lname VARCHAR2(10),
Vin NUMBER(10),
Email VARCHAR(10),
unit NUMBER(10),
Street VARCHAR2(50),
Suburb VARCHAR2(50),
Pcode NUMBER(4),
credit VARCHAR2(20),
holder VARCHAR2(20),
Expiry NUMBER(4)
);
applying a primary key constraint to a column implies both "unique" and "not null" constraint(s).
精彩评论