PL/SQL (MOSC)

MOSC Banner

Does exists a "pseudo column" in collection type?

edited Dec 16, 2011 2:19AM in PL/SQL (MOSC) 12 commentsAnswered
Does exists a "pseudo column" in collection type that identify a record univocally
Example code: 

I wrote ROWID as example of univocal id

CREATE OR REPLACE TYPE ADDRESS_TYP AS OBJECT
(
   STREET VARCHAR2 (30),
   CITY VARCHAR2 (20),
   STATE CHAR (2),
   POSTAL_CODE VARCHAR2 (6)
);
/

CREATE OR REPLACE TYPE ADDRESS_TYP_TABLE AS TABLE OF ADDRESS_TYP;
/

DECLARE
   TAB_ADDRESS   ADDRESS_TYP_TABLE;
BEGIN
   TAB_ADDRESS :=
      ADDRESS_TYP_TABLE (ADDRESS_TYP ('kong gate',
                                      'oslo',
                                      'no',
                                      '0135'),
                         ADDRESS_TYP ('dronning gate',
                                      'oslo',
                                      'no',
                                      '0136'));

   FOR R IN (SELECT STREET
             --, ROWID 
             FROM TABLE (TAB_ADDRESS))
   LOOP
      DBMS_OUTPUT.PUT_LINE ('street: ' || R.STREET  

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center