Page 1 of 1

manage a flag in oracle table

Posted: Wed Jan 17, 2007 5:37 am
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...

Posted: Wed Jan 17, 2007 11:40 am
by DSguru2B
Do an Update on flag with max timestamp as the where predicate.