中使用列的默认值创建表

中使用列的默认值创建表

当我运行此查询时:

Create table ACCT_MSTR
("Acct_no" varchar2 (10) NOT NULL PRIMARY KEY,
 "SF_no" varchar2 (10),
 "LF_no" varchar2 (10),
 "Branch_no" varchar2 (10),
 "Intro_Cust_no" varchar2 (10),
 "Intro_Acct_no" varchar2 (10),
 "Intro_sign" varchar2 (1),
 "Type" Varchar2 (2),
 "Opr_mode" varchar2 (2),
 "Cust_accut_type" varchar2 (4),
 "Title" varchar2 (30),
 "Corp_Cust_no" varchar2 (10),
 "Aplndt" Date,
 "Opendt" Date,
 "Veri_Emp_no" VARCHAR2 (10),
 "Veri_sign" varchar2 (1),
 "Manager_sign" varchar2 (1),
 "Curbal" NUMBER(8,2),
 "Status" varchar2 (1) DEFAULT (A),
CONSTRAINT Am_Bn_fk FOREIGN KEY("Branch_no") references BRANCH_MSTR ("Branch_no"),
CONSTRAINT  Am_Icn_fk FOREIGN KEY("Intro_Cust_no") references CUST_MSTR ("Cust_no"),
CONSTRAINT  Am_Ian_fk FOREIGN KEY("Intro_Acct_no") references ACCT_MSTR ("Acct_no"),
CONSTRAINT Am_ccn_fk FOREIGN KEY("Corp_Cust_no") references CUST_MSTR ("Cust_no"),
CONSTRAINT  Am_ven_fk FOREIGN KEY("Veri_Emp_no") references EMP_MSTR ("Emp_no")
);

我收到此错误:

最佳答案

字符串常量需要包含在 引号中。没有引号的任何东西都是标识符。

所以 A

"Status" varchar2 (1) DEFAULT (A),

引用名为“A”的列。

你要
"Status" varchar2 (1) DEFAULT ('A'),

关于sql - 在 Oracle 中使用列的默认值创建表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38167548/

10-10 23:08