passing sysdate from sqlplus into dsjob -run paramtere

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jitsreddy
Participant
Posts: 5
Joined: Fri Nov 21, 2003 4:15 pm
Location: jersye

passing sysdate from sqlplus into dsjob -run paramtere

Post by jitsreddy »

Hi,
I want to pass the sysdate value that is generated by sql plus session
into my dsjob run command. I tried the below, but it is giving an error. Can some one let me know how to pass this variable from unix to dsjob -run [param] command.

sys=`$ORACLE_BIN/sqlplus -s user/pwd@project << eof
set heading off
select sysdate from dual;
exit;
end
eof`
export man=$sys
echo $man
$DSJOB/dsjob -run -param name=$man Proj1 jobp
thanks
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Assuming sysdate is returning a value of YYYY-MM-DD HH24:MI:SS, you have spaces, colons, and dashes that will not work. You must surround the entire string with double quotes.

However, dsjob is sometimes flakey and will strip off the quotes. I have found that you have to use "eval" to execute dsjob and preserve the quotes.

You could look at this script I posted:
viewtopic.php?t=85578

which gets the date from the Unix prompt via the date command, and formats it without any of the messy characters. Then, you don't have to bother with executing sqlplus. Another choice would be to use TO_CHAR on sysdate and format the output to not have those messy characters.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply