in reply to Re: Class::DBI / Oracle date field Q
in thread Class::DBI / Oracle date field Q
It seems that with Class::DBI only numbers and strings can be passed into the DB.
Here's a follow up so that everyone knows what I did to fix the problem:
Oracle will by default turn a string into a date datatype based upon only its very strict idea of what a date string should be patterned like. I am using Oracle 8i, which will allow me to set the default date pattern for my session. I will do this so that I have a predictable pattern to make my strings. I do this in my Class::DBI setup like so:
package CDNR::DBI; use base 'Class::DBI::Oracle'; use Config::General; my %hostCF = ParseConfig("../mymodules/config.$hostname"); CDNR::DBI->set_db('Main', $hostCF{'dbconnect'}, $hostCF{'dbname'}, $hostCF{'dbpw'}); my $dbh = CDNR::DBI->db_Main; my $qs = "Alter session set nls_date_format = 'Mon-DD-YYYY'"; $dbh->do($qs) or die "DB err alter date";
At this point I can pass a string to the Class::DBI for inserting into a "date" database field as longs as the string looks like Mon-DD-YYYY.
cheers
-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday
|
|---|