PLS-00103: 出现符号 "IF"在需要下列之一时: := . ( @ % ; not null range defa

qq_34470710 2017-02-21 02:39:21
create or replace function is_complete_cause_data (acct_year in varchar2,comp_code in varchar2,copy_code in varchar2,cause_code in varchar2, type_code int)
return varchar2 as

begin

declare result varchar2

if type_code :=1
begin
if exists(select 1 from HTCP_WORK_CAUSE_DATA where ACCT_YEAR=acct_year and COMP_CODE=comp_code
and COPY_CODE=copy_code and WORK_CAUSE_CODE=cause_code)
begin
set result='已完成'
end;
else

begin
set result='未完成'
end;
end;
else
begin
if exists(select 1 from HTCP_RES_CAUSE_DATA where HTC_ACCT_YEAR=acct_year and HTC_COMP_CODE=comp_code
and HTC_COPY_CODE=copy_code and RES_CAUSE_CODE=cause_code)
begin
set result='已完成'
end;
else

begin
set result='未完成'
end;
end;

return result

end;
...全文
1039 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2017-02-21
  • 打赏
  • 举报
回复
if exists(select ... ) 要用这样的块来代替: v_count :=0 ; select count(*) into v_count from t where .... if (v_count > 0) then -- TODO end if ;

3,497

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧