There is a construction select * bulk collect into ... in Oracle PL/SQL
and I can use it with DOA like this...
Component TOracleQuery
OracleQuery.SQL
Variables
and then I can put results in Memo,
for example....
But, if I want use one complex variable (record or table of record) instead of three simple as above,
I meet with failure, forexample ...
previously I have created a type
and then previously I have create another type
create or replace type dept_nt is table of dept_ot
What OracleQuery.SQL have I to write using construction select * bulk collect into...
and what Variable have I to define and connect with created type :NameB with dept2_ot ???
Something like ....
I try to use Package Wizard, but with out success.
Or may be create type like
then define array as
but how to connect it with Variable :NameB in OracleQuery.SQL ???
and I can use it with DOA like this...
Component TOracleQuery
OracleQuery.SQL
Code:
begin
select deptno, dname, loc bulk collect
into :Nom, :NameA1, :NameA2
from dept3
WHERE RowNum <= 10 ORDER BY DeptNo;
end;
Code:
:NOM Integer PL/SQL Table Table Size 25
:NameA1 String PL/SQL Table Table Size 25 String Size 40
:NameA2 String PL/SQL Table Table Size 25 String Size 40
var
k : integer;
DeptNoTable : Array of variant;
DeptNameTable : Array of variant;
DeptLocTable : Array of variant;
begin
with OracleQuery do
begin
Execute;
DeptNoTable:= GetVariable('Nom');
DeptNameTable:= GetVariable('NameA1');
DeptLocTable:= GetVariable('NameA2');
end;
for example....
Code:
for k:=VarArrayLowBound(DeptNoTable,1) to VarArrayHighBound(DeptNoTable,1) do
begin
Memo.Lines.Add(IntToStr(DeptNoTable[k])+' '+DeptNameTable[k]+' '+DeptLocTable[k]);
end;
end;
I meet with failure, forexample ...
previously I have created a type
Code:
create or replace type dept2_ot as object (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13))
create or replace type dept_nt is table of dept_ot
What OracleQuery.SQL have I to write using construction select * bulk collect into...
and what Variable have I to define and connect with created type :NameB with dept2_ot ???
Something like ....
Code:
begin
select * bulk collect
into :NameB
from dept
WHERE RowNum <= 10 ORDER BY DeptNo;
end;
Variable :NameB IN/OUT DataType Object or PL/SQL string
Or may be create type like
Code:
type
dept_t = record
deptno: integer;
dname : string;
loc : string;
end;
Code:
dept_arr: array[1..20] of dept_t;