易截截图软件、单文件、免安装、纯绿色、仅160KB

ORACLE PL/SQL 集合学习笔记(二)

三、嵌套表的使用方法
 
1、将嵌套表定义为PL/SQL的程序构造块
 
TYPE type_name IS TABLE OF element_type[NOT NULL];
 
如下例所示:
DECLARE

-- Define a nested table of variable length strings.
TYPE card_table IS TABLE OF VARCHAR2(5 CHAR);

-- Declare and initialize a nested table with three rows.
cards CARD_TABLE := card_table(NULL,NULL,NULL);
BEGIN

-- Print title.
dbms_output.put_line(
'Nested table initialized as nulls.');
dbms_output.put_line(
'----------------------------------');

-- Loop through the three records.
FOR i IN 1..3 LOOP

-- Print the contents.
dbms_output.put ('Cards Varray ['||i||'] ');
dbms_output.put_line('['||cards(i)||']');

END LOOP;

-- Assign values to subscripted members of the varray.
cards(1) := 'Ace';
cards(2) := 'Two';
cards(3) := 'Three';

-- Print title.
dbms_output.put (CHR(10)); -- Visual line break.
dbms_output.put_line(
'Nested table initialized as Ace, Two and Three.');
dbms_output.put_line(
'-----------------------------------------------');

-- Loop through the three records to print the varray contents.
FOR i IN 1..3 LOOP

dbms_output.put_line('Cards ['||i||'] '
|| '['||cards(i)||']');

END LOOP;
END;
/
 
 
2、将嵌套表类型定义和用作PL/SQL的对象类型
CREATE OR REPLACE TYPE type_name
AS TABLE OF element_type [NOT NULL];
 
如下例所示:
-- Define a varray of four rows of variable length strings.
CREATE OR REPLACE TYPE card_unit_varray
AS VARRAY(13) OF VARCHAR2(5 CHAR);
/

-- Define a varray of four rows of variable length strings.
CREATE OR REPLACE TYPE card_suit_varray
AS VARRAY(4) OF VARCHAR2(8 CHAR);
/

-- Define a table of variable length strings.
CREATE OR REPLACE TYPE card_deck_table
AS TABLE OF VARCHAR2(17 CHAR);
/

DECLARE

-- Define a counter to manage 1 to 52 cards in a deck.
counter INTEGER


相关文档:

Oracle存储过程的执行

declare
msg varchar(1000);    --定义一个变量用于显示传出的信息
begin
PRO_TACCOUNT_RECOUNT ('B9D2B59A955541298D59EA8C35668CFD',msg);   --执行存储过程
dbms_output.put_line(msg);   --输出变量
end; ......

oracle 逻辑备份命令EXP/IMP参数参考手册

oracle 逻辑备份命令EXP/IMP参数参考手册
帮助命令:exp help=y
Export: Release 10.2.0.1.0 - Production on Thu Jul 20 10:39:50 2006
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
 You can let Export prompt you for parameters by entering the EXP
command followed b ......

Oracle JOB 用法小结

一、设置初始化参数 job_queue_processes
  sql> alter system set job_queue_processes=n;(n>0)
  job_queue_processes最大值为1000
  
  查看job queue 后台进程
  sql>select name,description from v$bgprocess;
  
  二,dbms_job package 用法介绍
  包含以下子过程:
  
  ......

ORACLE PL/SQL 记录(Record)学习笔记(二)

二、以形参的形式定义和使用记录、对象类型
在用作形式参数时,记录类型和对象类型有很多相同之处。在将它们作为游标、函数或过程的形式参数以前,事先都必须定义一个记录类型或者对象类型。
如下例所示:
 
记录
DECLARE

-- Define a record type.
TYPE individual_record IS RECORD
(individual_id ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号