mercredi 21 octobre 2015

Oracle : PLS-00103 occur on procedure with condition

When I tried to compile this procedure:

PROCEDURE GET_NUMBER_PROPOSED_TRADES(p_client_id NUMBER, p_curr_id NUMBER, p_cursor  OUT sys_refcursor)
IS
BEGIN  
  OPEN p_cursor FOR
      IF (p_client_id = 0 AND p_curr_id = 0)
      THEN
        SELECT COUNT (DISTINCT NVL(id,0)) AS "Proposed_Trade_Number"  FROM proposed_trade;
      ELSE
        SELECT COUNT (DISTINCT NVL(id,0)) AS "Proposed_Trade_Number"  FROM proposed_trade WHERE client_id = p_client_id AND ccy_id = p_curr_id;
      END IF;
END GET_NUMBER_PROPOSED_TRADES;

this error occurred:

Error(9,11): PLS-00103: Encountered the symbol "IF" when expecting one of the following: ( - + case mod new not null select with continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe

Error(18,1): PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following: end not pragma final instantiable order overriding static member constructor map The symbol "static" was substituted for "PROCEDURE" to continue.

Error(25,1): PLS-00103: Encountered the symbol "PROCEDURE" when expecting one of the following: end not pragma final instantiable order overriding static member constructor map The symbol "static" was substituted for "PROCEDURE" to continue.

But the thing is, if I just remove IF condition, I can compile it easily, so this kind of a new for me

Aucun commentaire:

Enregistrer un commentaire