Solved

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

Posted on 2004-10-25
993 Views
Last Modified: 2012-05-05
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
Question by:ORACLEtune
    1 Comment
     
    LVL 15

    Accepted Solution

    by:
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
    I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now