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 7683409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:47:08+00:00 2026-05-31T18:47:08+00:00

how to insert only time in hh:mi in oracle and how to run select

  • 0

how to insert only time in hh:mi in oracle and how to run select query by comparing time.

Explanation:
Let consider a doctor visit in hospital daily from 9AM to 11AM and 6PM to 8PM.
SO when we run a select query to search doctors who visit at 10AM on particular day.

Please give explanation with code.

Thanks in advance.

  • 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-05-31T18:47:09+00:00Added an answer on May 31, 2026 at 6:47 pm

    You just need basic date arithmetic, and the plain old date type.

    CREATE TABLE doctor_visits (
        doctor_id    NUMBER NOT NULL,
        in_time      DATE NOT NULL,
        out_time     DATE NOT NULL
    )
    /
    

    I presume you want to find doctors who were in the hospital at 10:00am, as opposed to doctors who visited exactly at 10AM

    SELECT doctor_id FROM doctor_visits 
    where in_time < trunc(in_time) + NUMTODSINTERVAL(10,'HOUR') 
    AND out_time > trunc(in_time) + NUMTODSINTERVAL(10,'HOUR') ;
    

    I haven’t considered the use case where in_time and out_time fall on different dates, i.e. say 11:00PM in and 2:00 am out.

    OR IF you want to find a list of Doctors who visited the hospital exactly at 10:00AM then

    SELECT doctor_id FROM doctor_visits where to_char(in_time,'HH:MI') = '10:00' ;
    

    But that would be a very strange thing to query, as you really can’t be sure if some one visits exactly at that specific time.

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

Sidebar

Related Questions

I am trying to insert a time only value, but get the following error
I would like to only insert a row, if the following SELECT returns a
Using only MySQL , I'm seeing if it's possible run an insert statement ONLY
Is it possible to insert only 100 records at a time per transactionScope? I
I need to perform this Oracle query in SQL Server: select case_id, channel_index, min(su_min)
I have a oracle database. I use the OracleDataAdapter(Oracle.DataAccess.dll) for select, update, insert, delete
I would like to only insert or update a row, if the following SELECT
I'm parsing a json feed routinely and need to insert only the newest users
What is the T-SQL syntax for granting a specific user only insert permission after
I have a FormView which I would like to open in insert mode only

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.