create or replace procedure pr_first is --一个变量 v_a varchar2(30) := ‘总有一天我的生命将走到尽头‘; --一个常量 c_b constant varchar2(20) := ‘而你将加冕为王!‘; v_xingm t_hq_ryxx.xingm%type; type ty_ry is record ( v_nianl t_hq_ryxx.nianl%type, v_gongz number(10,2) ); v_ry ty_ry; v_ryrow t_hq_ryxx%rowtype; begin select xingm into v_xingm from t_hq_ryxx where rownum = 1; dbms_output.put_line(‘主角是‘ || v_xingm); select nianl,gongz into v_ry from t_hq_ryxx where rownum = 1; dbms_output.put_line(v_xingm || ‘的年龄是‘ || v_ry.v_nianl || ‘,工资为‘ || v_ry.v_gongz); select * into v_ryrow from t_hq_ryxx where rownum < 2; dbms_output.put_line(‘人物:‘ || v_ryrow.xingm || ‘,性别:‘ || v_ryrow.xingb || ‘,年龄‘ || v_ryrow.nianl); dbms_output.put_line(‘国王对阿尔萨斯说:‘ || v_a || ‘,‘ || c_b); end pr_first;
SQL> exec pr_first; 主角是阿尔萨斯 阿尔萨斯的年龄是24,工资为0 人物:希尔瓦纳斯风行者,性别:2,年龄24 国王对阿尔萨斯说:总有一天我的生命将走到尽头,而你将加冕为王! PL/SQL procedure successfully completed
时间: 2024-11-05 20:49:31