--定义一个记录,存放各种数据类型
declare
type student_record_type is record
(
id student.id%type,
age student.age%type,
name student.name%type
);
student_record student_record_type;
begin
select id,age,name into student_record.id,student_record.age,student_record.name from student where ID=2002;
dbms_output.put_line(student_record.id||' '||student_record.age||' '||student_record.name);
end;
--定义一个变量all_row 它的类型是student表所有一列的类型
declare
all_row student%rowtype;
begin
--只能存放一条记录
select * into all_row from student where id=2001;
dbms_output.put_line(all_row.id||' '||all_row.age||' '||all_row.name);
end;
declare
type student_record_type is record
(
id student.id%type,
age student.age%type,
name student.name%type
);
student_record student_record_type;
begin
select id,age,name into student_record.id,student_record.age,student_record.name from student where ID=2002;
dbms_output.put_line(student_record.id||' '||student_record.age||' '||student_record.name);
end;
--定义一个变量all_row 它的类型是student表所有一列的类型
declare
all_row student%rowtype;
begin
--只能存放一条记录
select * into all_row from student where id=2001;
dbms_output.put_line(all_row.id||' '||all_row.age||' '||all_row.name);
end;