SunQuest
 
       Oracle
  Home arrow Oracle arrow Page 3 - Database Interaction with PL/SQL, Name...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ORACLE

Database Interaction with PL/SQL, Named Notations, Storing Procedures and Functions
By: Jagadish Chatarji
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    2005-09-06

    Table of Contents:
  • Database Interaction with PL/SQL, Named Notations, Storing Procedures and Functions
  • What are Parameter Default values?
  • What are STORED PROCEDURES?
  • What are STORED FUNCTIONS?
  • PACKAGE and PACKAGE BODY

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Database Interaction with PL/SQL, Named Notations, Storing Procedures and Functions - What are STORED PROCEDURES?


    (Page 3 of 5 )

    The procedures which get stored within the database can be called STORED PROCEDURES. In the past few articles, we worked with several procedures within the PL/SQL program. The PL/SQL program is automatically lost from memory once you close your SQL*Plus or iSQL*Plus (unless you save it in an SQL file). 

    Now we shall see how to store procedures in the database to make them STORED PROCEDURES. Let us consider the following program:

    create or replace procedure dispEmp as
      cursor c_emp is
       select ename, sal from emp;
     begin
      for r_emp in c_emp
      loop
       dbms_output.put_line(r_emp.ename || ',' || r_emp.sal); 
      end loop;
     end;

    Make sure that you are not actually executing the procedure in the above program. You are just asking the Oracle database to accept and store this new procedure ‘dispEmp’ into its database. That is why you will get a message along the lines of ‘Procedure successfully Created’. 

    The above created a procedure successfully inside the database. Now, how do we execute it? There exists a separate command ‘execute’ exclusively dedicated to executing stored procedures. The command to execute the above stored procedure would be the following:

    Execute dispEmp;

    This causes the stored procedure ‘dispEmp’ to be executed successfully.  Now, how do we execute the above stored procedure from another PL/SQL? The following shows how to do it.

    BEGIN
     dispEmp;
    END;

    That’s it. Very simple. There exist no declarations within the above PL/SQL program. The only issue is that we need to call an existing stored procedure. We need not use the command ‘Execute’ here, as it is an SQL command.

    Now wherever you carry your database, the STORED PROCEDURES also come along with the database!

    More Oracle Articles
    More By Jagadish Chatarji


       · Hello guys, this is my article on working with stored procedures and functions in...
     

       

    ORACLE ARTICLES

    - Tuning PL/SQL Code
    - Debugging PL/SQL Code
    - Testing PL/SQL Code
    - Working With PL/SQL Code
    - Conditional Compilation for Oracle Database ...
    - Compile-Time Warnings for Oracle DB 10g
    - Compiling PL/SQL Code for an Oracle Database
    - Troubleshooting PL/SQL Code
    - Managing PL/SQL Code
    - Data Manipulation and More for HTML DB Appli...
    - Oracle Database Fundamentals
    - Adding Processes to HTML DB Applications
    - Adding Computations, Processes, and Validati...
    - Sub-templates and More with Oracle HTML DB
    - Focusing on Templates in Oracle HTML DB





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway