Shamminuj Rahman Shamminuj Rahman - 3 months ago 28
PHP Question

Oracle batch insert with date. How to format date?

I need to batch insert into oracle. But the date is not formatted correctly.



Hey I am giving simple example please check this one my be help ...


Generates an insert string based on the data you supply, and runs the query. You can either pass an array or an object to the function. Here is an example using an array:

$user_id = $this->session->userdata['rrss_user']['user_id'];

  $data = array(
                'ENTRY_BY' => $user_id,
                'ENTRY_DATETIME'=> date('d-M-Y') 


$this->db->insert_batch('mytable', $data);

Now the above works fine, but if I try to change the date('d-M-Y') to anything more granular which includes hr/sec/mins

So it looks like since Oracle DATE type uses 'd-M-Y' as the default format, that's all it will accept as a string representation for date field...Would like to know if anyone has any thoughts on how I can set the field with the full date-timestamp, not just 'd-M-Y'.

Without Batch example :

$this->db->set('user_name', $name);
$this->db->set('age', $age);