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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:25:28+00:00 2026-06-17T23:25:28+00:00

time_created and time_ended are VARCHAR fields. SQL statement SELECT time_created, time_ended, TO_TIMESTAMP (time_ended, ‘YYYY/MM/DD-HH24:MI:SS:FF9’)

  • 0

time_created and time_ended are VARCHAR fields.

SQL statement

SELECT time_created,
   time_ended,
   TO_TIMESTAMP (time_ended, 'YYYY/MM/DD-HH24:MI:SS:FF9')
   - TO_TIMESTAMP (time_created, 'YYYY/MM/DD-HH24:MI:SS:FF9')
  FROM trans

output

2012/10/28-18:46:13.855 2012/10/28-18:47:43.357 +00 00:01:29.502000
2012/10/20-22:40:10.363 2012/10/20-22:40:35.265 +00 00:00:24.902000
2012/10/20-22:40:08.951 2012/10/20-22:40:24.717 +00 00:00:15.766000
2012/10/20-22:40:09.454 2012/10/20-22:40:28.217 +00 00:00:18.763000
2012/10/20-22:40:09.912 2012/10/20-22:40:31.767 +00 00:00:21.855000
2012/10/22-10:11:29.360 2012/10/22-10:14:08.692 +00 00:02:39.332000
2012/10/22-10:11:08.335 2012/10/22-10:11:43.781 +00 00:00:35.446000
2012/10/20-22:40:07.900 2012/10/20-22:40:17.508 +00 00:00:09.608000
2012/10/20-22:40:08.469 2012/10/20-22:40:21.144 +00 00:00:12.675000
2012/10/22-11:00:42.355 2012/10/22-11:01:41.706 +00 00:00:59.351000
2012/10/22-10:11:09.268 2012/10/22-10:11:54.185 +00 00:00:44.917000
2012/10/22-10:11:13.072 2012/10/22-10:12:21.365 +00 00:01:08.293000

I wish where clause which shows me only records greater than 1 minute.

I use Oracle Database 10g on Sun Solaris.

  • 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-17T23:25:29+00:00Added an answer on June 17, 2026 at 11:25 pm

    If you alias the difference column, you can wrap this in an outer select and just add a where clause:

    SELECT * FROM (
        SELECT time_created,
            time_ended,
            TO_TIMESTAMP (time_ended, 'YYYY/MM/DD-HH24:MI:SS:FF9')
                - TO_TIMESTAMP (time_created, 'YYYY/MM/DD-HH24:MI:SS:FF9') AS diff
        FROM trans
    )
    WHERE diff > INTERVAL '1' MINUTE
    

    With dummy data to match your output, populated in a CTE:

    with trans as (
    select '2012/10/28-18:46:13.855' time_created,
        '2012/10/28-18:47:43.357' time_ended from dual
    union all select '2012/10/20-22:40:10.363', '2012/10/20-22:40:35.265' from dual
    union all select '2012/10/20-22:40:08.951', '2012/10/20-22:40:24.717' from dual
    union all select '2012/10/20-22:40:09.454', '2012/10/20-22:40:28.217' from dual
    union all select '2012/10/20-22:40:09.912', '2012/10/20-22:40:31.767' from dual
    union all select '2012/10/22-10:11:29.360', '2012/10/22-10:14:08.692' from dual
    union all select '2012/10/22-10:11:08.335', '2012/10/22-10:11:43.781' from dual
    union all select '2012/10/20-22:40:07.900', '2012/10/20-22:40:17.508' from dual
    union all select '2012/10/20-22:40:08.469', '2012/10/20-22:40:21.144' from dual
    union all select '2012/10/22-11:00:42.355', '2012/10/22-11:01:41.706' from dual
    union all select '2012/10/22-10:11:09.268', '2012/10/22-10:11:54.185' from dual
    union all select '2012/10/22-10:11:13.072', '2012/10/22-10:12:21.365' from dual
    )
    SELECT * FROM (
        SELECT time_created,
            time_ended,
            TO_TIMESTAMP (time_ended, 'YYYY/MM/DD-HH24:MI:SS:FF9')
                - TO_TIMESTAMP (time_created, 'YYYY/MM/DD-HH24:MI:SS:FF9') AS diff
        FROM trans
    )
    WHERE diff > INTERVAL '1' MINUTE
    
    TIME_CREATED            TIME_ENDED              DIFF
    ----------------------- ----------------------- ------------------------------
    2012/10/28-18:46:13.855 2012/10/28-18:47:43.357 +000000000 00:01:29.502000000
    2012/10/22-10:11:29.360 2012/10/22-10:14:08.692 +000000000 00:02:39.332000000
    2012/10/22-10:11:13.072 2012/10/22-10:12:21.365 +000000000 00:01:08.293000000
    
    3 rows selected.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for jr in json_reports: jr['time_created'] = str(jr['time_created'])
My intention is for a new <input> fields to be created every time there
I am trying to create a SQL script that will create a nice easy
Parsing some data and inserting it into 3 tables from .NET. Using Table Valued
The first time I open one of my child forms from the main form
i am building a quiz system, the fields on the table is: id, title,
We have an app that creates queues and services in SQL Server using the
I tried running this statement in Postgres: insert into field (id, name) values (DEFAULT,
Afternoon. I have several SQL Agent jobs running on an MS 2K8 BI server,
I m getting Time data in this format in an JSON Object. created_time: 2012-04-01T15:02:52+0000

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.