The most effective method for creating stored procedures in Oracle

Source: Internet
Author: User

The following articles mainly describe the simple methods for creating stored procedures related to Oracle, including warnings of compilation errors inherent in the creation process of Oracle, and the Oracle creation process contains the compilation errors and other related content.

Connect:

 
 
  1. Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production  
  2. With the Partitioning, OLAP and Oracle Data Mining options  
  3. JServer Release 9.2.0.1.0 - Production  
  4. SQL> create or replace procedure get_news(  
  5. aid in varchar2,atitle in varchar2)  
  6. as  
  7. begin  
  8. select * from cf_news  
  9. end;  

Warning the Oracle creation process has a compilation error.

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. SQL> create or replace procedure get_news  
  2. 2 as  
  3. 3 begin  
  4. 4 select * from cf_news;  
  5. 5 end;  
  6. 6 / 

Warning compilation errors occurred during Oracle Creation

 
 
  1. SQL> show errors; 

PROCEDURE GET_NEWS error:

 
 
  1. LINE/COL ERROR 

4/1 PLS-00428: The INTO clause is missing in this SELECT statement

 
 
  1. SQL> create or replace procedure get_news  
  2. 2 as  
  3. 3 aa number;  
  4. 4 begin  
  5. 5 select count(*) into aa from cf_news;  
  6. 6 end;  
  7. 7 / 

The process has been created.

 
 
  1. SQL> create or replace procedure get_news  
  2. 2 as  
  3. 3 aa number;  
  4. 4 begin  
  5. 5 select count(*) into aa from cf_news;  
  6. 6 dbms_outpub.put_line('aa='||aa);  
  7. 7 end;  
  8. 8 / 

Warning: the creation process has a compilation error.

 
 
  1. SQL> show errors; 

PROCEDURE GET_NEWS error:

 
 
  1. LINE/COL ERROR 

6/1 PLS-00201: The identifier 'dbms _ OUTPUB. PUT_LINE 'must be specified'

6/1 PL/SQL: Statement ignored

 
 
  1. SQL> create or replace procedure get_news  
  2. 2 as  
  3. 3 aa number;  
  4. 4 begin  
  5. 5 select count(*) into aa from cf_news;  
  6. 6 dbms_output.put_line('aa='||aa);  
  7. 7 end;  
  8. 8 / 

The process has been created in Oracle.

 
 
  1. SQL> set serverout on;  
  2. SQL> execute get_news;  
  3. aa=3 

The PL/SQL process is successfully completed.

Article by: http://www.programbbs.com/doc/class10-2.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.