Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle/Unix shell script question...

Re: Oracle/Unix shell script question...

From: Antti Järvinen <costello_at_iki.fi>
Date: 12 Dec 2001 12:39:49 +0200
Message-ID: <m3bsh4d8ne.fsf@muikku.baana.suomi.net>


ocsfan_at_yahoo.com (Steve) writes:
> an Oracle table. This script is in production and a cron job runs it
> weekly, on Saturdays. But I have to change this script EVERY week to
> do two things: Increment the "jobno" field (in the script, it is
> toward the bottom - "33") and change the "datetime" field to the date

There were already a suggestion to use a sequence for the "33" and it will work supposing that the script in no circumstances gets run twice.

If you always run your script on saturday and you want to use there expression equivalent to "next saturday", you can express it simply by saying "sysdate+7" which, if run today, '12-dec-2001' has value of '19-dec-2001' e.g. next wednesday, 7 days ahead "sysdate". In some other database than Oracle this might work in different way.

Another possibility is to write another program that modifies your program. It is not difficult, perl or tcl might be easiest tools for this. Or awk would but, but it seems to me that awk lacks date functions and it might be interesting to find out a way to express the "next saturday" in awk. .. GNU awk seems to have system() and strftime() so it would do the job, osf/1 awk doesn't seem to have, RS/6k runs AIX ? and I don't know about that.

-- 
Antti Järvinen, costello_at_iki.fi
            "concerto for two faggots and orchestra" 
Received on Wed Dec 12 2001 - 04:39:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US