ORA-00936:插入值

时间:2015-07-31 01:24:39

标签: sql oracle oracle11g sqlplus

我花了很多时间搜索我犯了错误的地方,但是当它要插入最后一条记录时我无法找到它有一条错误信息显示“ORA-00936:缺少表情”如何解决这个请帮助我

create type pearson_types as object(
name varchar2(50),
sysID char(6)
)NOT FINAL;

create type doctor_types under pearson_types(
regNo char(10),
specialization varchar2(25)
)

create table doctor of doctor_types(
regNo primary key 
)

create type hospVisits_types as object(
hosChg float,
vDate varchar2(20),
refDoc REF doctor_types,
docChg float
)

create type hospvisits_tbl_types as table of hospVisits_types

create type phone_arr as VARRAY(3) of char(10)

create type patient_types under pearson_types
(
id char(10),
dob varchar(20),
phone phone_arr,
hospVisits hospvisits_tbl_types
)

create table patients of patient_types(
id primary key
)nested table hospVisits store as Hospital_tables

alter table Hospital_tables add scope for (refDoc) is doctor

insert into doctor values ('Dr.k.perera','D001','1223441234','Gynecologist');
insert into doctor values ('Dr.p.weerasingha','D002','1234421131','Dermatalogist');
insert into doctor values ('Prof .S. Fernando','D003','2342111322','Pediatrician');
insert into doctor values ('Dr.k.Sathgunanathan','D004','2344114344','Pediatrician');


insert into patients values('Sampath Weerasingha','P001','732821122V','23-JAN-73',phone_arr('0332124222'),hospvisits_tbl_types(hospVisits_types(50.00,'24-MAY-06',select ref (a) from doctor a where a.regNo='1223441234',500.00)))

1 个答案:

答案 0 :(得分:1)

在SQL语句中的SELECT语句中添加括号:

insert into patients values(
    'Sampath Weerasingha','P001','732821122V','23-JAN-73',phone_arr('0332124222'),
    hospvisits_tbl_types(hospVisits_types(50.00,'24-MAY-06',
        ( -- ADD ME
            select ref (a) from doctor a where a.regNo='1223441234'
        ) -- ADD ME
    ,500.00))
);