IF PAUDIT='V' then 下面我接了一句update语句。但提示有错
错误如下:PROCEDURE SALER.PROC_AUDITFLOW 编译错误错误:PLS-00103: 出现符号 "IF"在需要下列之一时:
:= . ( @ % ;
符号 ";" 被替换为 "IF" 后继续。
行:20
文本:if PAUDIT='V' then
请问IF then 后面只能接哪些语句?还有这个错误是什么问题?
错误如下:PROCEDURE SALER.PROC_AUDITFLOW 编译错误错误:PLS-00103: 出现符号 "IF"在需要下列之一时:
:= . ( @ % ;
符号 ";" 被替换为 "IF" 后继续。
行:20
文本:if PAUDIT='V' then
请问IF then 后面只能接哪些语句?还有这个错误是什么问题?
SET t1.text=PAUDIT
where exists(select 1
from ApplyInfo t2, AuditFlow t3
where t1.AppID = t2.ID
and t2.ID = t3.ApplyID(+)
and t3.id = PID);PAUDIT和PID是存储过程传入的参数
SET t1.text=PAUDIT
where exists(select 1
from ApplyInfo t2, AuditFlow t3
where t1.AppID = t2.ID
and t2.ID = t3.ApplyID(+)
and t3.id = PID);
end if;你好像把test t1写在一起了
Create PROCEDURE [dbo].[proc_texttest]
@ID int,
@text char(1),
@Opinion nvarchar(500)
asdeclare @ApplyID int,@textSerial intselect @ApplyID=ApplyID,@textSerial=textSerial
from textFlow
where ID=@IDBEGIN TRANif(@text='V')
begin
update test SET text=@text
from test
inner join UserApplyInfo on AppID=UserApplyInfo.ID
left join textFlow on UserApplyInfo.ID=ApplyID
where textFlow.ID=@ID
endif(@text='Y')
begin if not exists(select ID from textFlow
where ApplyID=@ApplyID and textSerial>@textSerial)
begin
update UserApplyInfo set state=@text
where ID=@ApplyID
update test set text=@text where AppID=@ApplyID
end
else
begin
update textFlow set ArriveDate=getdate() where
ApplyID=@ApplyID and textSerial=@textSerial+1
end
endelse if(@text='N')
begin
if exists(select ID from textFlow
where ApplyID=@ApplyID and textSerial>@textSerial
and text<>'N')
begin
raiserror('无法审核!',16,1)
return
end
else if exists(select ID from textFlow
where ApplyID=@ApplyID and textSerial>@textSerial
and text='N')
begin
update UserApplyInfo set state=@text
where ID=@ApplyID
update test set text=@text where AppID=@ApplyID
endend
update textFlow set text=@text,Opinion=@Opinion,FinishDate=getdate()
where ID=@ID
COMMIT TRAN 以上是SQLSERVER2005里的完整存储过程。麻烦各位帮我翻成ORACLE一下,最好麻烦给个
注释说明下,小弟刚接触ORA几天实在感觉很无力。谢谢了
Create PROCEDURE dbo.proc_texttest (
v_id in number,
v_text in char(1),
v_opinion in varchar2(500)
)
as
v_applyID number;
v_textSerial number;
v_flag number := 0;
begin select ApplyID, textSerial
into v_applyID, v_textSerial
from textFlow
where id = v_id; if v_text = 'V' then
update test t1
SET t1.text=PAUDIT
where exists( select 1
from ApplyInfo t2, AuditFlow t3
where t1.AppID = t2.ID
and t2.ID = t3.ApplyID(+)
and t3.id = v_id); else if v_text = 'Y' then
select count(id) into v_flag from textFlow where ApplyID = v_applyID and textSerial > v_textSerial; if v_flag = 0 then
update UserApplyInfo set state = v_text where ID = v_applyID;
update test set text = v_text where AppID =v_applyID;
else
update textFlow set ArriveDate=sysdate where ApplyID = v_applyID and textSerial=v_textSerial+1;
end if;
else if v_text='N' then
select count(id) into v_flag
from textFlow
where ApplyID = v_applyID
and textSerial > v_textSerial
and text <> 'N';
if v_flag > 0 then
dbms_output.put_line('无法审核!');
else
select count(id) into v_flag
from textFlow
where ApplyID = v_applyID
and textSerial > v_textSerial
and text='N';
if v_flag > 0 then
update UserApplyInfo set state=v_text where id = v_id;
update test set text=v_text where AppID=v_applyID;
end if;
end if;
end if;
update textFlow set text=v_text,Opinion=v_opinion,FinishDate=sysdate where id = v_id; exception
when others then
rollback;
raise;
end proc_texttest;
SET t1.text=PAUDIT
where exists(select 1
from ApplyInfo t2, AuditFlow t3
where t1.AppID = t2.ID
and t2.ID = t3.ApplyID(+)
and t3.id = PID);
end if; --缺少end if;如果编译不通过,请单独调试UPdate语句
update test t1
SET t1.text=PAUDIT 这个应该是v_text