| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Variable to hold a cast table??
aabdis_at_yahoo.com (Eidolon Ivanovich) wrote in message news:<f542889f.0410221240.783fa905_at_posting.google.com>...
> Hello all, i have a SPLIT function which splits a string on a
> delimeter and returns back a table type.
> In order to use the resuls, i can do:
> 
> SELECT COLUMN_VALUE FROM TABLE(CAST(SPLIT(pLOTLOCs,DelimLOTLOCs) as
> TBL_VARCHAR2))
> 
> What i would like to do is to create a local variable in my procedure
> to store the results of:
> TABLE(CAST(SPLIT(pLOTLOCs,DelimLOTLOCs) as TBL_VARCHAR2))
> 
> So maybe i could make a variable something like 
> TAB_LOTLOCs    SOMETYPE := TABLE(CAST(SPLIT(pLOTLOCs,DelimLOTLOCs) as
> TBL_VARCHAR2));
> 
> Then i dont have to keep doing all the spliting and casting. I could
> then just do
> SELECT COLUMN_VALUE FROM TAB_LOTLOCs. 
> 
> How can i do this?? 
> 
> Thanks in advance.
Wouldn't a REF CURSOR work? As I don't have a split funtion to work with I'm going "off-the-cuff". However, it looks like you could do something like:
Declare
x ref cursor;
begin
open x for SELECT COLUMN_VALUE 
FROM TABLE(CAST(SPLIT(pLOTLOCs,DelimLOTLOCs) as TBL_VARCHAR2));
-- do whatever you want with x
end;
Received on Mon Oct 25 2004 - 15:01:48 CDT
![]()  | 
![]()  |