Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    92

    Unanswered: concatenating the sql query output

    Hi Everyone.,


    i have a sql sub query which returns a path and the file name. the sql query is called from a shell script ( korn shell). the output is written to a log file.

    the sql query result will be as:

    path filename

    /home/mark/testdata xyz
    /home/mark/testdata/test abc
    /home/AL/testdata stz


    when i run the script i see the result in the log file as shown above.

    but my requirement is that the result in the log file should appear as:

    /home/mark/testdata/xyz
    /home/mark/testdata/test/abc
    /home/AL/testdata/stz

    it means that in the log file i want to see the result as shown above i.e "path" and "filename" concatenated with " / "

    can anyone help me please !!!

    thanks

  2. #2
    Join Date
    Oct 2005
    Posts
    92

    concatenating the sql query output

    Hi All.,

    my current ksh script looks like this:

    #!/bin/ksh


    logfile=/home/ssk

    sqlplus -s username/password@remoteserver << EOF > errors1.log


    select DIRECTORY_NM, FILE_NM FROM FILE_CONTROL;
    EOF

    if [ $? -eq 0 ]
    then
    echo "\n SQL completed successfully at `date`"
    else
    echo "!!! FAILED!!!"
    echo "Details can be found in errors.log File"
    fi

    ~

    can anyone help me how do i change the above script to get the above required result.

    thanks

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    select DIRECTORY_NM||'/'||FILE_NM FROM FILE_CONTROL;
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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