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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:07:02+00:00 2026-05-27T00:07:02+00:00

For the hours I use it as date data type. When I subtract it,

  • 0

For the hours I use it as date data type. When I subtract it, it just normally deducts. How can I subtract it in time format like hours? I tried put datediff, timestampdiff, but it says invalid identifier. Must I create any function before executing? Or did I not activate datediff on Oracle?

Below is my code:

Select S.Test_Date, E.Testno, S.Examno, S.Serialno, 'Science'
      ,DATEDIFF(hours, F.STARTED, F.ENDED) as hours From Semester S, TIME F
      ,TESTPAPERS e
Where S.Testno= F.Testno
And E.Testno =1;

For timestampdiff:

Insert Into Test (Test_Date, Testno, Examno, Serialno, Type, Hours)
Select S.Test_Date, E.Testno, S.Examno, S.Serialno, 'Science'
     , TIMESTAMPDIFF(F.STARTED- F.ENDED) as hours From Semester S, TIME F
     , TESTPAPERS e
Where S.Testno= F.Testno
And E.Testno =1;
  • 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-27T00:07:03+00:00Added an answer on May 27, 2026 at 12:07 am

    In Oracle, you can do arithmetic on date/time expressions easily. Subtracting one expression from another yields the number of days (with floating-point precision) between the two expressions.

    For example, sysdate is right now, sysdate-1 is exactly one day ago, sysdate-(1/24) is one hour ago, and so forth.

    So if you have two date/time items named when and then, the number of hours between them is (when-then)*24

    No need to make it more complex than that if you’re staying in Oracle. You don’t need datediff, which is good because it isn’t there.

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

Sidebar

Related Questions

I'm working with an MS-SQL database with tables that use a customized date/time format
Currently my table has a column to store date and time. The data type
Part 1: Which MySQL data type to use for scheduling? In Part 1 of
I would like to analyse data per hour using SSAS. The built in date
First attempt to use this cool site - after searching for 2 hours: So
I've been fighting this problem for many hours now and could really use some
right_now = datetime.datetime.now() one_hour_before = ????? How can I use right_now to get one_hour_before?
I spent hours researching the problem, and just want to share a solution in
I'm trying to understand how LINQ can be used to group data by intervals
I have a table with day/time values that are split into date and an

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.