count.sql

来自「Oracle 9i PL/SQL程序设计的随书源码」· SQL 代码 · 共 26 行

SQL
26
字号
REM count.sql
REM Chapter 8, Oracle9i PL/SQL Programming by Scott Urman
REM This block demonstrates the COUNT collection method.

DECLARE
  v_NestedTable NumTab := NumTab(1, 2, 3);
  v_Varray NumVar := NumVar(-1, -2, -3, -4);
  v_IndexByTable IndexBy.NumTab;
BEGIN
  -- First add some elements to the index-by table.  Note that
  -- the index values are not sequential.
  v_IndexByTable(1) := 1;
  v_IndexByTable(8) := 8;
  v_IndexByTable(-1) := -1;
  v_IndexByTable(100) := 100;

  -- And print out the counts.
  DBMS_OUTPUT.PUT_LINE(
    'Nested Table Count: ' || v_NestedTable.COUNT);
  DBMS_OUTPUT.PUT_LINE(
    'Varray Count: ' || v_Varray.COUNT);
  DBMS_OUTPUT.PUT_LINE(
    'Index-By Table Count: ' || v_IndexByTable.COUNT);
END;
/

⌨️ 快捷键说明

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