[R] Inserting Date Field into Oracle table using ROracle

stefan.ulrych@ubs.com stefan.ulrych at ubs.com
Wed Oct 20 17:07:43 CEST 2004


It is possible to insert date and time information as a 
character string into an Oracle DATE data type 
with ROracle. In an older e-mail it has been stated 
that it is only possible to insert the date as a string
into a DATE field.

The solution is as follows:
Before inserting the character string the default 
value for the NLS_DATE_FORMAT must be changed in Oracle, 
e.g.

...
res<-dbSendQuery(con,"alter session set NLS_DATE_FORMAT = 'dd-mm-yyyy hh24:mi:ss'")
dbClearResult(res)
...

After you have processed these commands you can insert a
character string that matches the above format into an
Oracle DATE data field with the dbPrepareStatement and
dbExecStatement commmands.

You can define also other formats using the Oracle date and 
time format rules.

Regards
Stefan Ulrych

Visit our website at http://www.ubs.com

This message contains confidential information and is intend...{{dropped}}




More information about the R-help mailing list