Home » SQL & PL/SQL » SQL & PL/SQL » Collections - Nested Tables and VARRAY (Oracle 11.2.0.3)
Collections - Nested Tables and VARRAY [message #659058] Thu, 05 January 2017 05:33 Go to next message
pointers
Messages: 439
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 Go to previous messageGo to next message
cookiemonster
Messages: 13017
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.
Re: Collections - Nested Tables and VARRAY [message #659062 is a reply to message #659059] Thu, 05 January 2017 06:54 Go to previous messageGo to next message
pointers
Messages: 439
Registered: May 2008
Senior Member
Hi,

Thank you for your response.

The book is 5th edition of Oracle PLSQL programming covers through Oracle Database 11g Release 2.

Regards,
Pointers
Re: Collections - Nested Tables and VARRAY [message #659063 is a reply to message #659058] Thu, 05 January 2017 07:31 Go to previous message
Michel Cadot
Messages: 65389
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Why don't you ask the author? His email is public.

Previous Topic: EXTERNAL TABLE CREATION ERROR
Next Topic: email validation
Goto Forum:
  


Current Time: Sat Feb 24 19:58:36 CST 2018

Total time taken to generate the page: 0.08711 seconds