These functions allow you to access the Oracle8 and Oracle7 databases. They use the Oracle8 point-of-use interface (OCI8). To use this extension module, you need the Oracle8 client library file.
This expansion module is smoother than the standard Oracle module. It supports global and local PHP variables used for Oracle site symbols. Complete LOB, file, and ROWID support are available, allowing you to use user-defined variables.
Before using this extension, make sure that you have correctly installed the oracle environment variables required by Oracle users, which are the same as those for daemon users. The variables to be set are roughly as follows:
ORACLE_HOME
ORACLE_SID
LD_PRELOAD
LD_LIBRARY_PATH
NLS_LANG
ORA_NLS33
After setting the environment variable of your web Server user, confirm that the web server user (nobody, www) is added to your oracle Group ).
Example 1.
<? Php
// Author sergo@bacup.ru
// Use parameter configuration: OCI_DEFAULT to execute the command to delay execution
OCIExecute ($ stmt, OCI_DEFAULT );
// Obtain the data:
$ Result = OCIResult ($ stmt, $ n );
If (is_object ($ result) $ result = $ result-> load ();
// Insert or update:
$ 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 use the same simple method to store program command lines.
Example 2: stored process (program)
<? Php
// Author webmaster@remoterealty.com
$ Something = 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 sp_newaddress process. Use: address_id to start
// In/out variables and: error_code are used to output variables.
// Implement bundling as follows:
OCIBindByName ($ something, ": address_id", $ addr_id, 10 );
OCIBindByName ($ something, ": error_code", $ errorcode, 10 );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.