使用序列时缺少右括号
Missing Right Parenthesis while using sequence
CREATE TABLE customer_master(
cust_id NUMBER(6) CUSTOMER_SEQ.Nextval PRIMARY KEY,
cust_password VARCHAR2(10),
cust_fname VARCHAR2(30),
cust_lname VARCHAR2(30),
cust_gender VARCHAR2(8),
cust_dob DATE,
cust_email VARCHAR2(30),
cust_password VARCHAR2(30),
cust_mobile NUMBER(10),
cust_add VARCHAR2(100),
newsletter VARCHAR2(5) CHECK (newsletter IN('yes','no')),
mob_service VARCHAR2(5) CHECK (mob_service IN('yes','no'))
);
尝试使用触发器。
CREATE TABLE customer_master(
cust_id NUMBER(6) PRIMARY KEY,
cust_password VARCHAR2(10),
cust_fname VARCHAR2(30),
cust_lname VARCHAR2(30),
cust_gender VARCHAR2(8),
cust_dob DATE,
cust_email VARCHAR2(30),
cust_mobile NUMBER(10),
cust_add VARCHAR2(100),
newsletter VARCHAR2(5) CHECK (newsletter IN('yes','no')),
mob_service VARCHAR2(5) CHECK (mob_service IN('yes','no'))
);
CREATE OR REPLACE TRIGGER INS_customer_master
BEFORE INSERT ON customer_master
FOR EACH ROW
DECLARE
i_LAST NUMBER;
BEGIN
SELECT CUSTOMER_SEQ.NEXTVAL INTO i_LAST FROM Dual;
:NEW.cust_id := i_LAST;
END;
/
CREATE TABLE customer_master(
cust_id NUMBER(6) CUSTOMER_SEQ.Nextval PRIMARY KEY,
cust_password VARCHAR2(10),
cust_fname VARCHAR2(30),
cust_lname VARCHAR2(30),
cust_gender VARCHAR2(8),
cust_dob DATE,
cust_email VARCHAR2(30),
cust_password VARCHAR2(30),
cust_mobile NUMBER(10),
cust_add VARCHAR2(100),
newsletter VARCHAR2(5) CHECK (newsletter IN('yes','no')),
mob_service VARCHAR2(5) CHECK (mob_service IN('yes','no'))
);
尝试使用触发器。
CREATE TABLE customer_master(
cust_id NUMBER(6) PRIMARY KEY,
cust_password VARCHAR2(10),
cust_fname VARCHAR2(30),
cust_lname VARCHAR2(30),
cust_gender VARCHAR2(8),
cust_dob DATE,
cust_email VARCHAR2(30),
cust_mobile NUMBER(10),
cust_add VARCHAR2(100),
newsletter VARCHAR2(5) CHECK (newsletter IN('yes','no')),
mob_service VARCHAR2(5) CHECK (mob_service IN('yes','no'))
);
CREATE OR REPLACE TRIGGER INS_customer_master
BEFORE INSERT ON customer_master
FOR EACH ROW
DECLARE
i_LAST NUMBER;
BEGIN
SELECT CUSTOMER_SEQ.NEXTVAL INTO i_LAST FROM Dual;
:NEW.cust_id := i_LAST;
END;
/