Reggie, As requested. Note, however, that the below code is uncompiled, and untested. It is also not really complete. It is intended only as a guide -- to get you started (with your homework assignment?)
Good Luck, Avi.
Jeremy Wilson
Ranch Hand
Joined: Feb 18, 2003
Posts: 166
posted
0
Using the jdbc interface all you need to pass is the java object for date or timestamp whichever is applicable. If you are passing a string to an oracle procedure or function that depends on the NLS_DATE_FORMAT database parameter. This can be modified for a session using the ALTER SESSION command.
Jeremy Wilson
Reggie McDougal
Ranch Hand
Joined: Sep 27, 2004
Posts: 69
posted
0
Thanks, thanks what I needed to know
Reg
Reggie McDougal
Ranch Hand
Joined: Sep 27, 2004
Posts: 69
posted
0
This works fine, rather than use the API the oracle format is simpler is there any disadvantage to this method?
Reg
[edited to add line breaks so page doesn't scroll right] [ January 19, 2005: Message edited by: Jeanne Boyarsky ]
Yes. By parsing your date string in SQL, you tie your JDBC code to Oracle, rather than leaving it database independant as it would be if you parsed the date in your Java code. Also you tie your date parsing to one Locale. By convention dates are described differently depending on where you are in the world (for example, typically Americans put the month before the day, while the British put the day before the month). If you parse your date in Java you can swap the formatting rules depending on Locale, but you can't do this in SQL. [ January 19, 2005: Message edited by: Paul Sturrock ]