Results 1 to 2 of 2

Thread: Sqlplus shell script to read values in variables

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Sqlplus shell script to read values in variables

    hey , i am using this piece of code to connect to database and execute query and then storing the result of that query in a value . after that i am again using that value in
    other other select statement of mine but it is not working.

    Code:
    #!/bin/bash -xv
    val_1=$( sqlplus -s rte/rted1@rel75d1 << EOF
    setting heading off
    select max(istat_id) from cvt_istats;
    exit
    EOF
    )
    echo "val_1: $val_1"
    nohup ./cvt -f MediationSources.xml &
    sleep 60
    val_2=$( sqlplus -s rte/rted1@rel75d1 << EOF
    setting heading off
    select source_id from cvt_istats where istat_id > $val_1;
    exit
    EOF
    )
    echo "val_2: $val_2"

    please help
    thanks

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    458
    Thanks
    0
    Thanked 62 Times in 58 Posts
    Rep Power
    10

    Default

    hi,

    could you tell us how it doesn't work, please?

    could val_1 be more than one word? if so, then it should be between quotes.
    A problem clearly stated is a problem half solved.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 4th December 2011, 10:12 PM
  2. sqlplus not saving values
    By nanaeel in forum Shell scripting
    Replies: 1
    Last Post: 29th January 2011, 11:35 AM
  3. Replies: 1
    Last Post: 14th December 2010, 08:19 AM
  4. How to read multiple values at a time from a file..
    By kumarat9pm in forum Shell scripting
    Replies: 3
    Last Post: 27th March 2010, 04:12 AM
  5. How can I Update the XML Tag Values using Shell Script
    By Mithun_Kamath in forum Shell scripting
    Replies: 1
    Last Post: 25th January 2007, 12:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •