| 
 | 
  davide rangoni - 2012-01-26 14:41:32  
Hallo, 
 
I try to insert a value into a date field with this array: 
 
[:DATE_OF_BIRTH] => to_date('19890905','yyyymmdd') 
 
or  
 
[:DATE_OF_BIRTH] => 'to_date('19890905','yyyymmdd')' 
 
but i obtain this error message: 
 
ORA-01858: a non-numeric character was found where a numeric was expected 
 
. 
 
Can you tell me how to insert a value into a date field using your class? 
 
Thanks for answering. 
Best regards, 
Davide. 
  
  Sergey Pimenov - 2012-01-28 15:17:09 -  In reply to message 1 from davide rangoni 
post part source of procedure where you use this code 
  
  davide rangoni - 2012-01-30 10:42:46 -  In reply to message 2 from Sergey Pimenov 
$bind = array(":NAME"=>"".db_fix($_POST['name_text'])."", ":DATE_OF_BIRTH"=>"'to_date('".$_POST['yy'].$_POST['mm'].$_POST['dd']."','yyyymmdd')'"); 
 
$returning = array("ID"=>"id_user"); 
 
$r = $ora->Insert("ana_users",  
array("NAME"=>":NAME", "DATE_OF_BIRTH"=>":DATE_OF_BIRTH"),  
$bind, $returning); 
  
  Sergey Pimenov - 2012-01-30 22:02:05 -  In reply to message 3 from davide rangoni 
$bind = array(":NAME"=>"".db_fix($_POST['name_text'])."", ":DATE_OF_BIRTH"=>strtotime($_POST['yy'].$_POST['mm'].$_POST['dd'])); 
 
  
  davide rangoni - 2012-01-31 15:05:55 -  In reply to message 4 from Sergey Pimenov 
no way. 
using your code I obtain this error: 
ORA-01847: day of month must be between 1 and last day of month 
 
I also tried with intval() but nothing changed. 
 
Any idea? 
  
  Sergey Pimenov - 2012-01-31 16:55:23 -  In reply to message 5 from davide rangoni 
what is a see in  
 
var_dump($_POST['yy']."-".$_POST['mm']."-".$_POST['dd']); 
  
  Sergey Pimenov - 2012-01-31 17:02:07 -  In reply to message 5 from davide rangoni 
check values in $_POST array: 
 
$_POST['yy'] must be integer and not null 
$_POST['mm'] must be integer between 1 and 12 
$_POST['dd'] must be integer between 1 and last number day of month (30, 31, 28 or 29) 
  
  Sergey Pimenov - 2012-01-31 17:26:32 -  In reply to message 3 from davide rangoni 
after this 
 
$r = $ora->Insert("ana_users",  
array("NAME"=>":NAME", "DATE_OF_BIRTH"=>":DATE_OF_BIRTH"),  
$bind, $returning); 
 
call  
 
var_dump($ora->QuerySnapshot($r)); 
 
and post here 
  
  davide rangoni - 2012-02-01 11:10:41 -  In reply to message 8 from Sergey Pimenov 
var_dump($_POST['yy']."-".$_POST['mm']."-".$_POST['dd']); 
 
string(10) "1953-07-09" 
 
var_dump($ora->QuerySnapshot($r)); 
 
string(109) "insert into ana_volontari (NAME,DATE_OF_BIRTH) values(:NAME,:DATE_OF_BIRTH)  returning ID into :id_volontario" 
 
 
The error is: 
Warning: oci_execute(): ORA-01858: a non-numeric character was found where a numeric was expected in oracle.class.php on line 154 
 
 
 
I haveve also tried this: 
 
$r = $ora->Insert("user_table", array("NAME"=>":NAME",              "DATE_OF_BIRTH"=>"to_date('".$_POST['yy'].$_POST['mm'].$_POST['dd']."','yyyymmdd')"), $bind, $returning); 
 
In this case insert works, but I get this message: 
 
Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in oracle.class.php on line 150 
 
And as var_dump($ora->QuerySnapshot($r)); i get: 
 
Warning: Illegal offset type in oracle.class.php on line 595 
 
 
Thank you very much for helping. 
  
  Sergey Pimenov - 2012-02-01 20:57:09 -  In reply to message 9 from davide rangoni 
please test insert without binding: 
 
$name = db_fix($_POST['name_text']); 
$bdate = $_POST['yy']."-".$_POST['mm']."-".$_POST['dd']; 
 
$returning = array("ID"=>"id_user"); 
 
$r = $ora->Insert("ana_users",  
array("NAME"=>$name, "DATE_OF_BIRTH"=>$bdate),  
false, $returning); 
  
   |