Two Laptop Bag*
The moose likes JDBC and the fly likes Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle" Watch "Oracle" New topic


Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
Hi all

I facing one oracle query problem ..

In one table i have one column named "today_date" as type varchar;
And another table i have another column named"cf_Auth_dt" as type date.
So i need to substract these dates .
Can any body give idea !!!
Thanks and Regards
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
I tried to do a simple subtract on a table with two dates (in Oracle) and it seems to return a real value representing the number of days/hours [eg., 12.75 = 12.75 days, or 12 days and 18 hours]. So you just have to convert the varchar date into a date field. Something like this:

You need to specify the correct format for the varchar date [however it's stored in the database], and the rest should be fairly obvious. This is how it's done in SQL.
It is sorta covered in the JavaRanch Style Guide.
subject: Oracle
Similar Threads
java.sql.Timestamp to Oracle date
creating table
oracle XSU + time
Once again JAVA-ORACLE
Regarding Foreign Key Restricts when Alter data type in sql table