I am trying to use the ocicollection functions. Initially everything
works fine, but after reloading the page for the second time
I get the following error:
OCITypeByName: OCI-22303: type "SISTRUT"."MENSERRO" not found
When I try half a minute later, I do manage reload the page without any
error. I'm using php-4.2.2 on solaris 2.6 as a module of apache_1.3.26.
The php-code I used for this test follows:
<?
$conn = OCILogon("scott","tiger","db");
$sql = "BEGIN :SAIDA := SISTRUT.PK_UF.SEL(:CURSOR,:COD_UF); END;";
$stmt = OCIParse($conn, $sql);
OCIBindByName($stmt,':COD_UF',&$cod_uf,32);
$saidacoll = OCINewCollection($conn,"MENSERRO","SISTRUT");
OCIBindByName($stmt,':SAIDA',&$saidacoll,-1,OCI_B_SQLT_NTY);
$curs = OCINewCursor($conn);
OCIBindByName($stmt,":CURSOR",$curs,-1,OCI_B_CURSOR);
OCIExecute($stmt);
$nmenserro = ocicollsize($saidacoll);
for ($i = 0; $i < $nmenserro; $i++)
$saida[]= $ocicollgetelem($saidacoll,$i);
ocifreecollection($saidacol);
if ( !$nmenserro ) {
OCIExecute($curs);
while (OCIFetchinto($curs,$r,OCI_ASSOC+OCI_RETURN_NULLS)) {
foreach ( $r as $k=>$v )
print "$v ";
print "<br>\n";
}
}
ocifreecursor($curs);
?>
the PL/SQL code for the function:
create or replace type menserro is varray(20) of varchar2(100);
function sel(p_cursor out ufcurtyp, p_cod_uf in uf.cod_uf%type
) return menserro is
v_sql varchar2(200);
v_menserro menserro := menserro();
begin
v_sql := 'select * from uf';
if p_cod_uf is not null then
v_sql := v_sql || ' where cod_uf='''|| p_cod_uf || '''';
end if;
v_sql := v_sql || ' order by nom_uf';
open p_cursor for v_sql;
return null;
exception
when others then
begin
v_menserro.extend;
v_menserro(v_menserro.count) := 'Erro na execu��o do select';
return v_menserro;
end;
end sel;
--------------------------------------------------------------------
Andries Algera
CSR - IBAMA
SAIN L4, Lote 4, Ed. IBAMA Sede
70800.200 Brasilia / DF
BRASIL
ph: +5561 316-1326
316-1453
fax:+5561 223-7108
--------------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php