以下代码使用 sql*plus 成功创建了一个过程
CREATE OR REPLACE PROCEDURE input_order (pat_id in char, vis_vdate in date, vis_act in number,
vac_vacc in char)
AS
BEGIN
DBMS_OUTPUT.PUT_LINE ('Insert attempted');
insert into vaccinations(pid,vdate,action,vaccinated) values(pat_id,vis_vdate,vis_act,vac_vacc);
DBMS_OUTPUT.PUT_LINE ('Insert succeeded');
EXCEPTION
WHEN others THEN DBMS_OUTPUT.PUT_LINE ('error');
DBMS_OUTPUT.PUT_LINE ('Insert rejected');
END;
/
但是我的意图是创建一个类似的过程,其中包括将嵌套表填充为表的属性
- 例如:假设 'vis_act' 是一个嵌套表
- 类型为 vis_set_t
- 和属性 visname 和 visurname
我用这种方式尝试过,但一直出错
CREATE OR REPLACE PROCEDURE input_order (pat_id in char, vis_vdate in date, vis_act in
vis_set_t, vac_vacc in char)
AS
BEGIN
DBMS_OUTPUT.PUT_LINE ('Insert attempted');
insert into vaccinations(pid,vdate,vis_set_t(visname,visurname),vaccinated) values
(pat_id,vis_vdate,vis_act,vac_vacc);
DBMS_OUTPUT.PUT_LINE ('Insert succeeded');
EXCEPTION
WHEN others THEN DBMS_OUTPUT.PUT_LINE ('error');
DBMS_OUTPUT.PUT_LINE ('Insert rejected');
END;
/