#49509 [Com]: ann't send a date type into oracle parameter

From: Date: Wed, 09 Sep 2009 07:56:37 +0000
Subject: #49509 [Com]: ann't send a date type into oracle parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142133@lists.php.net to get a copy of this message
ID: 49509 Comment by: hymanyung at 163 dot com Reported By: hymanyung at 163 dot com Status: Open Bug Type: OCI8 related Operating System: Centos 5.3 PHP Version: 5.2.10 New Comment: Pls tell me how to define a date type variable in php and pass date type variable into oracle date type parameter. Previous Comments: ------------------------------------------------------------------------ [2009-09-09 07:53:38] hymanyung at 163 dot com Description: ------------ I want to pass a date type variable into oracle's procedure. But It automate converts date type into string. Reproduce code: --------------- $sql = 'declare ws_time date := :mydate; begin select con_id from home.zcontp00; end; $stmt = oci_parse($this->conn, $sql); $my_cursor = ociNewCursor($this->conn); $now = date('Y-m-d',strtotime('2009-09-08')); OCIBindByName($stmt, ":mydate",$now); OCIBindByName($stmt, ":c1", $my_cursor, -1, OCI_B_CURSOR); OCIExecute($stmt); OCIExecute($my_cursor); while ($val = oci_fetch_assoc($my_cursor)){ echo $val['CON_ID']; } Expected result: ---------------- Above Report error. " literal does not match format string " ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49509&edit=1

« previous php.bugs (#142133) next »