• 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;

  • 相关阅读:
    android个人中心界面
    开课第十二周周总结
    android----从相册中选择照片
    《程序员修炼之道:从小工到专家》 阅读笔记
    android----pull解析方式
    开课第十一周周总结
    解决数据库连接时区的问题
    实现数组中连续子数组值和最大
    开课第十周周总结
    解 idea(.IntelliJIdea2019.3)双击打不开的原因
  • 原文地址:https://www.cnblogs.com/OldZhao/p/4923744.html
Copyright © 2020-2023  润新知