Reply to Re: oracle function returning sys_refcursor

Your name:

Reply:


Posted by Colin McKinnon on 11/22/05 00:32

naph wrote:

> Hi, I've had this problem, and managed to solve it now (i don't know
> how well yet, but it works) so i thought i'd post the solution because
> i couldn't find it anywhere.
>
> The problem I was having was we have lots of functions that return
> sys_refcursor's that we use as recordsets through ADO with a windows
> application, but then we needed to call these same functions from PHP,
> so the solution was to use cursors, like so...
>
> <?
>
> $cnn = OCILogon( 'User', Password', 'TNS' );
> $cur = OCINewCursor( $cnn );
> $stmt = OCIParse( $cnn, " begin :MyRefCur := MyFunction( 1, 2, 3 );
> end; " );
>
> OCIBindByName( $stmt, ":MyRefCur", $cur, -1, OCI_B_CURSOR );
> OCIExecute( $stmt );
> OCIExecute( $cur );
>
> while ( OCIFetchInto($cur,$row,OCI_ASSOC) )
> foreach ( $row as $name => $value )
> echo "$name = '$value'<br />";
>
> OCIFreeStatement( $stmt );
> OCIFreeCursor( $cur );
> OCILogoff( $cnn );
>
> ?>
>
> Maybe someone else has a better solution?

I'm constantly amazed how Oracle manages to infest everything it touches.
SQL, C, PHP, it just gets sooooo complicated and unreadable.

There are lots of database abstraction layers for PHP, good ones include dbx
and adodb.

C.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация