oracle PLS-00103:在预期以下情况之一时遇到符号“=”:
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13245225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PLS-00103: Encountered the symbol "=" when expecting one of the following:
提问by user1
When i try to create the following procedure im gettin this error:"PLS-00103: Encountered the symbol "=" when expecting one of the following:" I cant find where i went wrong, Help me out for resolving this issue.
当我尝试创建以下程序时,我开始出现此错误:“PLS-00103:遇到符号“=”,期望出现以下情况之一:“我找不到我出错的地方,请帮助我解决此问题。
create or replace PROCEDURE ProcName
(inTid IN VARCHAR2,outtxnstatus OUT CHAR,outrowcount OUT NUMBER,outretvalue OUT NUMBER) AS
CURSOR c1 IS
select TXN_STATUS from OP_TTERMINALMASTER where TERMINAL_ID = inTid and TXN_STATUS = 'N' FOR UPDATE OF TXN_STATUS;
outrowcount:= sql%rowcount;
BEGIN
if outrowcount = 1 then
Open c1;
fetch c1 into outtxnstatus;
update OP_TTERMINALMASTER set TXN_STATUS = 'Y' where current of c1;
outretvalue := 5;
CLOSE c1;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
outretvalue := -5;
END;
回答by A.B.Cade
I think it's here (before the BEGIN
):
我认为它在这里(在 之前BEGIN
):
outrowcount:= sql%rowcount;
You declared a cursor in the right place, but then, before the begin
part you trird to assign sql%rowcount
before even opening the cursor...
您在正确的位置声明了一个游标,但是,在begin
您尝试分配的部分sql%rowcount
之前,甚至在打开游标之前...
Try
尝试
create or replace PROCEDURE ProcName
(inTid IN VARCHAR2,outtxnstatus OUT CHAR,outrowcount OUT NUMBER,outretvalue OUT NUMBER) AS
BEGIN
update OP_TTERMINALMASTER set TXN_STATUS = 'Y'
where TERMINAL_ID = inTid and TXN_STATUS = 'N';
outrowcount:= sql%rowcount;
outretvalue := 5;
EXCEPTION
WHEN NO_DATA_FOUND THEN
outretvalue := -5;
END;