zoukankan      html  css  js  c++  java
  • Oracle 自定义结构(Record)

    引用这位大大的:

    http://www.cnblogs.com/lovemoon714/archive/2012/02/29/2373780.html

    1、概念及使用

         类似于C中的自定义类型,可用于定义某表的字段集合。 

           定义格式  type recordName is Record(
                             字段名称 字段类型,
                             字段名称 字段类型
                         );

           使用步骤: 1)声明结构体   2)定义结构体变量 3)使用。

    2、例:

    --在匿名块中使用record,也可定义在过程、函数、包中。
    declare
        --声明结构体
        type re_stu is record(
            rname student.name%type,  --中间用逗号分开
            rage  student.age%type    --最后一个字段没有符号
        );  --以分号结束
        --定义结构体变量
        rw_stu re_stu;
        cursor c_stu is select name,age from student;
    begin
        open c_stu;
        loop
            fetch c_stu into rw_stu;  --使用结构体变量
            exit when c_stu%notfound;
            dbms_output.put_line('姓名='||rw_stu.rname||' 年龄='||rw_stu.rage);
        end loop;
        close c_stu;   
    end;
  • 相关阅读:
    python学习笔记——拾
    python学习笔记——玖
    Python 实现栈与队列
    Vijos1774 机器翻译 [模拟]
    Vijos1788 第K大 [模拟]
    Python 序列求和
    HDU 2102 A计划 DFS与BFS两种写法 [搜索]
    Python 多组输入
    Python 文件读写
    HDU 2068 RPG错排 [错排公式]
  • 原文地址:https://www.cnblogs.com/xushining/p/5448835.html
Copyright © 2011-2022 走看看