Print Thread
Record Types?
#6301 04/15/04 10:45 PM
Joined: Jan 2004
Posts: 7
C
Member
OP Offline
Member
C
Joined: Jan 2004
Posts: 7
Hi,

I have some overloading problems. A possible solution could be RECORD TYPES, but does DOA support record types as parameters to call stored procedures?

I will give an example what will describe the problem.

-- ---------------------------
-- PLSQL
-- ---------------------------
Procedure Lock_record(Code Tab1.Code%type); -- number
Procedure Lock_Record(ID Tab2.ID%Type); -- number

// Delphi
with query do
begin
close;
sql.clear;
sql.add('begin');
sql.add(' package1.Lock_Record(1);');
sql.add('end;')
execute;
end;

When I try to execute this, the server has no idea which procedure "Lock_record" it has to take. Because both have the same dataType (number).

So my plan was to provide a recordType as parameter, but then it is not possible to give it in as a variable.
Procedure Lock_record(rowtab1 Tab1%rowtype);
Procedure Lock_Record(rowtab2 Tab2%RowType);

It is also handy if you can give a complete record as a parameter when you have to insert or update rows in a table.

Also making use of PLSSQL Records (from the package wizard) isn't a real suitable solution.

Does anyone know what could be the solution for this overloading problem.

Re: Record Types?
#6302 04/16/04 07:42 PM
Joined: Aug 1999
Posts: 22,218
Member
Offline
Member
Joined: Aug 1999
Posts: 22,218
If the data type of the parameters do not uniquely identify the overloading, you can supply the parameter names:
Code
// Delphi
with query do
begin
   close;
   sql.clear;
   sql.add('begin');
   sql.add('  package1.Lock_Record(Code => 1);');
   sql.add('end;')
   execute;
end;
or
Code
// Delphi
with query do
begin
   close;
   sql.clear;
   sql.add('begin');
   sql.add('  package1.Lock_Record(ID => 1);');
   sql.add('end;')
   execute;
end;


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.022s Queries: 13 (0.006s) Memory: 2.5046 MB (Peak: 3.0458 MB) Data Comp: Off Server Time: 2024-05-15 04:51:12 UTC
Valid HTML 5 and Valid CSS