Oracle 8 function introduction _ PHP Tutorial

Source: Internet
Author: User
Introduces Oracle8 functions. These functions allow you to access Oracle8 and Oracle7 databases. it uses the Oracle8 vertex interface (OCI8 ). to use this extension module, you need the Oracle8 client library file. this extension module allows you to access Oracle8 and Oracle7 databases. it uses the Oracle8 vertex 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.
// 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)
// 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 );

Oracle8 and Oracle7 databases. it uses the Oracle 8 point interface (OCI8). to use this extension module, you need the Oracle8 client library file. this extension module...

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.