Problems with oracle + stored procedures

wxdqz

New Member
Colleagues, I have following stored procedure in my data base oracle 8i and when I try to
execute I
do not obtain successfully it: I followed the example that you postou in <!-- w --><a class="postlink" href="http://www.php.net">www.php.net</a><!-- w -->, but
still did
not obtain to make with that stored procedure executes perfectly. It could give one looked
at in code
and to inform me as I must execute this stored procedure in php, since I tested it in delphi
and the
same one functions perfectly.

CREATE OR REPLACE PROCEDURE
"DIADO"."SP_GET_NCOD_USUARIOS"(ncod out number)
as
begin
declare
cont number;
aux number;
cursor usuario is SELECT ID_USUARIO FROM USUARIOS ORDER BY
ID_USUARIO ASC;
begin
cont := 0;
DBMS_OUTPUT.ENABLE;
open usuario;
loop
cont := cont + 1;
fetch usuario into aux;
if (usuario %notfound) or (aux > cont) then
exit;
end if;
end loop;
ncod := cont;
close usuario;
end;
end;

I try execute with:

<?php
putenv("ORACLE_SID=GEDUFU");
putenv("ORACLE_HOME=/oracle/app/oracle/product/8.1.7");
$HANDLE = OCILogon("aei","aeiou","xxxxxx.xxx.xx");
$sth = OCIParse($HANDLE, "BEGIN SP_GET_NCOD_USUARIOS END;");
OCIBindByName ($sth, ":ncod", $ncod, 38);
OCIExecute($sth);
echo $ncod;
?>


Warning: OCIBindByName: ORA-01036: illegal variable name/number in
/home/httpd/xxx/teste.php on line 6

Warning: OCIStmtExecute: ORA-06550: line 1, column 28: PLS-00103: Encountered the
symbol "END" when
expecting one of the following: := . ( @ % ; The symbol ";" was substituted for "END" to
continue. in /home/httpd/xxx/teste.php on line 7

Tank you.

Sebasti鉶 Carlos Santos
Uberl鈔dia - Minas Gerais - Brasil
 
Back
Top