Home » SQL & PL/SQL » SQL & PL/SQL » How to compile a PL/SQL code in Oracle 7.3 SQL prompt?
How to compile a PL/SQL code in Oracle 7.3 SQL prompt? [message #36597] Wed, 05 December 2001 20:56 Go to next message
Sandipta N Biswas
Messages: 7
Registered: December 2001
Junior Member
Please help me regarding how to compile and run a PL/SQL code in SQL prompt in Oracle 7.3 and windows98 environment.
please give an example also with every command.
Sandipta

----------------------------------------------------------------------
Re: How to compile a PL/SQL code in Oracle 7.3 SQL prompt? [message #36599 is a reply to message #36597] Wed, 05 December 2001 22:57 Go to previous messageGo to next message
Rob Baillie
Messages: 33
Registered: November 2001
Member
An example with every command...? Wow that'd take some time... instead I'll just give you a quick overview...

Compiling and running code in PL/SQL is simple...

try this example, type it straight into SQL-Plus

CREATE OR REPLACE PROCEDURE p_test
BEGIN
DBMS_OUTPUT.ENABLE;
DBMS_OUTPUT.PUT_LINE('Hello World');
END;
/

You should get...

Warning: Procedure created with compilation errors.

so, type

show error

and you should get:

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/1 PLS-00103: Encountered the symbol "BEGIN" when expecting one of
the following:
( ; is with as compress compiled wrapped

type

ed

and change the first line to

CREATE OR REPLACE PROCEDURE p_test IS

save and exit

type

/

You should get

Procedure created.

You can now run it with

exec p_test

Hurrah!

If you don't want to type your procedures into SQL Plus (like most sane people) you can use any old text editor, then run the code (I.E. attempt to compile the procedure / trigger / whatever) with

@drive:directory_structurefile_name

Any more questions... read the manual:

Yep, I know they're Oracle 8, but for most things they should be perfectly alright...
http://otn.oracle.com/doc/server.804/a53717/toc.htm
http://otn.oracle.com/doc/server.804/a53717/ch7.htm#@
http://otn.oracle.com/doc/server.804/a58241/toc.htm

----------------------------------------------------------------------
Re: How to compile a PL/SQL code in Oracle 7.3 SQL prompt? [message #36635 is a reply to message #36599] Thu, 06 December 2001 23:13 Go to previous message
Sandipta N Biswas
Messages: 7
Registered: December 2001
Junior Member
thanks Rob.
can u give an example with a cursor which will create a table first and then it will enter 4 rows.
please give the instruction for compilation and run the code.
best regards.
sandipta

----------------------------------------------------------------------
Previous Topic: how to insert the data
Next Topic: Re: About SQL Pl/SqL error messages
Goto Forum:
  


Current Time: Fri Mar 29 07:11:48 CDT 2024