1 create or replace procedure pr_mytest is 2 3 4 5 v_test number(8) :=123; 6 v_char varchar2(10):='数据库'; 7 c_changl constant number(12,2) :=3.14; 8 v_bm t_hq_ryxx.bum%type; 9 type ty_ry is record --复合类型里的记录类型,定义了一种新的记录类型 10 ( 11 v_xingm t_hq_ryxx.xingm%type, 12 v_xingb t_hq_ryxx.xingb%type, 13 v_gongz number(10,2) 14 ); 15 16 v_ry ty_ry; --声明这种记录类型的变量 17 18 v_ryrow t_hq_ryxx%rowtype; --表的所有字段 19 20 21 22 23 begin 24 25 v_char :='你好'; 26 --c_chang1 := 12.45; 27 28 select count(1) into v_test from t_hq_ryxx; 29 dbms_output.put_line(v_char ||',测试存储过程,记录条数='||v_test); 30 31 select bum into v_bm from t_hq_ryxx where rownum = 1; 32 dbms_output.put_line(v_char ||',测试存储过程,记录条数='||v_bm); 33 34 select xingm,xingb,gongz into v_ry from t_hq_ryxx where rownum = 1; 35 dbms_output.put_line('记录类型=' || v_ry.v_xingm || ' '|| v_ry.v_xingb ||' '||v_ry.v_gongz); 36 37 select * into v_ryrow from t_hq_ryxx where rownum = 1; 38 dbms_output.put_line('行记录类型=' || v_ryrow.xingm || ' '|| v_ryrow.xingb ||' '||v_ryrow.gongz|| ' '||v_ryrow.nianl); 39 40 41 42 43 end pr_mytest;