manage a flag in oracle table

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kjaouhari
Participant
Posts: 325
Joined: Thu Mar 16, 2006 10:22 am

manage a flag in oracle table

Post by kjaouhari »

Hi guys,

I'm coming with a new little challenge !

I have a daily job which populate a table HISTO with the last date of extractions.

I want to add a column flag to get the date we want for the next run.

flag = 0 : old extraction
flag = 1 : last extraction


How can I manage a flag to get the date of last extracctions like this :

HISTO
-----------------
Tablename|Date|Flag
INVOICE |2006-12-01|0
INVOICE |2007-01-01|0
INVOICE |2006-12-31|0
INVOICE |2007-01-11|1

I'm asking this question because If I update the column without insert a new flag , all flag will bet set to 0...
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Do an Update on flag with max timestamp as the where predicate.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply