Write a PL/SQL code to print all tables up to a number fetched from a table using implicit cursors.
DECLARE
stud_first_name VARCHAR2(35);
stud_last_name VARCHAR2(35);
college_id NUMBER:=&stud_id;
BEGIN
SELECT first_name,
last_name
INTO stud_first_name, stud_last_name
FROM student
WHERE stud_id = college_id;
dbms_output.Put_line ('Student Name: '|| stud_first_name ||' '||stud_last_name);
EXCEPTION
WHEN no_data_found THEN
dbms_output.Put_line ('There is no employee with the ID '||to_char(college_id));
END;
Comments
Leave a comment