Sign Up

Sign Up to our social questions and Answers 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 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

Sorry, you do not have permission to add post.

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.

Oraask Logo Oraask Logo
Sign InSign Up

Oraask

  • Write
    • Add A New Post
    • Ask A Question

Oraask Navigation

Search
Ask A Question

Mobile menu

Close
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Dev Tools
    • Online Compiler
    • Base64 Converter
  • Wiki
    • SQL Tutorials
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
Home/ Questions/Q 4977
Next
In Process

Oraask Latest Questions

Question
Jone
  • 0
  • 0
JoneExplorer
Asked: April 13, 20172017-04-13T15:50:25+03:00 2017-04-13T15:50:25+03:00In: Oracle SQL

Using between on sysdate instead of TRUNC

  • 0
  • 0

Hi ,

I have the below query where am using TRUNC on the column2 filed which is increasing the performance delay.

so need to avoid the TRUNC on this check and need to use BETWEEN operator.
Here SYSTEMDATE is the currentdateandtime.
So how can write a between condition so that column2[which included time part as well] is between the time of the systemdate[which included time part as well].

Current query:

SELECT sum(column3)
from table1
where column1 = ‘XXXXXAA12’
and TRUNC(column2) = TRUNC(SYSTEMDATE)

Need to have smthng below:

SELECT sum(column3)
from table1
where column1 = ‘XXXXXAA12’
and column2 between xxxxxxxxxxxxxxxxx and xxxxxxx

so without using TRUNC on both sides how to write the query ?
Please suggest ??

Thank you in advance.

betweenoraclequerysqltrunc
1
  • 1 1 Answer
  • 556 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    Related Questions

    • How to get Column Names from a Table in Oracle
    • What are the different types of case manipulation functions available in Oracle SQL
    • What is the use of ADD, DROP and MODIFY Commands
    • What are the differences between SQL and PL/SQL in Oracle
    • What is the use of LIMIT and OFFSET in SQL

    1 Answer

    • Voted
    • Oldest
    • Recent
    1. Ahmed_Shmes
      Ahmed_Shmes Junior ahmedshmes21@gmail.com
      2019-04-03T18:45:58+03:00Added an answer on April 3, 2019 at 6:45 pm

      Use TO_DATE Function.

      SELECT sum(column3)
      from table1
      where column1 = ‘XXXXXAA12’
      and column2 between to_date (<yor val>,<your format>) and to_date (<yor val>,<your format>);

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

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Adv 250x250

    Explore

    • Categories
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Dev Tools
      • Online Compiler
      • Base64 Converter
    • Wiki
      • SQL Tutorials
      • Java Tutorials
      • Python Tutorials
      • JavaScript Tutorials

    Footer

    Oraask

    About

    Oraask is a website for developers and software engineers who want to learn new skills, share their knowledge, and solve their coding problems. Oraask provides free content on various programming languages and topics, such as Oracle, Python, Java, etc. Oraask also allows users to ask questions and get answers from other members of the community.

    About Us

    • About Us
    • Contact Us

    Legal Stuff

    • Privacy Policy
    • Terms & Conditions

    Follow

    Oraask is licensed under CC BY-NC-SA 4.0Oraask CopyrightOraask CopyrightOraask CopyrightOraask Copyright

    © 2019 Oraask. All Rights Reserved
    With Love by Oraask.

    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.