overloading problems

I am new to DOA and I have some overlaoding problems.
I wrote some overloaded stored procedures on the oracle server. The datatypes are ref cursors based on a record. So for pl/sql it are different types. But when I try to call those procedures I have to declare the variables. To achieve this I declared a OracleQuery with a variable p_cursor: otCursor. When i try to execute one of those procedures I get errors because DOA doesn't know which procedure it has it take. probably there is a simple solution, here is some code.

-- first the pl/sql
Type rec_emp_type is record
(emp_type_code emp_type.emp_type_Code%type,
description emp_type.Description%type);
Type rc_emp_type is ref cursor return Rec_EMP_type;

Type rec_unit_type is record
(unit_code unit_type.unit_code%type,
description unit_type.Description%type);
Type rc_Unit_type is ref cursor return Rec_Unit_Type;

procedure selectRecords(p_cursor IN OUT rc_emp_Type, p_order varchar2);

procedure selectRecords(p_cursor IN OUT rc_unit_Type, p_order varchar2);
------------------------------------------------
// here is delphi code
with query do
begin
clear;
sql.add(' begin ');
sql.add(' pck100.selectRecords(:p_cursor, :p_order)');
sql.add(' end; ');
declarevariable('p_cursor', otcursor);
declarevariable('p_order', otstring);
setcomplexvariable('p_cursor',cursorquery);
setvariable('p_order', p_order);
execute;
with cursorquery do
begin
execute
-- do something with the data
end;
end;

So the question is, how can the server know which procedure it has to call or how can the server know that p_cursor = rc_emp_type or p_cursor = rc_unit_type?

Thanks chris
 
This should probably work (haven't tested it much):
Code:
sql.add(' declare ');
   sql.add('    l_cursor rc_emp_type; ');
   sql.add(' begin ');
   sql.add('    pck100.selectRecords(l_cursor, :p_order)');
   sql.add('    :p_cursor := l_cursor; ');
   sql.add(' end; ');
By using a typed local cursor variable, the call is unambiguous. After the call, you assign the local cursor variable to the untyped cursor bind variable.
 
Back
Top