|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-09 20:13 UTC] atila at nutroeste dot com dot br
Description:
------------
Dears,
The function is OciFetchStatement.
Since I have more than 2 times the same problem, and the task to resolve this was to hard. I have to report that every time I use a complex sql using operator union or union all, the return message is
Notice: Undefined offset: 0 in /usr/local/apache/html/pedidos/teste_union.php on line 19
numero de linhas:
As you can see the "Undefined offset: 0" means that there is no record to be retrived from a query, but if I run this same query using my database tool, a result could be seen.
To resolve this I had to create temporary tables to insert the
data into it's own structure using my sql union/union all query to became only one table and force the OciFetchStatement to retrive the results I wanted.
My database is Oracle 10.2.04 running on Linux rhel 5.2 64bits.
My php version is source 5.2.9 running in the same host.
Thanks an advance
Atila Santos
mail: atila@nutroeste.com.br
Country Brazil
State Goias, city: Goiania
+5562-30962539/2500
System Analist/Dba Oracle/Web Developer
Reproduce code:
---------------
Notice: Undefined offset: 0 in /usr/local/apache/html/pedidos/teste_union.php on line 19
Expected result:
----------------
The result should bring me up values of rows.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 19:00:02 2025 UTC |
<?php ini_set('display_errors', true); //database login $con=OCILogon("xxx","xxx","logix"); //oci param 1 $num=1579; //oci param 2 $serie=1; //(v_comissao is a complex view and uses union all between two // similiar data structures and also takes over 12/13 secs to be //proccessed) // What you can do is create a union sql between 2 structures and //apply it into "$sentenca", variable, with or without params. $sentenca="select v.*,i.den_item from v_comissao v,item i where v.cod_item=i.cod_item and v.num_nff =:num and v.serie=:ser"; $sel = OCIParse($con, $sentenca); OciBindByName($sel,":num",$num); OciBindByName($sel,":ser",$serie); OCIExecute($sel); OciFetchStatement($sel,$resultado); //return $resultado; echo 'rows number:'.count($resultado["DEN_ITEM"][0]); ?> Sorry if I wasn't clear enough,and if you want I could give you accesses do my server by Terminal Server, to see the real sql. please be comfortable to contact me by e-mail, and anything to help you to resolve this please!!! ask me. Because my transactional system has been passed by a lot o changes and I had to create a lot of union's between what I had and the customizations I have now. Thanks a Lot for your attention Atila Santos