the code:
<?php
OCIInternalDebug(1);
$db = OCILogon("info","mypwd");
// this one works, result is 10 (see below)
$stmt = OCIParse($db,"SELECT 5+5 FROM DUAL");
OCIExecute($stmt);
echo "<table cellpadding='3'>\n";
while (OCIFetchInto($stmt,$row))
{
echo "<tr>";
foreach($row as $field) echo "<td bgcolor='#EEEEEE'>$field</td>";
echo "</tr>";
}
echo "</table>\n";
// this one should return "5" (VARCHAR2), error occures (see below)
$stmt = OCIParse($db,"SELECT TO_CHAR(5) FROM DUAL");
OCIExecute($stmt);
echo "<table cellpadding='3'>\n";
while (OCIFetchInto($stmt,$row))
{
echo "<tr>";
foreach($row as $field) echo "<td bgcolor='#EEEEEE'>$field</td>";
echo "</tr>";
}
echo "</table>\n";
OCILogOff($link);
?>
the output:
OCIDebug: oci_open_server new conn=0 dname=
OCIDebug: oci_open_session new sess=2 user=info
OCIDebug: oci_do_connect: id=3
OCIDebug: oci_parse "SELECT 5+5 FROM DUAL" id=4 conn=3
10
OCIDebug: oci_parse "SELECT TO_CHAR(5) FROM DUAL" id=5 conn=3
OCIDebug: START oci_stmt_list_dtor: id=4 last_query="SELECT 5+5 FROM DUAL"
OCIDebug: START oci_column_hash_dtor: 5+5
OCIDebug: END oci_column_hash_dtor: 5+5
OCIDebug: END oci_stmt_list_dtor: id=4
Warning: OCIStmtExecute: Error while trying to retrieve text for error ORA-03106 in /usr/local/apache/htdocs/oratest/ora2.php on line 28
Warning: OCIFetchInto: Error while trying to retrieve text for error ORA-24374 in /usr/local/apache/htdocs/oratest/ora2.php on line 31
OCIDebug: START php_rshutdown_oci
OCIDebug: END php_rshutdown_oci
OCIDebug: START oci_stmt_list_dtor: id=5 last_query="SELECT TO_CHAR(5) FROM DUAL"
OCIDebug: START oci_conn_list_dtor: id=3
OCIDebug: nothing to do..
OCIDebug: END oci_conn_list_dtor: id=3
OCIDebug: END oci_stmt_list_dtor: id=5
OCIDebug: START oci_close_session: logging-off sess=2
OCIDebug: START oci_close_server: detaching conn=1 dbname=