1. Cursor 사용하기

DECLARE
    V_TBL CSM_WORK_ORG_DTL_TBL%ROWTYPE;
    CURSOR CUR1 IS SELECT CASINO_BUSN_DATE, SFT_NO FROM CSM_WORK_ORG_DTL_TBL;
BEGIN
    OPEN CUR1;
    LOOP
        FETCH CUR1 INTO V_TBL.CASINO_BUSN_DATE, V_TBL.SFT_NO;
        EXIT WHEN CUR1%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(V_TBL.CASINO_BUSN_DATE || V_TBL.SFT_NO);
    END LOOP;
    CLOSE CUR1;
END;
/

 

2. Cursor 사용하지 않고 Loop 

BEGIN
    FOR CUR1 IN (SELECT CASINO_BUSN_DATE, SFT_NO FROM CSM_WORK_ORG_DTL_TBL) LOOP
        DBMS_OUTPUT.PUT_LINE(CUR1.CASINO_BUSN_DATE || CUR1.SFT_NO);
    END LOOP;
END;
/  

 

 

+ Recent posts