Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Unanswered: Connection with oracle database

    Hi ,
    Need to connect to sqlplus through unix.
    Please suggest .

  2. #2
    Join Date
    Nov 2003
    Posts
    2,934
    Provided Answers: 12
    If everything else fails, read the instructions: http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_three.htm
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  3. #3
    Join Date
    Sep 2012
    Posts
    2
    Thanks.......

  4. #4
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    This is an example of using sqlplus in a shell script(ksh), the shell script function is called to update a report status when the report fails, the variable(pkey) is a global variable defined/populated in another part of the script:
    Code:
    request_failed ()
    {
    update_results=`sqlplus -s user/pass@instance << ENDSQL
    set linesize 500 heading off feedback off
    whenever sqlerror exit 1
    update schema.table
      set  crt_date  =  null,
           url       =  null,
           status    =  99
    where  rowid     =  '${pkey}';
    commit;
    exit 0
    ENDSQL`
    if [[ $? = 1 ]] then
      (( error_count+=1 ))
      ts=`date "+%Y-%m-%d-%H.%M.%S"`
      print "`echo "$update_results" | sed 's/^[ \t\n]*/'$ts' /'`" >> ${LOG}
      print `date "+%Y-%m-%d-%H.%M.%S"` "**The above error occurred in function(request_failed) updating report_status row to denote unsuccessful run: rowid-${pkey}" >> ${LOG}
    fi
    return
    }

    hth

Posting Permissions

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