Variables in Command Window

Tinti

Member²
Hi

I have to start several scripts in a command window. Each script should have as parameter the same timestamp ("curr_ts"). How do I have to declare "curr_ts" and how to fill it with the current timestamp.

Code:
-------------------------------------------------------------------------------------------
--  START JOB-ID 1
-------------------------------------------------------------------------------------------

PROMPT  ######### START DES JOBS 1  #########

..... curr_ts .....

@c:\temp\script1.sql curr_ts
@c:\temp\script2.sql curr_ts

PROMPT  ######### ENDE DES JOBS 1 #########
--  ENDE JOB-ID 1014_1  -------------------------------------------------------------------
Thanks a lot for your support.

Regards
Joerg Braendli
 
To pass it as a parameter, it has to be a substitution variable.

To assign a SQL value (like the current timestamp) to a substitution variable, you need to use the column command with a new_value clause.

This value can be passed to other scripts, where it can be picked up as &1.

Code:
column ts new_value curr_ts
select systimestamp as ts from dual;
@c:\temp\script1.sql "&curr_ts"
@c:\temp\script2.sql "&curr_ts"
 
Back
Top