Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Exclamation Unanswered: How to do an update in Informix DB by using a value from a korn shell

    Hi,

    i've written korn shell script. But when i try to do an update to Informix db in the same shell script, the value in the shell script is not getting passed onto the update command.Find my script below:

    #!/usr/bin/ksh
    INFORMIXDIR=xxxxxxx; export INFORMIXDIR
    INFORMIXSERVER=xxxxxxx; export INFORMIXSERVER
    ONCONFIG=xxxxxxxxxxx; export ONCONFIG
    PATH=xxxxxxxxxx; export PATH

    while read line
    do
    field1=`echo $line | cut -d',' -f1`
    value=$field1
    echo 'update table set typ1="ABC AB A/B" where type2="$value"' | dbaccess dbc

    done < "$1"



    here i am passing a .csv file as command line argument which contains values like A ABCD ABCD A1,ABC AB A/B
    B BCAD BCAD B2,ABC AB A/B


    i am cutting the first part of the line using comma(,) as delimiter and saving it in a variable. but when i pass that variable to update command, the table is not getting updated.

    Could you please help me solve this.

  2. #2
    Join Date
    Nov 2008
    Posts
    65
    Provided Answers: 1
    you shozld write:

    echo 'update table set typ1="ABC AB A/B" where type2="'$value'"'

    notice single quotes arround $value

  3. #3
    Join Date
    Nov 2010
    Posts
    2

    How to do an update in Informix DB by using a value from a korn shell

    Thanks a lot ibm.ids. that worked

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
  •