日期:2014-05-17 浏览次数:21029 次
declare
type column_type is record (v_employee_id hr.employees.EMPLOYEE_ID%type,
v_first_name hr.employees.FIRST_NAME%type,
v_last_name hr.employees.LAST_NAME%type,
v_phone_number hr.employees.PHONE_NUMBER%type,
v_hire_date hr.employees.HIRE_DATE%type);
column_type_record column_type;
c1 cursor(j_id varchar2)
return column_type
is
select EMPLOYEE_id, first_name, last_name, phone_number, hire_date
from hr.employees where job_id= j_id;
begin
open c1(j_id >= '3100');
loop
fetch c1 into column_type_record;
if
c1%found then
dbms_output.PUT_LINE(column_type_record.v_employee_id||column_type_record.v_first_name||column_type_record.v_last_name||column_type_record.v_phone_number||column_type_record.v_hire_date);
end if;
end loop;
close c1;
end;
declare
type column_type is record (v_employee_id hr.employees.EMPLOYEE_ID%type,
v_first_name hr.employees.FIRST_NAME%type,
v_last_name hr.employees.LAST_NAME%type,
v_phone_number hr.employees.PHONE_NUMBER%type,
v_hire_date hr.employees.HIRE_DATE%type);
column_type_record column_type;
[b]cursor c1(j_id in varchar2)[/b]
return column_type
is
select EMPLOYEE_id, first_name, last_name, phone_number, hire_date
from hr.employees where job_id= j_id;
begin
[b]open c1('3100');[/b]
loop
fetch c1 into column_type_record;
[b]exit when c1%notfound;[/b]
if
c1%found then
dbms_output.PUT_LINE(column_type_record.v_employee_id||column_type_record.v_first_name||column_type_record.v_last_name||column_type_record.v_phone_number||column_type_record.v_hire_date);
end if;
end loop;
close c1;
end;
------解决方案--------------------
--改一下
DECLARE
TYPE column_type IS RECORD(
v_employee_id hr.employees.EMPLOYEE_ID%TYPE,
v_first_name