For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
hi guys ... I'm having a problem creating this procedure and I can't solve this problem Do you have a solution or any tips? -------------------------------------------------------------------------------- Goal from procedure: to print employee name and grades based on salary. -------------------------------------------------------------------------------- Problem/Error: Compilation failed,line 13 (13:52:34) PLS-00201: identifier 'CURSOR' must be declaredCompilation failed,line 13 (13:52:34) PL/SQL: SQL Statement ignoredCompilation failed,line 41 (13:52:34) PLS-00201: identifier 'CURSOR' must be declaredCompilation failed,line 41 (13:52:34) PL/SQL: SQL Statement ignored -------------------------------------------------------------------------------- Code/sql pl: create or replace PROCEDURE printgrades is CURSOR nasa IS SELECT ename, sal FROM emp; r_nasa nasa%ROWTYPE; BEGIN --open cursor to allocate memory for cursor IF NOT nasa%ISOPEN THEN OPEN CURSOR; END IF; --start point of looping on the cursor LOOP --fetching data from cursor FETCH nasa INTO r_nasa; DBMS_OUTPUT.PUT(r_nasa.ename || ', '); --classification of employees according to salary CASE WHEN r_nasa.sal>1 AND r_nasa.sal<=1000 THEN DBMS_OUTPUT.PUT('LESS THAN 1000'); WHEN r_nasa.sal>1000 AND r_nasa.sal<=2000 THEN DBMS_OUTPUT.PUT('BETWEEN 1000 & 2000'); WHEN r_nasa.sal>2000 AND r_nasa.sal<=3000 THEN DBMS_OUTPUT.PUT('BETWEEN 2000 & 3000'); WHEN r_nasa.sal>3000 THEN DBMS_OUTPUT.PUT('GREATER THAN 3000'); ELSE DBMS_OUTPUT.PUT('Invailed salary value!'); END CASE; --condition to prevent infinite looping EXIT WHEN nasa%NOTFOUND; --end point of looping on the cursor END LOOP; --close cursor to release the allocated memory IF nasa%ISOPEN THEN CLOSE CURSOR; END IF; END printgrades; ------------------------------------------------------------------------