How can I use construction ( select * bulk collect into ...) with ODAC ???
Posted: Tue 13 Mar 2007 12:25
There is a construction ( select * bulk collect into ...) in Oracle PL/SQL
and I can use it with ODAC like this....
Component TORASQL,
ORASQL.sql.text
begin
select deptno, dname, loc bulk collect
into :Nom, :NameA1, :NameA2
from dept
WHERE RowNum <= 10 ORDER BY DeptNo;
end;
Parameters
:Nom Integer IN/OUT PL/SQL Table Length=10
:NameA1 String IN/OUT Size=20 PL/SQL Table Length=10
:NameA2 String IN/OUT Size=20 PL/SQL Table Length=10
and it's all right and after ORASQL.Execute;
I can get result by example in
ORASQL.ParamByName('Nom').ItemAsInteger;
ORASQL.ParamByName('NameA1').ItemAsString;
ORASQL.ParamByName('NameA2').ItemAsString;
But, if I want use one complex variable instead of three simple as above,
I meet with failure, forexample ...
previously I have create a type
create or replace type dept2_ot as object (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13))
and then previously I have create another type
create or replace type dept_nt is table of dept_ot
What ORASQL.sql.text have I to write using construction (select * bulk collect into...)
and what Parametr have I to define???
Something like ....
begin
select * bulk collect
into :NameB
from dept
WHERE RowNum <= 10 ORDER BY DeptNo;
end;
Parameter :NameB IN/OUT DataType Object IN/OUT
or something like ....
declare
dept_o_tab dept_nt:=dept_nt();
begin
select dept_ot (deptno, dname, loc)
bulk collect into dept_o_tab from dept ;
end;
or may be bu means of procedure
create or replace procedure deptout(dept_tab IN out dept_nt) is
begin
select dept_ot(deptno, dname, loc)
bulk collect into dept_tab from dept;
end;
and ORASQL.sql.text like...
begin
deptout(:NameB);
end;
and I can use it with ODAC like this....
Component TORASQL,
ORASQL.sql.text
begin
select deptno, dname, loc bulk collect
into :Nom, :NameA1, :NameA2
from dept
WHERE RowNum <= 10 ORDER BY DeptNo;
end;
Parameters
:Nom Integer IN/OUT PL/SQL Table Length=10
:NameA1 String IN/OUT Size=20 PL/SQL Table Length=10
:NameA2 String IN/OUT Size=20 PL/SQL Table Length=10
and it's all right and after ORASQL.Execute;
I can get result by example in
ORASQL.ParamByName('Nom').ItemAsInteger;
ORASQL.ParamByName('NameA1').ItemAsString;
ORASQL.ParamByName('NameA2').ItemAsString;
But, if I want use one complex variable instead of three simple as above,
I meet with failure, forexample ...
previously I have create a type
create or replace type dept2_ot as object (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13))
and then previously I have create another type
create or replace type dept_nt is table of dept_ot
What ORASQL.sql.text have I to write using construction (select * bulk collect into...)
and what Parametr have I to define???
Something like ....
begin
select * bulk collect
into :NameB
from dept
WHERE RowNum <= 10 ORDER BY DeptNo;
end;
Parameter :NameB IN/OUT DataType Object IN/OUT
or something like ....
declare
dept_o_tab dept_nt:=dept_nt();
begin
select dept_ot (deptno, dname, loc)
bulk collect into dept_o_tab from dept ;
end;
or may be bu means of procedure
create or replace procedure deptout(dept_tab IN out dept_nt) is
begin
select dept_ot(deptno, dname, loc)
bulk collect into dept_tab from dept;
end;
and ORASQL.sql.text like...
begin
deptout(:NameB);
end;