May be you shall try this approach.
set serveroutput on size 1000000;
set echo on
DROP TYPE my_table_type
/
CREATE or REPLACE TYPE my_record_type as OBJECT
( MSG_SYS_NO NUMBER(12) )
/
CREATE or REPLACE TYPE my_table_type as TABLE of my_record_type
/
declare
buf_data my_table_type := my_table_type() ;
begin
buf_data.EXTEND ;
buf_data(1) := my_record_type(123456789012) ;
buf_data.EXTEND ;
buf_data(2) := my_record_type(123456789012) ;
FOR CX in
(
select MSG_SYS_NO from
TABLE ( cast( buf_data as my_table_Type ) )
)
loop
dbms_output.put_line('msg_sys_no = '||cx.msg_sys_no);
end loop;
end;
/
set echo off
HTH
GovindanK
[Email Address Removed] wrote:
I need to make a variable inlist. cant quite get this to work. any ideas?
below is not the functionality i need it for. Im just trying to figure out how to do a cast function. any ideas?
1 declare
2 type mytable is table of number;
3 ltable mytable;
4 myval number;
5 cursor crid is
6 SELECT col_id
7 FROM tab1
8 WHERE col2 = 1111;
9 begin
10 for rid in crid loop
11 ltable.extend;
12 ltable(ltable.count) := rid.col_id;
13 dbms_output.put_line(ltable.count);
14 end loop;
15 select count(*)
16 into myval
17 from tab2
18 where my_id in
19 ( select *
20 from THE (select cast (ltable as mytable)
21 from dual)a );
22 dbms_output.put_line(myval);
23* end;
ORACLE>/
from THE (select cast (ltable as mytable)
*
ERROR at line 20:
ORA-06550: line 20, column 25:
PLS-00382: expression is of wrong type
ORA-06550: line 15, column 1:
PL/SQL: SQL Statement ignored
--------
Oracle documentation is here: http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to oracledba-[Email Address Removed] subscribe: send a blank email to oracledba-[Email Address Removed] the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these terms:http://www.lazydba.com/legal.html
---------------------------------
Yahoo! Plus - For a better Internet experience
Oracle LazyDBA home page