Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Shel Script
Alternatively, try something like the below in your shell script:
sqlplus -s / <<EOFora7
REM Add SQL statements here
...
REM Don't forget to escape $s
select * from v\$database;
...
exit;
EOFora7
That way you don't need to worry about maintaining a shell script & a number of SQL scripts. Note however that if you are using any "$" in your script you'll have the escape them so as to prevent the shell script parser from interpreting the $s as shell variables.
Get it?
In article <33D8C5A8.32DA_at_trw.com>, Martin Bronstein
<Martin.Bronstein_at_trw.com> writes
>RISHI ANAND wrote:
>>
>> Hello All,
>>
>> Just had a question, as to how could we write a shell script in UNIX, if
>> I wanted to execute SQL commands by simply running them within the shell
>> script? (It could be any shell, c, korn,...etc..) I tried using the
>> script with "sqlplus/ but it just gets stuck at the sqlplus prompt and
>> waits for me to input some SQL commands....I think I must be missing
>> something....any idea...?
>>
>> Please let me know..
>>
>> Thanks in advance.
>>
>> --
>> --Rishi
>>
>> ## Never let your sense of morals prevent you from doing what is right. ##
>>
>> -- Salvor Hardin, "Foundation".
>
>SQLPLUS username/password @comfile
>where comfile is a file of your SQL*Plus commands.
>
>Martin Bronstein
-- Bola OgunlanaReceived on Sun Jul 27 1997 - 00:00:00 CDT
![]() |
![]() |