PL/SQL数据类型

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;

转载于:https://www.cnblogs.com/OldZhao/p/4923744.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值