Pre-filled table collection of varchars in a package : Package Variables « Function Procedure Packages « Oracle PL/SQL Tutorial

Home
Oracle PL/SQL Tutorial
1.Introduction
2.Query Select
3.Set
4.Insert Update Delete
5.Sequences
6.Table
7.Table Joins
8.View
9.Index
10.SQL Data Types
11.Character String Functions
12.Aggregate Functions
13.Date Timestamp Functions
14.Numerical Math Functions
15.Conversion Functions
16.Analytical Functions
17.Miscellaneous Functions
18.Regular Expressions Functions
19.Statistical Functions
20.Linear Regression Functions
21.PL SQL Data Types
22.PL SQL Statements
23.PL SQL Operators
24.PL SQL Programming
25.Cursor
26.Collections
27.Function Procedure Packages
28.Trigger
29.SQL PLUS Session Environment
30.System Tables Data Dictionary
31.System Packages
32.Object Oriented
33.XML
34.Large Objects
35.Transaction
36.User Privilege
Oracle PL/SQL Tutorial » Function Procedure Packages » Package Variables 
27.12.8.Pre-filled table collection of varchars in a package
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE strings_nt IS TABLE OF VARCHAR2(100);
  2  /

Type created.

SQL>
SQL>
SQL> CREATE OR REPLACE PACKAGE employees_pkg
  2  IS
  3     vancouver_employees strings_nt := strings_nt ('R''H''D''S''C');
  4     newyork_employees   strings_nt := strings_nt ('H''S''A');
  5     boston_employees    strings_nt := strings_nt ('S''D');
  6
  7     PROCEDURE show_employees (title_in IN VARCHAR2, employees_in IN strings_nt
  8     );
  9  END;
 10  /

Package created.

SQL> SHO ERR
No errors.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY employees_pkg
  2  IS
  3     PROCEDURE show_employees (title_in IN VARCHAR2,employees_in IN strings_nt)
  4     IS
  5     BEGIN
  6        DBMS_OUTPUT.put_line (title_in);
  7
  8        FOR indx IN employees_in.FIRST .. employees_in.LAST
  9        LOOP
 10           DBMS_OUTPUT.put_line (indx || ' = ' || employees_in (indx));
 11        END LOOP;
 12
 13     END show_employees;
 14  END;
 15  /

Package body created.

SQL> SHOw error
No errors.
27.12.Package Variables
27.12.1.Package constant variable
27.12.2.Cursor variable in a package
27.12.3.Serially Reusable Packages
27.12.4.Test unit for package scopes
27.12.5.Define constant in a package
27.12.6.Package level cursor variable
27.12.7.Use function to initialize the package level variable
27.12.8.Pre-filled table collection of varchars in a package
27.12.9.Private field
27.12.10.Use package to define variable and use across code blocks
27.12.11.Demonstrate using a packaged ref cursor for passing sets
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.