Collections - Nested Tables and VARRAY [message #659058] |
Thu, 05 January 2017 05:33 |
pointers
Messages: 451 Registered: May 2008
|
Senior Member |
|
|
Hi,
I was reading a plsql book written by Steven Furestein.
And I read the below statement about NESTED TABLE and VARRAY Collections.
Quote:Collection elements are of a single type, which canbe most scalar datatypes, an object type, or a REF object type.
If the elements are objects, the object type itself cannot have an attribute that is a collection.
In PL/SQL, if you are creating a collection with RECORD elements, its fields can be only scalars or objects. Explicitly disallowed collection datatypes are BOOLEAN, NCHAR, NCLOB, NVARCHAR2, REF CURSOR, TABLE, and VARRAY (non-SQL datatype).
What I am confused is I could create a collection in sql with nchar or nclob and even in plsql.
e.g. create or replace type emp_nt is table of nchar;
In PLSQL,
DECLARE
TYPE emp_nt IS TABLE OF NCHAR;
l_empname emp_nt := emp_nt();
BEGIN
l_empname.extend;
l_empname(1):='h';
dbms_output.put_line(l_empname(1));
END;
/
What exactly the bold statement means.
Thank you in advance.
Regards,
Pointers
|
|
|
Re: Collections - Nested Tables and VARRAY [message #659059 is a reply to message #659058] |
Thu, 05 January 2017 06:14 |
cookiemonster
Messages: 13925 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Which version was the latest when the book was written?
Which version are you using to test?
I would expect the n* types to be allowed, but it's entirely possible they weren't initially and oracle fixed it in a later version.
|
|
|
|
|