oracle 中PL/SQL中type的简单用法
2012-11-27 22:32
453 查看
转自:http://hi.baidu.com/mangkata/item/d72531c26126eb5dbdef69f8 oracle 中PL/SQL中type的简单用法 1.参考系统的变量类型声明一个type declare type myrecord is record(id varchar2(10),names varchar2(10)); real_record myrecord; begin select EMPNO, ENAME into real_record from emp where empno='7369'; dbms_output.put_line(real_record.id||' '||real_record.names); end; 2.参考系统中存在的表的字段类型创建(其中emp表是SCOTT用户下的一张表) declare type myrecord is record(id emp.empno%type,names emp.ename%type); real_record myrecord; begin select EMPNO, ENAME into real_record from emp where empno='7369'; dbms_output.put_line(real_record.id||' '||real_record.names); end; 3.完全参照一个表来创建 declare myrec emp%rowtype; begin select * into myrec from emp where empno='7369'; dbms_output.put_line(myrec.empno||' '||myrec.ename||' '||myrec.job); end;
相关文章推荐
- PL/SQL中执行字符串SQL(表名)--execute immediate的简单用法(oracle)
- PL/SQL记录和表(oracle type(数组))(最简单!文章下面标黄标题是精华,必看)
- PL/SQL记录和表(oracle type(数组))(最简单!文章下面标黄标题是精华,必看)
- Oracle中的PL/SQL的简单用法
- ORACLE PL/SQL循环简单使用
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- Oracle PL/SQL中使用%TYPE和%ROWTYPE的区别
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- pl/sql对oracle10进行简单操作
- Oracle PL/SQL 语句块用法
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- Oracle_PL/SQL的基本写法_BEGIN_END块结构及简单的事务实现
- Oracle笔记 六、PL/SQL简单语句块、变量定义
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- Oracle笔记 六、PL/SQL简单语句块、变量定义
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- Oracle_PL/SQL的基本写法_BEGIN_END块结构及简单的事务实现
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE
- Oracle笔记 六、PL/SQL简单语句块、变量定义
- Oracle PL/SQL中如何使用%TYPE和%ROWTYPE