Re: PL\SQL Question

From: Mark Styles <marks_at_sensible.teleord.co.uk>
Date: 1996/04/10
Message-ID: <4kfs7r$ju4_at_sensible.teleord.co.uk>#1/1


patrick tan t.s. <patrick_at_solarwind.sps.mot.com> wrote:
>PL/SQL is built into SQL*Plus. You can edit using vi editor,
>and save the file. Then go to the directory which the file
>resides in. Do a _at_scriptFileName and you're done.
>
>"Dewey G. Miller" <gdcwskc_at_iup.edu> wrote:
>> I have written my code. I have been trying for 2 days to get it to run
>> interactively from SQL*PLUS. I am not having much luck at all. Is there
>> a way to run PL\SQL from SQL*PLUS. I would like to be able to type the
>> script in one line at a time at the SQL*PLUS prompt....
>>
>> Ultimately, this script will run in batch. Is there a good way to do
>> this from a Korn Shell Script??

Remember to put a / on the line after your PL/SQL block so that SQL*Plus knows to execute it, otherwise it will just sit there waiting for more input, i.e:

BEGIN
  . . .
  . . .
END;
/

To run your code from a ksh script, you can either have your code in a separate sql script, and call it in your ksh script like:

#!/bin/ksh

sqlplus -s user/password _at_your_sql_file

or you can have everything in one file by doing something like:

#!/bin/ksh

sqlplus -s user/password << SQLEND
BEGIN
  . . .
  . . .
END;
/
SQLEND

-- 
** Mark Styles aka Small       -- Opinions expressed here are my own --   **
** marks_at_teleord.co.uk         -- unless otherwise specified         --   **
**           This whole world's wild at heart and weird on top            **
Received on Wed Apr 10 1996 - 00:00:00 CEST

Original text of this message