pass array to stored procedure

Questions, tips and tricks and techniques for scripting in Servoy

pass array to stored procedure

Postby Hans Nieuwenhuis » Mon Jun 28, 2010 7:47 pm

Hi,

I want to pass an array of primary keys to an Oracle stored procedure.

The Sample procedure is as follows
Code: Select all
create or replace procedure get_arr (arr in report_varray)
is
   outfile utl_file.file_type;
   outline number;
begin
   outfile := utl_file.fopen('IBIS2BIS','outputhn.txt','W',32767);
   utl_file.put_line(outfile,'gestart');
   for i in 1..arr.count loop
        outline:=arr(i);
      utl_file.put_line(outfile,outline);
   end loop;
     utl_file.fclose(outfile);
end;
/


the report_varray type is created by :
Code: Select all
create or replace type report_varray is varray(1000) of number;



this works fine when i start the procedure in Oracle

Code: Select all
sql> execute get_arr(report_varray(1,2,3,7,8,9,10,11,12,13,14,15));
\


but how do I call this procedure from within a method using an array of pk's as parameter ?

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: pass array to stored procedure

Postby rgansevles » Tue Jun 29, 2010 9:41 pm

Hans,

Doesn't plugins.rawSQL.executeStoredProcedure() with lots of questionmarks do the trick?

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1929
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL


Return to Methods

Who is online

Users browsing this forum: No registered users and 7 guests

cron