Live ORACLE

if you are Oracle Developer ,than this Blog most likely will make you happy.

About my Blog

This Blog particularized for Oracle Developers ... you will see interesting Codes for SQL , PL/SQL as well as new ideas for Developer Suite and Client Tools that will help you in your professional life ... and I hope I reach for your satisfaction.

About Me

I'm Hany Freedom , 25 years old , I live in EL-Minia City in Egypt , I'm Moderator at ArabOUG.org the best Arabic Forum for ORACLE on the Net. if you interested to know more about me .... just Click Here.

Specifying Collection Element Types with %TYPE and %ROWTYPE


DECLARE

-- Nested table type that can hold an arbitrary number of employee IDs.

-- The element type is based on a column from the EMPLOYEES table.

-- We do not need to know whether the ID is a number or a string.

TYPE emplist IS TABLE OF employees.employee_id%TYPE;

-- Declare a cursor to select a subset of columns.

CURSOR c1 IS

SELECT employee_id

FROM employees;

-- Declare an Array type that can hold information about 10 employees.

-- The element type is a record that contains all the same

-- fields as the EMPLOYEES table.

TYPE senior_salespeople IS VARRAY(10) OF employees%ROWTYPE;

-- Declare a cursor to select a subset of columns.

CURSOR c2 IS

SELECT first_name,

last_name

FROM employees;

-- Array type that can hold a list of names. The element type

-- is a record that contains the same fields as the cursor

-- (that is, first_name and last_name).

TYPE namelist IS VARRAY(20) OF c2%ROWTYPE;

BEGIN

NULL;

END;

/



Share/Save/Bookmark

0 comments:

Post a Comment



Newer Posts Older Posts Home Page
 
http://www.dpriver.com/images/sqlpp-banner-2.png

Thanks for reading my Blog ... you Visitor Number :-