sql >> Database teknologi >  >> RDS >> Oracle

IF else tilstand i sql lagret procedure

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;


  1. Oracle PL/SQL:Opret DML-pakke online

  2. MySQL Indsæt i Vælg

  3. Kilde ikke fundet JAR-filen mysql-connector-java-5.1.20-bin.jar har ingen kildevedhæftning

  4. Hvordan bruger man variable indstillinger i triggerfunktioner?