1. Write a PL/SQL code to print all tables up to a number fetched from a table using implicit cursors.
BEGIN
FOR emprec IN(SELECT department_name,
d.department_id,
first_name,
last_name,
job_id,
salary
FROM departments d
join employees e
ON e.department_id = d.department_id
WHERE job_id = 'ST_CLERK'
AND salary > 3000) LOOP
dbms_output.Put_line('Name: '
||emprec.first_name
||' '
||emprec.last_name||chr(9)
||' Department: '
||emprec.department_name||chr(9)
||' Department ID: '
||emprec.department_id||chr(9)
||' Job ID: '
||emprec.job_id||chr(9)
||' Salary: '
||emprec.salary);
END LOOP;
END;
Comments
Leave a comment