Introduction to Oracle 8 functions

Source: Internet
Author: User
Tags command line insert log variables stmt oracle database
These functions allow you to access the Oracle8 and Oracle7 databases. He uses the Oracle8 point interface (OCI8). Using this extension module, you need to Oracle8 the client library file.

This expansion module is smoother than a standard Oracle module. He supports global and native PHP variables for Oracle stand characters. There is complete LOB, file and ROWID support, allowing the use of user-supplied defined variables.

Before using this extension, make sure that you have correctly installed Oracle environment variables that Oracle users need, as well as for daemon users. The variables you need to set are roughly the following:

Oracle_home

Oracle_sid

Ld_preload

Ld_library_path

Nls_lang

Ora_nls33


After setting the environment variables for your Web server user, confirm that you have added a Web server user (nobody, www) to your Oracle group.

Example 1.

<?php
Author sergo@bacup.ru

Using parameter configuration: Oci_default execute a command to delay execution
Ociexecute ($stmt, Oci_default);

Get the data:

$result = Ociresult ($stmt, $n);
if (Is_object ($result)) $result = $result->load ();

To insert or update an operation:

$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 the program command line in the same simple way.

Example 2. For storing processes (Programs)

<?php
Author webmaster@remoterealty.com
$sth = Ociparse ($DBH, "Begin Sp_newaddress" (: address_id, ' $firstname ',
' $lastname ', ' $company ', ' $address 1 ', ' $address 2 ', ' $city ', ' $state ',
' $postalcode ', ' $country ',: error_code); end; ");

This call is used to store process sp_newaddress, using: address_id to start a
In/out variables and: error_code for output variables.
This implements the bundle:

Ocibindbyname ($sth, ": address_id", $addr _id, 10);
Ocibindbyname ($sth, ": Error_code", $errorcode, 10);
Ociexecute ($STH);

?>


List of functions
ocidefinebyname-use PHP variables in defining steps in a SELECT procedure
ocibindbyname-bundle a PHP variable for an Oracle position character
ocilogon-to establish a connection with Oracle
ociplogon-connects an Oracle database and uses existing connections to log in, returning a new session.
ocinlogon-connects an Oracle database and uses a new connection to log in, returning a new session.
ocilogoff-Disconnect from Oracle
Ociexecute-executes a statement
Ocicommit-Submit Outstanding Transactions
Ocirollback-Fallback outstanding Transactions
ocinewdescriptor-Initializes a new empty descriptor Lob/file (LOB is the default value)
Ocirowcount-gets the number of rows returned
ocinumcols-returns the number of columns in a statement result
Ociresult-returns the number of columns returned rows
Ocifetch-gets the next line in the result buffer
Ocifetchinto-gets the next line in the result array
ocifetchstatement-all rows that return the result data in data form.
ocicolumnisnull-whether a column of test results is null or NULL
ocicolumnsize-returns the size of the result column
ociserverversion-returns a string containing server information.
ocistatementtype-returns the type of a OCI statement.
ocinewcursor-returns a new cursor (statement handle)-for bundling ref-cursors!
Ocifreestatement-frees all resources associated with a statement.
Ocifreecursor-frees all resources associated with a cursor.
ocifreedesc-Deletes a large object descriptor.
ocicolumnname-returns the name of the column.
ocicolumntype-returns the type of the column.
ociparse-resolves a query to return a statement
ocierror-returns the last Stmt|conn|global error. Returns False if no error occurs.
ociinternaldebug-turn on or off the internal debugging output. Shutdown by default

Related Article

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.