The actual application proportion of the Oracle stored procedure is still the majority. If you are curious about the simple method of creating the stored procedure in Oracle, the following articles will unveil its mysteries. I hope it will help you in this regard.
Connect:
- Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
- With the Partitioning, OLAP and Oracle Data Mining options
- JServer Release 9.2.0.1.0 - Production
- SQL> create or replace procedure get_news(
- 2 aid in varchar2,atitle in varchar2)
- 3 as
- 4 begin
- 5 select * from cf_news
- 6 end;
- 7 /
Warning: the creation process has a compilation error.
- SQL> create or replace procedure get_news(
- 2 aid in varchar2 ,atitle in varchar2)
- 3 as
- 4 beging
- 5 /
Warning: the creation process has a compilation error.
- SQL> create or replace procedure get_news(
- 2 aid in varchar2)
- 3 as
- 4 begin
- 5 select * from cf_news;
- 6 end;
- 7 /
Warning: the creation process has a compilation error.
- SQL> create or replace procedure get_news
- 2 as
- 3 begin
- 4 select * from cf_news;
- 5 end;
- 6 /
Warning a compilation error occurs during Oracle storage creation.
PROCEDURE GET_NEWS error:
- LINE/COL ERROR
4/1 PLS-00428: The INTO clause is missing in this SELECT statement
- SQL> create or replace procedure get_news
- 2 as
- 3 aa number;
- 4 begin
- 5 select count(*) into aa from cf_news;
- 6 end;
- 7 /
The process has been created.
- SQL> create or replace procedure get_news
- 2 as
- 3 aa number;
- 4 begin
- 5 select count(*) into aa from cf_news;
- 6 dbms_outpub.put_line('aa='||aa);
- 7 end;
- 8 /
Warning: the creation process has a compilation error.
- SQL> show errors;
PROCEDURE GET_NEWS error:
- LINE/COL ERROR
6/1 PLS-00201: The identifier 'dbms _ OUTPUB. PUT_LINE 'must be specified'
- 6/1 PL/SQL: Statement ignored
- SQL> create or replace procedure get_news
- 2 as
- 3 aa number;
- 4 begin
- 5 select count(*) into aa from cf_news;
- 6 dbms_output.put_line('aa='||aa);
- 7 end;
- 8 /
Process created
- SQL> set serverout on;
- SQL> execute get_news;
- aa=3
The PL/SQL process is successfully completed. The above content is a simple description of the method used to create a stored procedure in Oracle. I hope it will help you in this regard.