Garayed.com  

Go Back   Garayed.com > Oracle
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-14-2007, 03:01 PM
William Robertson
 
Posts: n/a
Default Re: call sql oracle 8.i with unix script fails

On Jan 12, 6:45 pm, "Ed Yin" <vraa...@hotmail.nl> wrote:
> hello,
>
> maybe someone can help me out on this script it will only execute 1 sql
> statement depending on what file_name what is wrong with what i am trying to
> do?
>
> i try to call a sql like this depending on interface type
>
> this shell is called rim started like this ./rim POR AL where POR
> is type en AL = $2 file name in this test
>
> $1=INTTYPE
> file_name='test.por'
> typeO=ORD
> typeP=POR
>
> if $1=$typeO
> then
> sqlplus -s / @ord_controle.sql $2 $file_name <<F /
> echo processing $typeO $1 $sql1 $file_name
> else $1=$typeP
> sqlplus -s / @por_controle.sql $2 $file_name <<F /
> echo processing $typeP $1 $sql2 $file_name
> show errors;
> F
> fi
> exit 0
>
> thanks Ed


You check a variable's value like this (assuming sh/ksh/bash i.e. not
csh)

if [[ $1 = $typeO ]]

A here-document is defined like this:

sqlplus -s / <<END_SQL
prompt Connected to SQL*Plus
prompt HOME = $HOME
prompt Exiting SQL*Plus...
exit
END_SQL

The terminating token ("END_SQL" in my example) has to match the whole
line, so no leading or trailing whitespace or any other characters. You
can extend this to allow leading tabs (not spaces) by placing a dash
immediately before it in the opening line, i.e.

sqlplus -s / <<-END_SQL

It is valid to call a SQL*Plus script on the command line although like
Ana I don't recall seeing anyone do this. The specified script would be
called first, then any other commands in the here-document.

It seems you have two alternative sqlplus command lines and your shell
script is attempting to execute one or the other (or both?). However
the only difference between them seems to be the name of the script
file. An obvious simplification would be to put that in a variable and
call just one command line.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:06 PM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.