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.
King17-JUN-87 24000
C.
King current sysdate 1500
D.
King current sysdate 24000
C
minsal = 1000, later adds 500
and sets hire_date to sysdate
so there you get King sysdate 1500
C
A
to_char(v_hire_date)=17-JAN-87
Rose, you are wrong
there 2 dates
1) v_myrec.v_hire_date = sysdate
2) v_myrec.v_rec1.hire_date = 17-jan-87
a
C
hi, when you want intend as a result , sysdate, please, be more able to explain it.
to my eyes, and mind , the result proposed
king current sysdate 1500
appeared as
king ‘current sysdate’ 1500
and on the contrary…
nothing gave me to intend that 17-JUN-87 couldn’t be the current date of the xecution of the test….
C
C
declare
type t_rec is record
(v_Date employees.hire_Date%type,
v_rec1 employees%rowtype);
v_myrec t_rec;
begin
v_myrec.v_date := sysdate;
select * into v_myrec.v_rec1 from employees where employee_id = 100;
dbms_output.put_line(v_myrec.v_date);
end;
C
c
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;
output : King 03-OCT-15 1500 ie current date or sysdate
Tested and Verified
Correct answer is C.
If anyone having doubts I will suggest them to copy this code and verify it.
C is the correct answer
C
Usually posts some pretty intriguing stuff like this. If you are new to this site.
C
c
y ans is c????