我需要帮助我继续在编码时收到此错误,不确定我做错了什么。请帮忙。
CREATE TABLE VOLUNTEER ( VOL_ID VARCHAR2 (8) NOT NULL, FNAME ORA- 00907: missing right parenthesis - 2 0.01
CREATE TABLE STUDENT ( Vol_id VARCHAR2 (8) NOT NULL, Student ORA-00904: : invalid identifier
这些是我的代码:
CREATE TABLE VOLUNTEER (
VOL_ID VARCHAR2 (8) NOT NULL,
FULLNAME VARCHAR2 (14)NOT NULL,
SURNAME VARCHAR2 (14) NOT NULL,
ADDRESS VARCHAR2 (13) NOT NULL,
DOB DATE,
PHONE NUMBER CHAR (8) NOT NULL,
EMAIL VARCHAR2 (10) NOT NULL,
PASSPORT NUMBER VARCHAR2 (10) NOT NULL,
NATIONALITY VARCHAR2 (10) NOT NULL,
PASSPORT EXPIRY DATE,
GENDER VARCHAR2 (10) NOT NULL,
REGISTERED DISABLED VARCHAR2 (10) NOT NULL,
ETHNICITY VARCHAR2 (14) NOT NULL,
CONSTRAINT fk1_Vol_id VARCHAR2 (8) NOT NULL,
CONSTRAINT PK_Vol PRIMARY KEY (Vol_id));
CREATE TABLE STUDENT (
Vol_id VARCHAR2 (8) NOT NULL,
Student_id VARCHAR2 (8) NOT NULL,
Course VARCHAR2 (8) NOT NULL,
Studyyear DATE,
CONSTRAINT PK_STUDENTS PRIMARY KEY (Vol_id),
答案 0 :(得分:0)
在第一次查询中,请检查此行
HandlerFunc
根据您的代码,这可能是正确的
x := 42
{
x := 3
y := 4
fmt.Println("x inside block:", x) // prints 3
}
fmt.Println("x outside block:", x) // prints 42
// fmt.Println(y) // undefined: y
进行第二次查询。检查systax。
PHONE NUMBER CHAR (8) NOT NULL,
答案 1 :(得分:0)
一些错误:
PASSPORT NUMBER
更改为PASSPORT_NUMBER
(电话号码,护照到期和注册已停用)相同。NOT NULL
PRIMARY KEY
约束
像这样:
CREATE TABLE VOLUNTEER (
VOL_ID VARCHAR2(8) CONSTRAINT VOLUNTEER__VI__PK PRIMARY KEY,
FULLNAME VARCHAR2(14) CONSTRAINT VOLUNTEER__F__NN NOT NULL,
SURNAME VARCHAR2(14) CONSTRAINT VOLUNTEER__S__NN NOT NULL,
ADDRESS VARCHAR2(13) CONSTRAINT VOLUNTEER__AD__NN NOT NULL,
DOB DATE,
PHONE_NUMBER CHAR(8) CONSTRAINT VOLUNTEER__PH__NN NOT NULL,
EMAIL VARCHAR2(10) CONSTRAINT VOLUNTEER__EM__NN NOT NULL,
PASSPORT_NUMBER VARCHAR2(10) CONSTRAINT VOLUNTEER__PN__NN NOT NULL,
NATIONALITY VARCHAR2(10) CONSTRAINT VOLUNTEER__N__NN NOT NULL,
PASSPORT_EXPIRY DATE,
GENDER VARCHAR2(10) CONSTRAINT VOLUNTEER__G__NN NOT NULL,
REGISTERED_DISABLED VARCHAR2(10) CONSTRAINT VOLUNTEER__RD__NN NOT NULL,
ETHNICITY VARCHAR2(14) CONSTRAINT VOLUNTEER__E__NN NOT NULL
);
CREATE TABLE STUDENT (
Vol_id VARCHAR2(8) CONSTRAINT STUDENT__VI__PK PRIMARY KEY,
Student_id VARCHAR2(8) CONSTRAINT STUDENT__SI__NN NOT NULL,
Course VARCHAR2(8) CONSTRAINT STUDENT__C__NN NOT NULL,
Study_year DATE
);
答案 2 :(得分:0)
除了提到的其他问题之外,您为CONSTRAINT fk1_Vol_id
提供的定义无效。你有它
CONSTRAINT fk1_Vol_id VARCHAR2 (8) NOT NULL
这应该是
的内容CONSTRAINT fk1_Vol_id FOREIGN KEY (VOL_ID) REFERENCES STUDENT(VOL_ID)
但是,由于VOL_ID
和STUDENT
上的VOLUNTEER
为主键,因此这似乎没有多大意义。将STUDENT_ID
作为STUDENT
上的主键并将STUDENT.VOL_ID
引用回VOLUNTEER
表可能会更好。因此,更好的方法是:
CREATE TABLE VOLUNTEER (
VOL_ID VARCHAR2 (8)
CONSTRAINT PK_VOLUNTEER
PRIMARY KEY
USING INDEX,
FULLNAME VARCHAR2 (14) NOT NULL,
SURNAME VARCHAR2 (14) NOT NULL,
ADDRESS VARCHAR2 (13) NOT NULL,
DOB DATE,
PHONE_NUMBER CHAR (8) NOT NULL,
EMAIL VARCHAR2 (10) NOT NULL,
PASSPORT_NUMBER VARCHAR2 (10) NOT NULL,
NATIONALITY VARCHAR2 (10) NOT NULL,
PASSPORT_EXPIRY DATE,
GENDER VARCHAR2 (10) NOT NULL,
REGISTERED_DISABLED VARCHAR2 (10) NOT NULL,
ETHNICITY VARCHAR2 (14) NOT NULL);
CREATE TABLE STUDENT (
STUDENT_ID VARCHAR2 (8)
CONSTRAINT PK_STUDENTS
PRIMARY KEY
USING INDEX,
VOL_ID VARCHAR2 (8) NOT NULL
CONSTRAINT STUDENT_FK1
REFERENCES VOLUNTEER (VOL_ID),
COURSE VARCHAR2 (8) NOT NULL,
STUDYYEAR DATE);
祝你好运。