We help IT Professionals succeed at work.
Get Started

Inserting transaction data into various time related tables

GNOVAK asked
Last Modified: 2012-05-12
I have posted this question and received an answer, however I now have a new problem. Here;s the original question:
I have a table that has trading transactions and contains a timestamp field and a ASK price each time the price changes (tick data).
The timestamp has the format:1/1/2009 10:42:00.000000 PM
The records are sequential but do not have a consistent gap. some are the same time, some are 2 seconds apart, some 10 seconds apart.
I wish to load  the beginning ask price and the ending ask price for each minute into another table (MIN_Table)

The answer that worked great:
SELECT   TO_CHAR (ticktime, 'dd/mm/yyyy hh24:mi'),
           Min(ASK) Min,
           Max(ASK) Max,
           MAX (ask) KEEP (DENSE_RANK FIRST ORDER BY id) Open,
           MAX (ask) KEEP (DENSE_RANK LAST ORDER BY id)  Close
    FROM   Ticktemp
GROUP BY   TO_CHAR (ticktime, 'dd/mm/yyyy hh24:mi');
I place this into an INSERT INTO statement and this works for a table containing 1 minute transactions.
I can also make this work for a 1 hour table (thanks to help here) by changing the TO_CHAR to hh24:hh24

But I need to be able to generate data to fill the following individual tables:
1 min (got it)
5 min
15 min
30 min
1 hour(got it)
4 hours
1 day
1 week
1 month.

Does anyone have a solution for the other time frame tables that I can use in an insert statement?
Watch Question
This problem has been solved!
Unlock 2 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE