Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to calculate time since last event in PL/SQL?

562979May 24 2007 — edited Jun 5 2007
I am facing the following problem:

I have a TABLE like this:

CUSTOMER_ID (number),
EVENT_TIME (timestamp),
IND_PURCHASE (number) # indicator 0|1 if buy

I want to calculate the time(in minutes) since the last purchase of each customer. How can I do that in PL/SQL?

Basically for each CUSTOMER_ID at each EVENT_TIME calculate CURRENT_EVENT_TIME - (LAST_EVENT_TIME where IND_PURCHASE = 1)

Your help is greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 3 2007
Added on May 24 2007
17 comments
1,066 views