Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007

    Unanswered: reading from csv file and use the data in stored procedure

    Hi All
    I am trying to accomplish the following tasks

    1. use shell script to read the first column of data in csv file
    2. pass the data to a sybase stored procedure using shell script
    3. in the stored procedure, I would have a "select" SQL statement (i.e select * from db where id in (1234,2345,....))

    1234,2345... are data from the first column of the csv file.

    Can someone give me some example/advice on how to go about solving this problem?

    Thanks in advance for your help

  2. #2
    Join Date
    Sep 2003
    You are better off googling for such stuff or look at existing programs. Theres a wealth of info on scripting.

    Anyways... something to start with for you. Hope it helps.

    for myvar in `cat my.txt` | cut -f1 -d','`
    finallist=`echo $finallist','$myvar

    #The above will take all the first fields in the csv related file and concatenate it to finallist.

    isql -U...... << EOF
    exec myproc $finallist

Posting Permissions

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