Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Novice: Loading Stored Procedure
On 22 Apr 2003 10:02:54 -0700, gilgantic_at_yahoo.com (gilgantic) wrote:
>How do you load a Stored Procedure into the Oracle environment? Currently, the
>only way I go about doing this is copy/paste my PL/SQL code from a text file
>into the SQLPLUS prompts. From my basic Oracle knowledge, I thought there was
>a way for Oracle to load up an <file>.sql into it the environment. Then I
>could run "EXECUTE <procedure name>" from a command line and/or UNIX script.
>
>Thanks!
>Gil
In your .sql file, put CREATE OR REPLACE PROCEDURE ... statements instead of just BEGIN ... END blocks. Also CREATE OR REPLACE FUNCTION ... You'll still need to execute the procedures from SQL*Plus. If you have a Unix script, the script will need to call SQL*Plus and redirect or pipe the relevant commands to it.
When you get a bunch of interrelated procedures and functions, you'll want to look into the CREATE PACKAGE statement.
John
-- Photo gallery: http://www.pbase.com/john_russell/Received on Tue Apr 29 2003 - 23:05:53 CDT