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: Holger Spangardt <Holger.Spangardt_at_web.de>
Date: Wed, 12 Dec 2001 00:11:27 +0100
Message-ID: <3C16929F.AA75158F@web.de>

Sybrand Bakker schrieb:

> On 11 Dec 2001 11:12:01 -0800, ocsfan_at_yahoo.com (Steve) wrote:
>
> [...]
> 1 create a sequence like this
> create sequence yourseq start with 1 increment 1 -- etc
> replace the 33 by yourseq.nextval, after having this statement once
> before the next run of the job
> 2 replace the hardcoded date by
> next_day(sysdate,'SAT')
>
> Hth
>
> Sybrand Bakker, Senior Oracle DBA
>
> To reply remove -verwijderdit from my e-mail address

Hi,

This is the most elegant way for this specific problem. But you can use shell variables in the inline-SQL, if can't solve the problems by SQL.
#!/bin/sh
function insert()
{
mydate=$4
myjobno=$5
sqlplus -s $2/$3 << EOF
insert into aque
(
jobno,
...
datetime,
...
) values (
$myjobno,
...
$mydate,
...
);
commit work;
EOF
}

mydate=`date +%D%...` # adjust to your favourite date_format myjobno=... # get jobno by SQL or by ini-file

insert $ORACLE_SID $2 $3 $mydate $myjobno exit 0

So you can use any shell variable. I like it :-))

Hope this helps,

    Holger Received on Tue Dec 11 2001 - 17:11:27 CST

Original text of this message

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