php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18750 OCI8 failure: CHAR/VARCHAR2 datatypes in query causing errors
Submitted: 2002-08-05 20:41 UTC Modified: 2002-08-06 05:24 UTC
From: robert at ud dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.2.1 OS: RH Linux 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 + 46 = ?
Subscribe to this entry?

 
 [2002-08-05 20:41 UTC] robert at ud dot com
PHP 4.2.1 compiled using --with-oci8 against Oracle 9i (9.2) libs on RH Linux 7.2 querying an Oracle 9i database.
Running any query that contains any Oracle CHAR or VARCHAR2 datatype returns the following error: "Warning: OCIStmtExecute: ORA-03115: unsupported network datatype or representation"

- Running the same queries in Oracle sqlplus client on Linux machine where PHP was built returns all data correctly.

- Running queries that only contain numbers or dates work perfectly fine all the way from Oracle to PHP output.

- Weirdly, casting the CHAR datatypes inside the query by wrapping them with TO_CLOB(foo) allows PHP to display data correctly.

Are the OCI8 functions not completely compatible with the latest Oracle 9i (9.2) release and client libs?

The PHP code I running to simply test Oracle connectivity and basic querying:
------------------------
putenv("ORACLE_HOME=/opt/oracle/product/9.2.0");

//fails:
$strSQL = "SELECT ENAME, EMPNO FROM SCOTT.emp";

//works: 
//$strSQL = "SELECT EMPNO FROM SCOTT.emp";

//works: 
//$strSQL = "SELECT TO_CLOB(ENAME), EMPNO FROM SCOTT.emp";

$objDBCN = OCILogon("foo_uid","foo_pwd","foo_SID");
$objSTH = OCIParse($objDBCN, $strSQL);
OCIExecute($objSTH);
OCIFetchStatement($objSTH, $objRS);
echo "<pre>";
print_r($objRS);
echo "</pre>";
OCIFreeStatement($objSTH);
OCILogOff($objDBCN);
-------------------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-06 05:24 UTC] thies@php.net
do NOT use putenv (or setenv in httpd.conf) to set the  
oracle environment variables. it does _NOT_ work. please  
set ORACLE_HOME, _SID and NLS_KANG in /etc/init.d/httpd  
(or whatever you apache start-script is called).  
  
 [2002-08-06 11:31 UTC] robert at ud dot com
Made change as suggested.
Errors resolved.  Please mark bug as "bogus".
(but maybe it is not truly "bogus" as the PHP documentation shows examples using putenv).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 11:01:32 2024 UTC