Home > Backend Development > PHP Tutorial > Introduction to Oracle 8 functions_PHP tutorial

Introduction to Oracle 8 functions_PHP tutorial

WBOY
Release: 2016-07-13 17:02:24
Original
905 people have browsed it

These functions allow you to access Oracle8 and Oracle7 databases. It uses Oracle8's Point-of-Service Interface (OCI8). To use this extension module, you need the Oracle8 client library.
This extension module is more streamlined than the standard Oracle module. It supports global and native PHP variables for Oracle site identifiers. Has full LOB, file and ROWID support, allowing the use of user-defined variables.
Before using this extension, make sure you have correctly installed the Oracle environment variables required for the oracle user, the same as those for the daemon user . The variables that need to be set are roughly as follows:
ORACLE_HOME
ORACLE_SID
LD_PRELOAD
LD_LIBRARY_PATH
NLS_LANG
ORA_NLS33
After setting the environment variables of your web server user , confirm that the web server user (nobody, www) is added to your oracle group.
Example 1.
// Author sergo@bacup.ru
// Using parameters Configuration: OCI_DEFAULT Execute command to delay execution
OCIExecute($stmt, OCI_DEFAULT);
// Get data:
$result = OCIResult($stmt, $n);
if (is_object ($ result)) $result = $result->load();
// Perform insert or update operations:
$sql = "insert into table (field1, field2) values ​​(field1 = 'value',
field2 = empty_clob()) returning field2 into :field2";
OCIParse($conn, $sql);
$clob = OCINewDescriptor($conn, OCI_D_LOB);
OCIBindByName ($stmt, " :field2", &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$clob->save ("some text");
?>
You can store program command lines in the same simple way.
Example 2. For storing processes (programs)
// Author webmaster@remoterealty.com
$sth = OCIParse ( $dbh, "begin sp_newaddress( :address_id, '$firstname',
'$lastname', '$company', '$address1', '$address2', '$city', '$state',
'$postalcode', '$country', :error_code );end;" );
// This call is used to store the process sp_newaddress, using :address_id to start a
// in/out variable and: error_code is used for output variables.
// Bundling is implemented like this:
OCIBindByName ( $sth, ":address_id", $addr_id, 10 );
OCIBindByName ( $sth, ":error_code", $errorcode, 10 );

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631045.htmlTechArticleThese functions allow you to access Oracle8 and Oracle7 databases. It uses Oracle8's point-in-time interface (OCI8). Use this For extension modules, you need Oracle8 client library files. This extension module...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template