[Zope] Passing parameters for Oracle Stored Procedures

Ricardo Seghizzi ricardo@cnbe.mar.org.uk
Thu, 2 Aug 2001 13:01:55 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_010C_01C11B53.4E79B880
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi,

I have created a package with a procedure name test_2
that has a OUT parameter type number.

see code below...

PACKAGE test_pkg IS
  FUNCTION conta_reg RETURN NUMBER;
  PRAGMA restrict_references(conta_reg,wnds,wnps,rnps);
 =20
  PROCEDURE  test_2(tot OUT NUMBER);=20
END;




PACKAGE BODY TEST_PKG IS
  FUNCTION conta_reg RETURN NUMBER
  IS=20
    total NUMBER;
  BEGIN
   SELECT COUNT(*) INTO total FROM ASSUNTOS;
   RETURN total;
  END;
 =20
  PROCEDURE  test_2(tot OUT NUMBER) IS
  total NUMBER;
  BEGIN
   SELECT COUNT(*) INTO total FROM ASSUNTOS;
   tot:=3D total;
END;


I have tried to call the test_2 procedure using this anonimous block:

begin
TEST_PKG.test_2(:outvar);
end;


and I received the following error:

Error, dco2.DatabaseError: (1008, 'ORA-01008: not all variables bound')=20


Does anybody knows what is wrong?


Regards

Ricardo




------=_NextPart_000_010C_01C11B53.4E79B880
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have created a package with a =
procedure name=20
test_2</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>that has a OUT parameter type =
number.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>see code below...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PACKAGE test_pkg IS<BR>&nbsp; FUNCTION =
conta_reg=20
RETURN NUMBER;<BR>&nbsp; PRAGMA=20
restrict_references(conta_reg,wnds,wnps,rnps);<BR>&nbsp; <BR>&nbsp;=20
PROCEDURE&nbsp; test_2(tot OUT NUMBER);&nbsp;<BR>END;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PACKAGE BODY TEST_PKG IS<BR>&nbsp; =
FUNCTION=20
conta_reg RETURN NUMBER<BR>&nbsp; IS <BR>&nbsp;&nbsp;&nbsp; total=20
NUMBER;<BR>&nbsp; BEGIN<BR>&nbsp; &nbsp;SELECT COUNT(*) INTO total FROM=20
ASSUNTOS;<BR>&nbsp; &nbsp;RETURN total;<BR>&nbsp; END;<BR>&nbsp; =
<BR>&nbsp;=20
PROCEDURE&nbsp; test_2(tot OUT NUMBER) IS<BR>&nbsp; total =
NUMBER;<BR>&nbsp;=20
BEGIN<BR>&nbsp; &nbsp;SELECT COUNT(*) INTO total FROM =
ASSUNTOS;<BR>&nbsp;=20
&nbsp;tot:=3D total;<BR>END;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have tried to call the test_2 =
procedure using=20
this anonimous block:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>begin<BR>TEST_PKG.test_2(:outvar);<BR>end;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and I received the following =
error:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>Error,=20
<EM>dco2.DatabaseError</EM>:</STRONG> (1008, 'ORA-01008: not all =
variables=20
bound') </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Does anybody knows what is =
wrong?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Ricardo</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_010C_01C11B53.4E79B880--