Simple way to create Oracle stored procedures (rookie level)

Source: Internet
Author: User
Tags count end sql
oracle| Create | Stored procedures
Connect to: Oracle9i Enterprise Edition release 9.2.0.1.0-productionwith The partitioning, OLAP and Oracle Data Mining Optionsjs Erver Release 9.2.0.1.0-production

sql> Create or Replace procedure Get_news (2 aid in Varchar2,atitle at VARCHAR2) 3 as 4 begin 5 SELECT * from C  F_news 6 end; 7/

Warning: A procedure created with a compile error.

sql> Create or Replace procedure Get_news (2 aid in varchar2, Atitle in VARCHAR2) 3 as 4 beging 5/

Warning: A procedure created with a compile 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: A procedure created with a compile error.

sql> Create or Replace procedure Get_news 2 as 3 begin 4 SELECT * from Cf_news;  5 end; 6/

Warning: A procedure created with a compile error.

Sql> Show errors; PROCEDURE get_news Error occurred:

Line/col ERROR-------------------------------------------------------------------------4/1 PLS-00428: In this SELECT statement  Missing into clause sql> Create or replace procedure Get_news 2 as 3 AA number;  4 Begin 5 Select COUNT (*) into a AA from cf_news;  6 end; 7/

Procedure has been created.

sql> Create or Replace procedure Get_news 2 as 3 AA number;  4 Begin 5 Select COUNT (*) into a AA from cf_news; 6 dbms_outpub.put_line (' Aa= ' | |  AA);  7 End; 8/

Warning: A procedure created with a compile error.

Sql> Show errors; PROCEDURE get_news Error occurred:

Line/col ERROR-------------------------------------------------------------------------6/1 PLS-00201: must indicate identifier ' Dbms_outpub.  Put_Line ' 6/1 pl/sql:statement ignoredsql> Create or replace procedure Get_news 2 as 3 AA number;  4 Begin 5 Select COUNT (*) into a AA from cf_news; 6 dbms_output.put_line (' Aa= ' | |  AA);  7 End; 8/

Procedure has been created.

Sql> set serverout on; Sql> Execute Get_news;aa=3

The PL/SQL process has completed successfully.


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.