⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 create_nestedtable2.sql

📁 介绍Oracle PL SQL编程
💻 SQL
字号:
/* * create_nestedtable2.sql * Chapter 6, Oracle10g PL/SQL Programming * by Ron Hardman, Michael McLaughlin and Scott Urman * * This constructs a null element nested table, then extends it one element at a time. */SET ECHO ONSET SERVEROUTPUT ON SIZE 1000000DECLARE  -- Define a nested table of variable length strings.  TYPE card_suit IS TABLE OF VARCHAR2(5 CHAR);  -- Declare and initialize a null set of rows.  cards CARD_SUIT := card_suit();BEGIN  -- Loop through the three records.  FOR i IN 1..3 LOOP    -- Initialize row.    cards.EXTEND;    -- Assign values to subscripted members of the varray.    IF    i = 1 THEN      cards(i) := 'Ace';    ELSIF i = 2 THEN      cards(i) := 'Two';    ELSIF i = 3 THEN      cards(i) := 'Three';    END IF;  END LOOP;  -- Print title.  dbms_output.put_line(    'Nested table initialized as Ace, Two and Three.');  dbms_output.put_line(    '-----------------------------------------------');  -- Loop through the records to print the nested table.  FOR i IN 1..3 LOOP    -- Print the contents.    dbms_output.put     ('Cards ['||i||'] ');    dbms_output.put_line('['||cards(i)||']');  END LOOP;END;/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -