Oracle functions Oracle Ora_Bind bind a PHP variable to an Oracle parameter Description int ora_bind int cursor string PHP variable name string SQL parameter name int length int type Returns true if the bind succeeds, otherwise false. Details about the error can be retrieved using the ora_error and ora_errorcode functions. This function binds the named PHP variable with a SQL parameter. The SQL parameter must be in the form ":name". With the optional type parameter, you can define whether the SQL parameter is an in/out (0, default), in (1) or out (2) parameter. As of PHP 3.0.1, you can use the constants ORA_BIND_INOUT, ORA_BIND_IN and ORA_BIND_OUT instead of the numbers. ora_bind must be called after ora_parse and before ora_exec. Input values can be given by assignment to the bound PHP variables, after calling ora_exec the bound PHP variables contain the output values if available. <?php ora_parse($curs, "declare tmp INTEGER; begin tmp := :in; :out := tmp; :x := 7.77; end;"); ora_bind($curs, "result", ":x", $len, 2); ora_bind($curs, "input", ":in", 5, 1); ora_bind($curs, "output", ":out", 5, 2); $input = 765; ora_exec($curs); echo "Result: $result<BR>Out: $output<BR>In: $input"; ?> Ora_Close close an Oracle cursor Description int ora_close int cursor Returns true if the close succeeds, otherwise false. Details about the error can be retrieved using the ora_error and ora_errorcode functions. This function closes a data cursor opened with ora_open. Ora_ColumnName get name of Oracle result column Description string Ora_ColumnName int cursor int column Returns the name of the field/column column on the cursor cursor. The returned name is in all uppercase letters. Ora_ColumnType get type of Oracle result column Description string Ora_ColumnType int cursor int column Returns the Oracle data type name of the field/column column on the cursor cursor. The returned type will be one of the following: "VARCHAR2" "VARCHAR" "CHAR" "NUMBER" "LONG" "LONG RAW" "ROWID" "DATE" "CURSOR" Ora_Commit commit an Oracle transaction Description int ora_commit int conn Returns true on success, false on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions. This function commits an Oracle transaction. A transaction is defined as all the changes on a given connection since the last commit/rollback, autocommit was turned off or when the connection was established. Ora_CommitOff disable automatic commit Description int ora_commitoff int conn Returns true on success, false on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions. This function turns off automatic commit after each ora_exec. Ora_CommitOn enable automatic commit Description int ora_commiton int conn This function turns on automatic commit after each ora_exec on the given connection. Returns true on success, false on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions. Ora_Error get Oracle error message Description string Ora_Error int cursor_or_connection Returns an error message of the form XXX-NNNNN where XXX is where the error comes from and NNNNN identifies the error message. Support for connection ids was added in 3.0.4. On UNIX versions of Oracle, you can find details about an error message like this: $ oerr ora 00001 00001, 00000, "unique constraint (%s.%s) violated" // *Cause: An update or insert statement attempted to insert a duplicate key // For Trusted ORACLE configured in DBMS MAC mode, you may see // this message if a duplicate entry exists at a different level. // *Action: Either remove the unique restriction or do not insert the key Ora_ErrorCode get Oracle error code Description int Ora_ErrorCode int cursor_or_connection Returns the numeric error code of the last executed statement on the specified cursor or connection. FIXME: should possible values be listed? Support for connection ids was added in 3.0.4. Ora_Exec execute parsed statement on an Oracle cursor Description int ora_exec int cursor Returns true on success, false on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions. Ora_Fetch fetch a row of data from a cursor Description int ora_fetch int cursor Returns true (a row was fetched) or false (no more rows, or an error occured). If an error occured, details can be retrieved using the ora_error and ora_errorcode functions. If there was no error, ora_errorcode will return 0. Retrieves a row of data from the specified cursor. Ora_GetColumn get data from a fetched row Description mixed ora_getcolumn int cursor mixed column Returns the column data. If an error occurs, False is returned and ora_errorcode will return a non-zero value. Note, however, that a test for False on the results from this function may be true in cases where there is not error as well (NULL result, empty string, the number 0, the string "0"). Fetches the data for a column or function result. Ora_Logoff close an Oracle connection Description int ora_logoff int connection Returns true on success, False on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions. Logs out the user and disconnects from the server. Ora_Logon open an Oracle connection Description int ora_logon string user string password Establishes a connection between PHP and an Oracle database with the given username and password. Connections can be made using SQL*Net by supplying the TNS name to user like this: $conn = Ora_Logon("user@TNSNAME", "pass"); If you have character data with non-ASCII characters, you should make sure that NLS_LANG is set in your environment. For server modules, you should set it in the server's environment before starting the server. Returns a connection index on success, or false on failure. Details about the error can be retrieved using the ora_error and ora_errorcode functions. Ora_Open open an Oracle cursor Description int ora_open int connection Opens an Oracle cursor associated with connection. Returns a cursor index or False on failure. Details about the error can be retrieved using the ora_error and ora_errorcode functions. Ora_Parse parse an SQL statement Description int ora_parse int cursor_ind string sql_statement int defer This function parses an SQL statement or a PL/SQL block and associates it with the given cursor. Returns 0 on success or -1 on error. Ora_Rollback roll back transaction Description int ora_rollback int connection This function undoes an Oracle transaction. (See ora_commit for the definition of a transaction.) Returns true on success, false on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions.