Oracle
 sql >> Base de données >  >> RDS >> Oracle

IF else condition dans la procédure stockée sql

CREATE
PROCEDURE checkFroud2(
          code IN VARCHAR2,
          p_recordset OUT SYS_REFCURSOR)
AS
BEGIN
     IF code='C' THEN
     dbms_output.put_line('this is if block');
     OPEN p_recordset FOR        
     SELECT * FROM emp;
     ELSIF code='F' THEN

     --you can open p_recordset with dummy as
     /*open p_recordset for select * from dual where 1 = 0; */
          dbms_output.put_line('this is else block');

     ELSE
     /*open p_recordset for select * from dual where 1 = 0; */
          dbms_output.put_line('last else');
     END IF;
END checkFroud2;
/

var o refcursor;
BEGIN
CHECKfroud2
('C',:o);

END;
/

PRINT O;