[Zope-DB] ZOracleDA and Stored Procedure -- bug, no such feature or my fault?

Bo M. Maryniuck b.maryniuk@forbis.lt
Thu, 7 Nov 2002 18:46:06 +0200


Hi.

I have a Stored Procedure and Zope shows me it like this:

function PM.PM_02.CLOB_PRINT returns OUT BOOLEAN, has arguments:
         P_TABLE IN VARCHAR2
         P_ID IN NUMBER
         P_BUFFER IN OUT VARCHAR2
         P_AMOUNT IN OUT NUMBER
         P_POS IN NUMBER

According to the PL/SQL it should work in this way: return=20
EOF into LL_NOTENT and a body of the CLOB into the buffer:

 ln_amount:=3D4000;
 ln_pos:=3D1;
 result:=3D'';
 LOOP
   ll_notend:=3DPM.PM_02.CLOB_PRINT('PM_REQUEST_ATTACHEMENTS',p_att_id,bu=
ffer,
              ln_amount,
              ln_pos);
   result=3Dresult||buffer
   ln_pos:=3Dln_pos+ln_amount;            =20
  IF NOT ll_notend THEN EXIT; END IF;
 END LOOP;

Well. Now I try to store the result of _procedure_ into some buffer
with the Zope/PythonScript, like:

buffer =3D ''
# clobPrint -- is ID of StoredProcedure in ZODB
(answer,buffer,amount) =3D container.clobPrint(P_TABLE =3D'PM_REQUEST_ATT=
ACHEMENTS',
                                             P_ID =3D 294,
                                             P_AMOUNT =3D 200,
                                             P_POS =3D 1,
                                             P_BUFFER =3D buffer)
return buffer

This causes:
File /opt/zope/lib/python/ZODB/Transaction.py, line 107, in abort
  File /opt/zope/lib/python/Shared/DC/ZRDB/TM.py, line 60, in abort
    (Object: clobPrint)
  File /opt/zope/lib/python/Products/DCOracle2/SP.py, line 154, in _abort
    (Object: clobPrint)
AttributeError: _v_db

O.K., then DCOracle2 documentation sais, that I should not define OUT par=
ameter.
Then Oracle causes "Not enough arguments". Now what shell I do?=20
Is DCOracle2 Stored Procedure can not return more than one result? Or I d=
o something
wrong?

--=20
Regards, Bogdan

You have moved the mouse. NT must be restarted for the changes to take ef=
fect.