Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: Clearing a Collection

Re: PL/SQL: Clearing a Collection

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: Sat, 30 Dec 2006 10:18:56 +0000 (UTC)
Message-ID: <en5eeg$48k$1@klatschtante.init7.net>


On 2006-12-30, rios <rios_at_rios.com> wrote:
> 10gR2
>
> Is assigning NULL to Nested Table (to clear it) documented syntax ?
> or should it be the_nested_table_variable.DELETE ?
>
> DECLARE
> TYPE typ_emp_table IS TABLE OF scott.emp%ROWTYPE;
> l_emp_table typ_emp_table ;
> BEGIN
> select * BULK COLLECT INTO l_emp_table FROM scott.emp;
> -- l_emp_table.DELETE; or l_emp_table := NULL;
> END ;
>
> thanks

Both are correct, but have different meaning.

Depends actually what you understand by 'clearing it'.

If, what I presume, that you want l_emp_table to be without any elements, then the .delete construct is what you're after. l_emp_table is then 'empty' (a collection with no elements) but NOT NULL.

:= null makes the variable being null, so it's even 'emptier' than empty, that is, there is not even a collection 'behind' that variable.

hth
Rene

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch
Received on Sat Dec 30 2006 - 04:18:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US