[Zope] Oracle access from Zope

Németh Miklós nemeth@iqsoft.hu
Tue, 09 Nov 1999 10:06:50 +0100


Thank you very much but I'd need more clarifications.

Arpad Kiss wrote:

> Hi,
> Today I have time playing around with DCOracle and it seems to me the
> array-argumented PL/SQL procedures are not supported(as you have written).
> But I can call a procedure that has a PL/SQL table argument. Here is my
> silly sample:
> First I created a package:
>
> create PACKAGE TestPackage as
>     TYPE tt_type IS TABLE OF LONG INDEX BY BINARY_INTEGER;
>     procedure join( par tt_type, ub BINARY_INTEGER);
> end TestPackage;
>
> create PACKAGE body TestPackage as
>     procedure join( par tt_type, ub BINARY_INTEGER) is
>          msg LONG;
>          i BINARY_INTEGER;
>     begin
>           msg:='';
>           for i in 1..ub loop
>             msg:=msg||par(i);
>           end loop;
>           Raise_application_error (-20053, msg);
>     end;
> end TestPackage;
>
> As you can see this join procedure raises an application error with the
> joined elements of the array.

The size of the msg passed to  Raise_application_error are limited, so it
cannot be used as a real data returning (if this was your intention in this
example) mechanism.

>
>
> In Zope I just create a SQL Method with this query template(in Python I
> simple call the execute method of a cursor with this):
>
> begin
>     declare
>         b TestPackage.tt_type;
>         n BINARY_INTEGER:=3;
>     begin
>         b(1):='alma:';
>         b(2):='b';
>         b(3):='c';
>         TestPackage.join(b,n);
>      end;
> end;
>
> It is not too elegant, but maybe it helps you,

Not bad, I like the idea!
Still, there is another problem: what about OUT (or IN/OUT) parameters? Here is
a more simple example:
"""begin
  dbms_output.enable;
  dbms_output.put_line('Kiss');
  dbms_output.put_line('Arpad');
  dbms_output.get_lines(:lines,:numlines);
end;"""
I know that there is a dbms_output.get_line, but let us suppose that you have
only get_lines. Shall I create wrapper PL/SQL procedures around procedures
returning arrays? Do you have any idea how to circumvent this problem?

NM