一、编写一个pl/sql语句块将100条记录插入表中。
二、编写一个pl/sql语句块计算某表的记录总数,并打印。
三、查询编号为101的学生姓名
declare
v_name student.stu_name%type;
begin
select stu_name into v_name from student where stu_id='101';
dbms_output.put_line('学生姓名:'||v_name); end;
四、定义一个记录类型student,对应于student的记录,查询编号为101的学生信息,并打印。
declare
type stud is record(
stuid student.stu_id%type,
stuname student.stu_name%type,
studate student.stu_date%type,
stutype stu_type.type_name%type
);
v_stu stud;
begin
select s.stu_id,s.stu_name,s.stu_date,t.type_name into v_stu
from student s left join stu_type t on s.stu_type=t.type_id
where s.stu_id='101';
dbms_output.put_line(v_stu.stuid||','||v_stu.stuname||','||v_stu.stu date||','||v_stu.stutype);
end;
declare
v_stu student%rowtype;
begin
select * into v_stu
from student
where stu_id='101';
dbms_output.put_line(v_stu.stu_id||','||v_stu.stu_name||','||v_stu.s tu_date||','||v_stu.stu_type);
end;
五、If流程控制
declare
v_cnt number;
begin