• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1015
  • Last Modified:

Unix Korn Shell, dynamic creation of parfile using to_date('$var','dd-mon-yy')

Problem:

need to dynamically create exp parfile

1.  seed load.par to target parfile:  gl_bal_je_hdr_lin.par

cat load.par > gl_bal_je_hdr_lin.par

2.  populate command line argument, $start_date, into parfile query string
fyi.  export var2=\"

echo query = $var2 'where period_name in
(select period_name
 from gl_periods
 where
start_date >= to_date($start_date,DD-MON-YY)) ' $var2  >> gl_bal_je_hdr_lin.par

3.  problem is the output of above statement is this:

statistics=none    
consistent=y
grants=n
RECORDLENGTH=64000
BUFFER=2000000
query = " where period_name in
(select period_name
 from gl_periods
 where
start_date >= to_date(01-AUG-03,DD-MON-YY))  "

4.  the solution for the target parfile needs to have single quotes such as this:

start_date >= to_date('01-AUG-03','DD-MON-YY'))

5. TASK:  correct output in step 3, to include single quotes as identified in stop 4.
 
0
ORACLEtune
Asked:
ORACLEtune
1 Solution
 
ishandoCommented:
try :

echo "query = \" where period_name in
(select period_name
 from gl_periods
 where
start_date >= to_date('$start_date','DD-MON-YY')) /" "  >> gl_bal_je_hdr_lin.par
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now