Home » SQL & PL/SQL » SQL & PL/SQL » Resetting running total (9i)
Resetting running total [message #293048] Thu, 10 January 2008 13:40 Go to next message
dukeslater
Messages: 11
Registered: November 2007
Location: Oklahoma USA
Junior Member
My previous post concerned writing an employee hierarchy to a text file, and with help I've got it working fine.

However, there is an additional requirement that was not supplied until now - each record needs a record number, and that number needs to reset upon each change of employee:

Emp.     Dept.     Record #
1         100         1
1         200         2
1         300         3
2         100         1
2         200         2
3         200         1
3         300         2
3         400         3

etc.


The records are written to the text file from a temp table, so I can update a column with the record number. Offhand, though, I have no idea how I would do that. A cursor would probably work, but first I thought I'd see if anyone had a better, easier way.

Thank you.
Re: Resetting running total [message #293054 is a reply to message #293048] Thu, 10 January 2008 14:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
ROW_NUMBER

Regards
Michel
Re: Resetting running total [message #293055 is a reply to message #293054] Thu, 10 January 2008 14:06 Go to previous messageGo to next message
dukeslater
Messages: 11
Registered: November 2007
Location: Oklahoma USA
Junior Member
Perfect. Can you tell I'm usually a SQL Server guy?

Thank you.
Re: Resetting running total [message #293121 is a reply to message #293048] Thu, 10 January 2008 23:49 Go to previous message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Welcome to Exciting world of Oracle Cool

Thumbs Up
Rajuvan.
Previous Topic: Retrieve only duplicate records
Next Topic: Data Logon trigger
Goto Forum:
  


Current Time: Sun Dec 04 10:54:16 CST 2016

Total time taken to generate the page: 0.15087 seconds