Re: DB: Inserting a value into an Oracle DATE column with autoPrepare/execute()

From: Date: Tue, 30 Dec 2003 18:49:49 +0000
Subject: Re: DB: Inserting a value into an Oracle DATE column with autoPrepare/execute()
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9883@lists.php.net to get a copy of this message
Hi You have to find out how the db expects the date (you can found this in a System View). Or you can set it with a sql statement like: alter session set nls_dateformat='dd.mm.yyyy'; The choosen dateformat is now valid until you close the connection. Or you can set it in the ora.ini for ever and the hole db. (restart of the db is needed) Or you can insert a record like this if you don't wana chance something. insert into tablexy values ('xxx',to_date('01.01.2003','DD.DD.YYYY')); (Im not sure about the right syntax in the examples) Marco ----- Original Message ----- From: "Shawn Coomey" <shawn.coomey@cubist.com> To: <pear-general@lists.php.net> Sent: Tuesday, December 30, 2003 7:14 PM Subject: [PEAR] DB: Inserting a value into an Oracle DATE column with autoPrepare/execute() Hi folks- I am trying to insert a date (comes from a $_POST var in the form of mm/dd/yyyy) into an Oracle table's date column. How can I do this with PEAR? I am trying this currently, but get a "[nativecode=ORA-01843: not a valid month]" error: /************ Code Example *************/ $table_fields = array("DOC_ID", "CC_MEETING_DATE"); $table_values = array($doc_id, $_POST["cc_meeting_date"]); $table_name = "my_table"; $sth = $db->autoPrepare($table_name, $table_fields, DB_AUTOQUERY_INSERT); $inserter = $db->execute($sth, $table_values); /******** End Code Example **********/ Thanks! Shawn

« previous php.pear.general (#9883) next »