Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to assign values to a table of Record Type
On Wed, 29 Nov 2006 02:42:45 -0800, Rama Shankar wrote:
> Hi,
> I need to assign the tab1 variable as
>
> ABC, 101
> XYZ, 202
>
> type rec is record (nm varchar2(10),id number);
> type tab is table of rec;
> tab1 tab;
>
> Is it possible something like
>
> tab1 tab:= tab(rec('ABC',101),rec('XYZ',202)).
>
> I tried above syntax but got compilation error.
>
> Pls suggest , is there a way to do so.
No, there is no way to do this:
1 declare
2 type rec is record (nm varchar2(10),id number);
3 type tab is table of rec;
4 rec1 rec;
5 tab1 tab;
6 begin
7 rec1.nm:='ABC';
8 rec1.id:=101;
9 tab1:=tab(rec1);
10* end;
SQL> /
PL/SQL procedure successfully completed.
-- http://www.mladen-gogala.comReceived on Wed Nov 29 2006 - 07:11:07 CST