You Asked
Hello Sir,
I want to pass a Sqltype table of records to Java.
1)How to do populate values for such a record in plsql.
say from a select statement.
2) How to insert values in a table from such a table of records
3) How will java interpret that.
I see some examples on your site about passing a scalar sqltype like table of numbers or
table of varchar But no example on passing table of records to Java.
Can u pls give one
and we said...
I've never done a collection of objects in java -- and I won't be :)
I would use result sets -- period. Least amount of code on all parts. Consider:
create or replace type myScalarType as object
( x int,
y varchar2(20),
z date
)
/
create or replace type myTableType as table of myScalarType
/
create or replace function non_pipelined( p_like in varchar2 )
return myTableType
as
l_data myTableType;
begin
select myScalarType( user_id, username, created )
BULK COLLECT into l_data
from all_users
where username like p_like;
return l_data;
end;
/
create or replace function is_pipelined( p_like in varchar2 )
return myTableType
pipelined
as
begin
for x in ( select myScalarType( user_id, username, created ) y
from all_users
where username like p_like )
loop
pipe row(x.y);
end loop;
return;
end;
/
select * from TABLE( non_pipelined( '%A%' ) );
select * from TABLE( is_pipelined( '%A%' ) );
Just will just run the QUERY to run the procedure and a ResultSet to manipulate the
output.