Oracle 8 database function library

Source: Internet
Author: User
Tags oracle cursor
Welcome to the Oracle community forum, and interact with 2 million technical staff to enter because this library is called Oracle8Call-Interface (OCI8) to access the Oracle database, so in the Web server where Oracle8Client is installed, use this function to store Oracle7.x or 8. database servers of Version x. OCIDefi

Welcome to the Oracle community forum and interact with 2 million technical staff> because this function library calls Oracle8 Call-Interface (OCI8) to access the Oracle database, therefore, on the Web server where Oracle 8 Client is installed, you can use this function to store database servers of Oracle 7.x or 8.x. OCIDefi

Welcome to the Oracle community forum and interact with 2 million technical staff> enter

Since the library calls Oracle8 Call-Interface (OCI8) to access the Oracle database, on the Web server where the Oracle 8 Client is installed, you can use this function to store database servers of Oracle 7.x or 8.x.


OCIDefineByName: Allow the SELECT command to use PHP variables.
OCIBindByName: Allows dynamic SQL to use PHP variables.
OCILogon: Enable the connection to Oracle.
OCILogOff: Close the connection to Oracle.
OCIExecute: Command section for executing Oracle.
OCICommit: Put Oracle transaction processing into practice.
OCIRollback: Cancel the current transaction.
OCINumRows: Obtain the number of affected columns.
OCIResult: Obtain a column from the data of the current column (row ).
OCIFetch: Returns a row ).
OCIFetchInto: Retrieve Oracle data and place it in the array.
OCIColumnIsNULL: Test whether the returned row is null.
OCIColumnSize: Obtains the size of the column type.
OCINewDescriptor: Initial new LOB/FILE description.
OCIParse: Analyze SQL syntax.

To use this function library, you must first install the Oracle database before installing PHP and Apache Server, and ensure that Oracle can operate smoothly. Add the -- with-oracle = DIR Option When configuring PHP (configure). DIR is the $ ORACLE_HOME environment variable, for example:

./configure --with-oracle=/abc/def/oracle/product/7.0.3 --with-apache=../apache_1.3.x --enable-track-vars

The following example is provided by the stevel@nettek-llc.com (22-Jan-1999. This example returns all the data in the EMP Table of the sid1 Database in Oracle. The account is SCOTT and the password is TIGER.


Putenv ("ORACLE_SID = sid1 ");
Putenv ("ORACLE_HOME =/u01/app/oracle/product/8.0.5 ");

$ Handle = ora_plogon ("SCOTT @ sid1", "TIGER") or die;
$ Cursor = ora_open ($ handle );
Ora_commitoff ($ handle );

$ Query = "SELECT * from emp ";
Ora_parse ($ cursor, $ query) or die;
Ora_exec ($ cursor );

Echo"

\n";
echo "$query\n\n";
$numcols = 0;
while(ora_fetch($cursor)) {
$numcols = ora_numcols($cursor);
for ($column=0; $column < $numcols; $column++) {
$data = trim(ora_getcolumn($cursor, $column));
if($data == "") $data = "NULL";
echo "$data\t";
}
echo "\n";
}
$numrows = ora_numrows($cursor);
echo "\nROWS RETURNED: $numrows\n";
echo "
\ N ";

Ora_close ($ cursor );

?>

Kk@shonline.de (05-Aug-1998) pointed out that ORACLE_HOME is the installation path of Oracle, ORACLE_SID is the name of the Oracle database, if you do not know these two environment variables can be verified with sqlplus connected to Oracle.

Ora_Bind: Link PHP variables to Oracle parameters.
Ora_Close: Shut down an Oracle cursor.
Ora_ColumnName: Obtain the name of the Oracle return Column (Column.
Ora_ColumnType: Returns the type of the Column returned by Oracle.
Ora_Commit: Put Oracle transaction processing into practice.
Ora_CommitOff: Disable Automatic Oracle transaction change.
Ora_CommitOn: Enable the automatic Oracle transaction change function.
Ora_Error: Obtain the Oracle error message.
Ora_ErrorCode: Obtain the Oracle error code.
Ora_Exec: Command section for executing Oracle.
Ora_Fetch: Returns a row ).
Ora_GetColumn: Obtain a column from the data in the row ).
Ora_Logoff: End the connection with Oracle.
Ora_Logon: Enable the connection to Oracle.
Ora_Open: Enable the Oracle cursor.
Ora_Parse: Analyze SQL syntax.
Ora_Rollback: Cancel the current transaction.
Ora_Do: Quick SQL query.
Ora_FetchInto: Retrieve Oracle data and place it in the array.
Ora_ColumnSize: Obtains the size of the column type.
Ora_Numcols: Obtain the number of columns.
Ora_PLogon: Enable long-term connection with Oracle.

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.