1
votes

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.

 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;
1
Does it say what symbols it was expecting? Does it tell you a line/column number?Gabe
@Gabe its saying like this PLS-00103: Encountered the symbol "=" when expecting one of the following: constant exception <an identifier>user1

1 Answers

3
votes

I think it's here (before the 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...

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;