Print Thread
Multiple Column PL/SQL Tables as Parameters
#59 09/16/99 09:14 PM
Joined: Sep 1999
Posts: 2
Lisbon,Portugal
P
Member
OP Offline
Member
P
Joined: Sep 1999
Posts: 2
Lisbon,Portugal
Is it possible to use pl/sql procedures or functions using multiple column pl/sql tables as parameters with different data-types ?

example: pl/sql table with empno,hire_date and salary

Re: Multiple Column PL/SQL Tables as Parameters
#60 09/18/99 06:30 PM
Joined: Aug 1999
Posts: 22,214
Member
Offline
Member
Joined: Aug 1999
Posts: 22,214
No, this is not possible. Only PL/SQL Tables of scalar data types are supported. The only way to call such a stored procedure is by converting between several PL/SQL Tables of a scalar data type and a single PL/SQL Table of a record data type in a PL/SQL Block. This PL/SQL Block now only uses bind variables with PL/SQL Tables that can be used by Direct Oracle Access.

If we have a procedure Upd in package Employee that takes a PL/SQL Table of emp%rowtype records (defined by the t_emptable type in this package), then the PL/SQL Block would look something like this:

[quote]
Code
declare
  emptable employee.t_emptable;
  i binary_integer := 1;
begin
  loop
    emptable(i).empno := :empno(i);
    emptable(i).hiredate := :hiredate(i);
    emptable(i).sal := :sal(i);
    i := i + 1;
  end loop;
exception
  when no_data_found then Employee.Upd(emptable);
end;
[/quote]

This code loops through the 3 scalar PL/SQL Tables and copies the values to the PL/SQL table of records, until we get a no_data_found exception. At this point we have reached the end of the table, and we can call Employee.Upd with the PL/SQL Table of records as parameter.

We can't use PL/SQL Table functions like First, Next, Count, and so on, because these functions cannot operate on bind variables. That


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.032s Queries: 14 (0.007s) Memory: 2.4977 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-05-09 21:08:58 UTC
Valid HTML 5 and Valid CSS