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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:52:32+00:00 2026-06-18T06:52:32+00:00

This view in SQL Server is getting records which we then display according to

  • 0

This view in SQL Server is getting records which we then display according to admin time, I need to do this in Oracle 10g now, what sort of differences do I have to convert for here?

    /* Formatted on 1/29/2013 3:39:19 PM (QP5 v5.227.12220.39724) */
SELECT p.facility_key,
       CAST (p.unit_code AS VARCHAR) + '-' + CAST (p.room AS VARCHAR)
      AS unit_code,
       p.first_name,
       p.last_name,
       m.admin_time,
     CONVERT (varchar (5),
            datediff (s,
                  m.admin_time,
                  getdate ())
          / 3600)
       + ':'
       + CONVERT (varchar (5),
          datediff (s,
                m.admin_time,
                getdate ())% 3600 / 60)
              AS ELAPSED
FROM         OTEN.TEN_M_PATIENT_MAST AS P INNER JOIN
              OP.ORD_M_ADMIN AS M ON P.PAT_NUMBER = M.PAT_NUMBER
WHERE     (M.ADMIN_TIME BETWEEN DATEADD(DAY, - 1, GETDATE()) AND GETDATE())
  • 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-18T06:52:34+00:00Added an answer on June 18, 2026 at 6:52 am

    If your elapsed time is less than 24 hours, then the following should work:

    SELECT P.FACILITY_KEY,
           CAST(P.UNIT_CODE AS VARCHAR(255)) || '-' || CAST(P.ROOM AS VARCHAR(255)) AS UNIT_CODE,
           P.FIRST_NAME, P.LAST_NAME, M.ADMIN_TIME,
           to_char(trunc(sysdate)+(SYSDATE - m.admin_time), 'hh:mm:ss') as elapsed
    FROM OTEN.TEN_M_PATIENT_MAST P INNER JOIN
         OP.ORD_M_ADMIN M
         ON P.PAT_NUMBER = M.PAT_NUMBER
    WHERE M.ADMIN_TIME BETWEEN sysdate - 1 and sysdate
    

    Some notes. First, I added a length to varchar. You should do this in any database. Second, I simplified the datetime arithmetic to just use subtraction. I changed getdate() to sysdate. And the “+”s with “||”s. Finally, to get the elapsed time in hh:mm:ss format, I used a trick. I take the difference, add to the current date, and just convert the fractional part to hh:mm:ss.

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

Sidebar

Related Questions

I currently have this statement in my SQL View (SQL Server 2008 R2) which
I have a ListView which I filled in from SQL Server view called view_ListaKlientow
I need to create a composite key for a view in SQL Server 2008
If i create an Indexed View (in Sql Server 2008), does this mean i
I am getting some strange behaviour from SQL Server. I have an underlying view
This question already has an answer here: view sql that linq-to-sql produces 3 Answers
I want to implement this view But I have one question: The text which
I have a view in a SQL Server 2008 db that simply exposes about
My colleague asked me a question regarding getting data from a SQL Server database.
I am using SQL Server 2000 and feeling stuck about how to do this:

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.