gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 20:35:34 24 4
gpt4 key购买 nike

我花了很多时间搜索我犯错误的地方,但是当它要插入最后一条记录时我无法找到它有一条错误消息显示“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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com