[Info-Ingres] Time limited SQL

Paul Mason latepaul at gmail.com
Wed Nov 14 10:59:46 CST 2007


On 14/11/2007, Roger Hill <rhill at hillconsult.com> wrote:
>
> Hi.
>
> I have a job (delete from x where y...)
> that runs for many hours (not on Ingres I hasten to add).
>
> Does anyone here know a way to write self-terminating code along the lines
> of
>
> delete from x where y ..
> and time <5am
>

You could write a db proc which selects the tids corresponding your where
clause into a global temp table then loop through while date('now') <
time_to_stop - where time_to_stop is a date parameter.

You'd need to lock the table for safety (otherwise qualifying rows could
move, become disqualified etc) which you would need to do before you call
the procedure.

-- 
Paul Mason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.kettleriverconsulting.com/mailman/private/info-ingres/attachments/20071114/680da61d/attachment.html 


More information about the Info-Ingres mailing list