可能是一个非常简单的问题,但我创建了一个包含3列的记录。第三列我将在稍后分配一个值。查询为记录选择2列。我错过了什么?抛出的错误是有太多的值"在我的选择陈述中。
create or replace Procedure Pledges3
(IDdonor In Int, flag Out Varchar)
as
type allPledges is record(iddonor dd_pledge.iddonor%type, idstatus dd_status.idstatus%type, flag Varchar(25));
allPledges2 allpledges;
Begin
Select dd_pledge.iddonor, dd_status.idstatus
into allpledges2
from dd_donor
join dd_pledge on dd_donor.iddonor=dd_pledge.iddonor
join dd_status on dd_pledge.idstatus=dd_status.idstatus
where dd_pledge.IDdonor=305;
if allpledges2.idstatus = '10' THEN
Flag := 'True';
elsif allpledges2.idstatus= '20' THEN
Flag := 'False';
End if;
dbms_output.put_line(flag);
End;
答案 0 :(得分:0)
检查以下代码,更正:
create or replace Procedure Pledges3
(IDdonor In Int, flag Out Varchar)
as
type allPledges is record(iddonor dd_pledge.iddonor%type, idstatus dd_status.idstatus%type, flag Varchar(25));
allPledges2 allpledges;
Begin
Select dd_pledge.iddonor, dd_status.idstatus, null
into allpledges2
from dd_donor
join dd_pledge on dd_donor.iddonor=dd_pledge.iddonor
join dd_status on dd_pledge.idstatus=dd_status.idstatus
where dd_pledge.IDdonor=305;
if allpledges2.idstatus = '10' THEN
allPledges2.Flag := 'True';
elsif allpledges2.idstatus= '20' THEN
allPledges2.Flag := 'False';
End if;
dbms_output.put_line(allPledges2.flag);
End;