View the Exhibit to examine the PL/SQL code.
The record for the employee with employee__id 100 in the employees table is as follows;
Identify the correct output for the code.
A. King 17-JUN-87 1500
B. King 17-JUN-87 24000
C. King current sysdate 1500
D. King current sysdate 24000
Verified that correct answer is C by executing:
set serveroutput on;
DECLARE
type t_rec is record
(v_sal number(8),
v_minsal number(8) default 1000,
v_hire_date employees.hire_date%type,
v_rec1 employees%rowtype);
v_myrec t_rec;
BEGIN
v_myrec.v_sal:=v_myrec.v_minsal+500;
v_myrec.v_hire_date:=sysdate;
SELECT * INTO v_myrec.v_rec1
from employees WHERE employee_id=100;
dbms_output.put_line(v_myrec.v_rec1.last_name||’ ‘||
to_char(v_myrec.v_hire_date)|| ‘ ‘||to_char(v_myrec.v_sal));
END;
/
King 10-MAY-19 1500
PL/SQL procedure successfully completed.
Confirming correct answer is C.
Verified on test database:
set serveroutput on;
DECLARE
type t_rec is record
(v_sal number(8),
v_minsal number(8) default 1000,
v_hire_date employees.hire_date%type,
v_rec1 employees%rowtype);
v_myrec t_rec;
BEGIN
v_myrec.v_sal:=v_myrec.v_minsal+500;
v_myrec.v_hire_date:=sysdate;
SELECT * INTO v_myrec.v_rec1
from employees WHERE employee_id=100;
dbms_output.put_line(v_myrec.v_rec1.last_name||’ ‘||
to_char(v_myrec.v_hire_date)|| ‘ ‘||to_char(v_myrec.v_sal));
END;
/
King 10-MAY-19 1500
PL/SQL procedure successfully completed.