The execution of the code produces errors. Identify the error in the code.

Examine the following PL/SQL code;


The execution of the code produces errors. Identify the error in the code.
A. The open cursor is missing
B. The fetch clause is missing
C. The exit when condition is missing
D. The EMP_NAME and EMP_JOB variables cannot be used in the for clause of the cursor FOR statement.

Download Printable PDF. VALID exam to help you PASS.

3 thoughts on “The execution of the code produces errors. Identify the error in the code.

  1. Correct syntax to use with cursors:

    declare
    emp_name employees.last_name%type;
    emp_job employees.job_id%type;
    cursor c1 is
    select last_name,job_id from employees
    where job_id like ‘%CLERK%’ and manager_id>120;
    BEGIN
    for a1 in c1 loop
    dbms_output.put_line(‘Name = ‘ ||a1.last_name||’, Job= ‘||a1.job_id);
    end loop;
    END;
    /

  2. Correct answer D.
    You can execute following statement, it gives error:

    HR@XE > declare
    2 emp_name employees.last_name%type;
    3 emp_job employees.job_id%type;
    4 cursor c1 is
    5 select last_name,job_id from employees
    6 where job_id like ‘%CLERK%’ and manager_id>120;
    7 BEGIN
    8 for emp_name,emp_job in c1 loop
    9 dbms_output.put_line(‘Name = ‘ ||emp_name||’, Job= ‘||emp_job);
    10 end loop;
    11 END;
    12 /
    for emp_name,emp_job in c1 loop
    *
    ERROR at line 8:
    ORA-06550: line 8, column 14:
    PLS-00103: Encountered the symbol “,” when expecting one of the following:
    in

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.