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

📄 vassign.sql

📁 Oracle 9i PL/SQL程序设计的随书源码
💻 SQL
字号:
REM vAssign.sql
REM Chapter 8, Oracle9i PL/SQL Programming by Scott Urman
REM This file illustrates legal and illegal varray assignments.

DECLARE
  TYPE Strings IS VARRAY(5) OF VARCHAR2(10);

  -- Declare a varray with three elements
  v_List Strings :=
    Strings('One', 'Two', 'Three');
BEGIN
  -- Subscript between 1 and 3, so this is legal.
  v_List(2) := 'TWO';

  -- Subscript beyond count, raises ORA-6533.
  v_List(4) := '!!!';
END;
/

DECLARE
  TYPE Strings IS VARRAY(5) OF VARCHAR2(10);
  -- Declare a varray with four elements,
  v_List Strings :=
    Strings('One', 'Two', 'Three', 'Four');
BEGIN
  -- Subscript between 1 and 4, so this is legal.
  v_List(2) := 'TWO';
  
  -- Extend the table to 5 elements and set the value.
  v_List.EXTEND;
  v_List(5) := 'Five';
  
  -- Attempt to extend the table to 6 elements.  This will raise
  -- ORA-6532. 
  v_list.EXTEND;
END;
/

⌨️ 快捷键说明

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