declare
v_cnt int;
begin
execute immediate 'select tt from duald WHERE col='''A'''' into v_cnt;
end;
当语句没值的时候,我需要V_CNT=0。。怎么处理。不需要抓错误。。如果抓了错误。
下面的代码以V_CNT=0想继续跑.怎么处理!
v_cnt int;
begin
execute immediate 'select tt from duald WHERE col='''A'''' into v_cnt;
end;
当语句没值的时候,我需要V_CNT=0。。怎么处理。不需要抓错误。。如果抓了错误。
下面的代码以V_CNT=0想继续跑.怎么处理!
declare
v_cnt int;
begin
begin
execute immediate 'select tt from duald WHERE col='''A'''' into v_cnt;
exception
when no_data_found then
v_cnt := 0;
end;
end;
v_cnt int;
begin
begin
execute immediate 'select tt from duald WHERE col='''A'''' into v_cnt; execute immediate 'select tt from duald WHERE col='''B'''' into v_cnt;
exception
when no_data_found then
v_cnt := 0;
end;
end; 如果B的条件需要v_cnt:=1?怎么办??
declare
v_cnt int;
begin
begin
execute immediate 'select tt from duald WHERE col='''A'''' into v_cnt;
exception
when no_data_found then
v_cnt := 0;
end;
begin
execute immediate 'select tt from duald WHERE col='''B'''' into v_cnt;
exception
when no_data_found then
v_cnt := 1;
end;
end;
添加默认值即可
v_cnt int:=0;
但提示ORA-01403: 未找到数据
ORA-06512: 在 "SYS.EVSYS_LIST", line 142
ORA-06512: 在 line 2
在同一个PROC怎么处理呢。。
然后通过变量if判断v_cnt的值