create or replace procedure pr_mytest is
v_test number(8);--变量
v_char varchar2(10);
c_changl constant number (12,3):= 3.14;--常量
v_bm t_hq_ryxx.bumbm%type;
type ty_ry is record --定义了一种记录类型
(
v_xingm t_hq_ryxx.xingm%type,
v_xingb t_hq_ryxx.xingb%type,
v_gongz t_hq_ryxx.gongz%type
);
v_ry ty_ry; --声明这种记录类型的变量
v_ryrow t_hq_ryxx%rowtype;--把表的所有字段定义为记录类型
type ty_xs is record
(
v_sno t_hq_student.sno%type,
v_sname t_hq_student.sname%type,
v_class t_hq_student.class%type
);
v_xs ty_xs;
v_xsrow t_hq_student%rowtype;
begin
v_char := '你好';
select xingm,xingb,gongz into v_ry from t_hq_ryxx where rownum =1;
dbms_output.put_line(v_ry.v_xingm ||' '|| v_ry.v_xingb ||' '|| v_ry.v_gongz);
select * into v_ryrow from t_hq_ryxx where rownum =1;
dbms_output.put_line(v_ryrow.xingm ||' '|| v_ryrow.xingb ||' '|| v_ryrow.gongz);
select bumbm into v_bm from t_hq_ryxx where rownum < 2;
dbms_output.put_line(v_char ||',测试存储过程,记录条数为:' ||v_bm);
select sno,sname,class into v_xs from t_hq_student where rownum =1;
dbms_output.put_line(v_xs.v_sno || ' ' || v_xs.v_sname || ' ' || v_xs.v_class );
select * into v_xsrow from t_hq_student where rownum = 1;
dbms_output.put_line(v_xsrow.sno || ' '|| v_xsrow.sname || ' ' || v_xsrow.sbirthday || ' ' || v_xsrow.class);
end pr_mytest;