PL/SQL Errors in PHP : Oracle : Databases PHP Source Code

PHP Source Code » Databases » Oracle »


PL/SQL Errors in PHP

Some common PL/SQL errors you might encounter are:
* Success with information warnings
* Incorrect end of line terminators on Windows platforms
This section gives a description of what may cause these errors, and ways to resolve them.
PL/SQL Success With Information Warnings
A common PL/SQL error when creating packages, procedures or triggers is:
Warning: oci_execute(): OCI_SUCCESS_WITH_INFO: ORA-24344: success with
compilation error
You can get more information about the problem cause by querying Oracle’s user_errors
The PHP code to check for informational errors and warnings is shown by this example
that creates a procedure referencing a non-existent table and then queries the user_errors
table when an ORA-24344 error occurs:
// A PL/SQL statement with deliberate error: not_mytab doesn&#8217;t exist
$plsql "create or replace procedure
        myproc(d_p in varchar2, i_p in number) as
          insert into not_mytab (mydata, myid) values (d_p, i_p);
$s oci_parse($c$plsql);
$r oci_execute($s);
if (!
$r) {
$m oci_error($s);
        if (
$m['code'] == 24344) {
// A PL/SQL "success with compilation error"
        else {
// A normal SQL-style error
echo "Error is "$m['message'], "\n";
// Display PL/SQL errors
function show_compilation_errors($c)
$s oci_parse($c"SELECT NAME || ': ' || ATTRIBUTE
                                || ' at character ' || POSITION
                                || ' of line ' || LINE || ' - '
                                || TEXT
                            FROM USER_ERRORS
                            ORDER BY NAME, LINE, POSITION,
                            ATTRIBUTE, MESSAGE_NUMBER"
"<table border='1'>\n";
        while (
$row oci_fetch_array($sOCI_ASSOC+OCI_RETURN_NULLS)) {
            foreach (
$row as $item) {
"<td>".($item?htmlentities($item):" ")."</td>";
This displays:
Warning: oci_execute(): OCI_SUCCESS_WITH_INFO: ORA-24344: success with
compilation error in plsqlerr.php on line 11
MYPROC: ERROR at character 7 of line 4 - PL/SQL: SQL Statement ignored
MYPROC: ERROR at character 19 of line 4 - PL/SQL: ORA-00942: table or
view does not exist
Looking at the PL/SQL code creating the procedure, character 7 on line 4 of the PL/SQL
code is the INSERT statement. Character 19 is the not_mytab table name.
Alternatively to show the PL/SQL errors, connect to SQL*Plus and use SHOW ERRORS:
SQL> connect hr/hrpwd@//localhost/XE
SQL> show errors procedure myproc
-------- ---------------------------------------------------------
4/7 PL/SQL: SQL Statement ignored
4/19 PL/SQL: ORA-00942: table or view does not


HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Databases
» Oracle