Re: Oracle and bindcolumns
- From: hjp@xxxxxxxxx (Peter J. Holzer)
- Date: Thu, 19 Oct 2006 09:17:11 +0200
On 2006-10-18 10:19:24 -0400, Hardy Merrill wrote:
I think I get it yes. So here is what I am doing. Access has a date
field that I am pulling out and when I print the "$start_date" variable
it looks like this:
2006-09-15 00:00:00
That is a string now to Perl...correct? Now I am inserted that string
into the Oracle database as a DATE. So I am doing, using the variable
from the bindcolumn parameter:
TO_DATE($start_date, 'MM/DD/YYYY')
to insert that string into Oracle as a DATE and passing in the date
format along with it.
The date format is wrong. If you tell Oracle to expect a date in
MM/DD/YYYY format and then feed it a string like '2006-09-15 00:00:00'
it will complain that they don't match. You will eitther have to change
the format string to match the actual date format (i.e., 'YYYY-MM-DD
HH24:MI:SS') or change the date format to match the format string.
Also, TO_DATE($start_date, 'MM/DD/YYYY') will almost certainly result in
a syntax error. That expands into something like
TO_DATE(2006-09-15 00:00:00, 'MM/DD/YYYY')
which is not not correct SQL (the quotes are missing). Use placeholders.
Finally, you might want to look at the execute_array method. For recent
versions of DBD::Oracle is a lot faster then execute for bulk inserts.
hp
--
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | hjp@xxxxxxxxx | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users
Attachment:
pgpW1hmAeI7v6.pgp
Description: PGP signature
- Follow-Ups:
- Re: Oracle and bindcolumns
- From: Robert Hicks
- Re: Oracle and bindcolumns
- References:
- RE: Oracle and bindcolumns
- From: Philip Garrett
- Re: Oracle and bindcolumns
- From: Robert Hicks
- Re: Oracle and bindcolumns
- From: Hardy Merrill
- Re: Oracle and bindcolumns
- From: Robert Hicks
- Re: Oracle and bindcolumns
- From: Hardy Merrill
- RE: Oracle and bindcolumns
- Prev by Date: DBD::mysql make fails on AIX 5.2
- Next by Date: RE: DBD::mysql make fails on AIX 5.2
- Previous by thread: Re: Oracle and bindcolumns
- Next by thread: Re: Oracle and bindcolumns
- Index(es):
Relevant Pages
|
|