sql - ORA-00936 : missing expression error when inserting values

标签 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)))

最佳答案

在 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))
);

关于sql - ORA-00936 : missing expression error when inserting values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31736686/

相关文章:

MySQL 查询产生空集

java - Tomcat 是否使用 pl/sql 模块的缓存版本?

sql - oracle使用DBlink插入

mysql - 在sql中按升序对 "Apr-19" "Apr-18"日期类型进行排序

sql - 在 SQL Server 中选择 if 条件值

sql - PLS-00103 : Encountered the symbol when expecting one of the following:

sql - 我可以在 Oracle 中使用 UTILS 吗?

java - Oracle java存储过程性能

带重置的 SQL Server Row_Count

oracle - ORA-01007 "variable not in select list"来自 dbms_sql.column_value 调用