Create or replace procedure Pr_mytest is
V_test number (8);--Variable
V_char VARCHAR2 (10);
C_CHANGL constant Number (12,3): = 3.14;--constant
V_BM T_hq_ryxx.bumbm%type;
Type Ty_ry is record--defines a record type
(
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; --Declare variables of this type of record
V_ryrow t_hq_ryxx%rowtype;--to define all fields of a table as record types
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: = ' Hello ';
Select Xingm,xingb,gongz to 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 to V_BM from T_hq_ryxx where rownum < 2;
Dbms_output.put_line (V_char | | ', test stored procedure, record number of bars: ' | | V_BM);
Select Sno,sname,class to 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;
PL/SQL data type