nested table creation error [message #451033] |
Mon, 12 April 2010 03:55 |
jitender.sadh
Messages: 86 Registered: May 2007
|
Member |
|
|
hi all,
i am getting compilation error when create nested table type depend on table structure
SQL> CREATE OR REPLACE TYPE typ$nttb$1 IS TABLE OF emp%rowtype
2 ;
3 /
Warning: Type created with compilation errors.
SQL> show error
Errors for TYPE TYP$NTTB$1:
LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PL/SQL: Compilation unit analysis terminated
1/29 PLS-00329: schema-level type has illegal reference to SCOTT.EMP
SQL>
please suggest whats wrong in that.
best regards
jitender sadh
|
|
|
|
Re: nested table creation error [message #451050 is a reply to message #451033] |
Mon, 12 April 2010 04:43 |
jitender.sadh
Messages: 86 Registered: May 2007
|
Member |
|
|
hi,
i know its wrong (emp%rowtype) but when i use same declaration in pl/sql its working
SQL> DECLARE
2 TYPE typ$nsttb$1 IS TABLE OF emp%ROWTYPE;
3 v_typ$nsttb$1 typ$nsttb$1;
4 BEGIN
5 SELECT * BULK COLLECT INTO v_typ$nsttb$1 FROM emp;
6 FOR i IN v_typ$nsttb$1.first .. v_typ$nsttb$1.last LOOP
7 Dbms_Output.put_line(v_typ$nsttb$1(i).empno||'-'||v_typ$nsttb$1(i).ename);
8 END LOOP;
9 END;
10
11 /
PL/SQL procedure successfully completed.
can you please tell me the reason why it behave like that when work with sql.
best regards
jitender sadh
|
|
|
|
|
|