Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Chris Jones:
Using PHP and Oracle Database 12c Implicit Result Sets
Jul 26, 2013 @ 14:12:40

Chris Jones has a new post to his site showing you how to use Oracle 12c's implicit result sets in your code. Note: this functionality is still in development, so the naming/exact functionality might change.

The new Oracle Database 12c "Implicit Result Sets" (IRS) feature allows query results to be returned from a stored PL/SQL procedure (or a PL/SQL anonymous block) without requiring special PHP code. Support for IRS is available in PHP OCI8 2.0.0-devel extension when it is compiled and used with Oracle Database 12c. (OCI8 2.0 can be compiled and used with other versions of Oracle Database but the available feature set is reduced).

He shows a normal fetch loop that calls the oci_* functions and grabs each row with a oci_fetch_row call. He updates this to use an anonymous PL/SQL block (a string) instead that allows for more flexibility. He includes examples that fetch from one table, multiple tables and returns multiple result sets (that can be fetched one at a time) from the same single call.

tagged: implicit result set oracle 12c tutorial multiple single sql plsql

Link: https://blogs.oracle.com/opal/entry/using_php_oci8_2_0

EasyTech Blog:
Executing PL/SQL code in Zend Framework
Oct 29, 2008 @ 16:15:17

On the EasyTech blog, there's a recent post for Zend Framework developers out there working with the Oracle database showing how to execute PL/SQL code from your Zend_Db queries.

Calling PL/SQL code from PHP can be tricky sometimes, specially when the PL/SQL procedure has input and output parameters. In this posting I will show you how to call a procedure from the PHP using Zend Framework. I will assume you have some experience using Zend Framework, specially the Database module (Zend_db).

He walks through the creation of a simple PL/SQL stored procedure and how to prepare your query to get results out of it (Zend_Db_Statement_Oracle and an execute call). There's a few stipulations you'll need to follow - named parameters, reserving space for the output and using references for output variables.

tagged: plsql oracle tutorial zendframework stored procedure

Link:

Christopher Jones' Blog:
Casting PL/SQL arrays as REF CURSORS for Ruby (and PHP)
Dec 01, 2006 @ 16:41:00

In a new post, Christopher Jones talks about some difficulty a friend of his was having with returning a connection type from Oracle back to a script. In his case, it was a Ruby script and, unfortunately, there's no direct support for it. So, Christopher jumped in to help out.

PHP's oci8 extension oci_bind_array_by_name() can bind collections but there is no equivalent in ruby-oci8.

Justin outlines a solution on his blog Ruby: Invoking a PL/SQL Package with Array args. His example relies on some company infrastructure so I came up with this standalone example. This first SQL*Plus script sets up the scenario.

Stick with me on this one - there's some PHP right there at the end. He shows how much simpler the same kind of operation would be in PHP thanks to the oci_bind_array_by_name functionality understanding the return value. What took about 20 lines for just the Ruby code to handle the result correctly takes only five in PHP.

tagged: ruby casting plsql array refcursor oci8 extension ruby casting plsql array refcursor oci8 extension

Link:

Christopher Jones' Blog:
Casting PL/SQL arrays as REF CURSORS for Ruby (and PHP)
Dec 01, 2006 @ 16:41:00

In a new post, Christopher Jones talks about some difficulty a friend of his was having with returning a connection type from Oracle back to a script. In his case, it was a Ruby script and, unfortunately, there's no direct support for it. So, Christopher jumped in to help out.

PHP's oci8 extension oci_bind_array_by_name() can bind collections but there is no equivalent in ruby-oci8.

Justin outlines a solution on his blog Ruby: Invoking a PL/SQL Package with Array args. His example relies on some company infrastructure so I came up with this standalone example. This first SQL*Plus script sets up the scenario.

Stick with me on this one - there's some PHP right there at the end. He shows how much simpler the same kind of operation would be in PHP thanks to the oci_bind_array_by_name functionality understanding the return value. What took about 20 lines for just the Ruby code to handle the result correctly takes only five in PHP.

tagged: ruby casting plsql array refcursor oci8 extension ruby casting plsql array refcursor oci8 extension

Link:


Trending Topics: