Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:14:27+00:00 2026-06-02T03:14:27+00:00

I am having a timestamp column name DOWNLOAD_DATE in one database table named DOWNLOAD_TAB.

  • 0

I am having a timestamp column name DOWNLOAD_DATE in one database table named DOWNLOAD_TAB.

When I opened the Oracle SQL Developer the maximum date was “24.02.12 13:48:39,286000000”

select TO_CHAR (MAX(DOWNLOAD_DATE)) from DOWNLOAD_TAB

But the Query above returned me the date as “24.02.12 13:48:39,286”

Now I want to form a Query that will give me all the records after a certain date, But I am having that date available in java.util.Date.

I can not use the preparedstatement of java due to some framework constraints. I need to use the Statement class.

Would anyone please suggest me a way to do this in java using java.sql.Statement.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:14:28+00:00Added an answer on June 2, 2026 at 3:14 am

    If you absolutely can’t use prepared statements, this should work. Format the date as you will, and then use TO_DATE in your sql statment using the same format. Oracle has a default format, but I prefer explicitly stating the format.

    Date now = new Date();
    String dateString = new SimpleDateFormat("yyyy-MM-dd").format(now);
    String sqlVal = "TO_DATE('" + dateString + "', 'yyyyy-mm-dd')";
    String sql = "SELECT * FROM DOWNLOAD_TAB WHERE download_date > " + sqlValue;
    

    And that’s why a prepared statement is always preferred. As you can see, this code is ugly, error-prone, non-portable across databases, and open to sql injection attacks. And of course, prepared statement perform better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in an Oracle database with a timestamp column nextTime and
I have an order table in MySQL database, having a field/column which stores the
How do I get the Timestamp value from database column via a cursor and
Possible Duplicate: Datetime vs Timestamp? I have a Mysql table, which has a column
I have this query: SELECT device, COUNT(*) FROM database.table GROUP BY device HAVING count(*)
forum member I need one help from you all. I am having two POJO
In most of my databases that I have created I've always named my column
I'm having this table class CreateEvents < ActiveRecord::Migration def self.up create_table :events do |t|
I have a table with an XML type column. This column contains a dynamic
Possible Duplicate: Having both a Created and Last Updated timestamp columns in MySQL 4.0

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.