Define and call procedure : Procedure Definition « Store Procedure Function « Oracle PL / SQL

Oracle PL / SQL
1. Aggregate Functions
2. Analytical Functions
3. Char Functions
4. Constraints
5. Cursor
6. Data Type
7. Date Timezone
8. Hierarchical Query
9. Index
10. Insert Delete Update
11. Numeric Math Functions
12. Object Oriented Database
13. PL SQL
14. Regular Expressions
15. Report Column Page
16. Result Set
17. Select Query
18. Sequence
19. SQLPlus
20. Store Procedure Function
21. Subquery
22. System Tables
23. Table
24. Table Joins
25. Trigger
26. User Previliege
27. View
28. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Oracle PL / SQL » Store Procedure Function » Procedure Definition 
Define and call procedure


SQL>
SQL>
SQL> -- A procedure block.
SQL>
SQL>
SQL> -- Executing the swapn procedure.
SQL> -- Demonstration of a nested procedure block.
SQL>
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
  2     first_number    NUMBER;
  3     second_number   NUMBER;
  4
  5  PROCEDURE swapn (num_one IN OUT NUMBER, num_two IN OUT NUMBERIS
  6      temp_num    NUMBER;
  7  BEGIN
  8      temp_num := num_one;
  9      num_one := num_two;
 10      num_two := temp_num ;
 11  END;
 12
 13  BEGIN
 14
 15      first_number := 10;
 16     second_number := 20;
 17     DBMS_OUTPUT.PUT_LINE('First Number = ' || TO_CHAR (first_number));
 18     DBMS_OUTPUT.PUT_LINE('Second Number = ' || TO_CHAR (second_number));
 19
 20     -- Swap the values
 21     DBMS_OUTPUT.PUT_LINE('Swapping the two values now.');
 22     swapn(first_number, second_number);
 23
 24     -- Display the results
 25      DBMS_OUTPUT.PUT_LINE('First Number = ' || to_CHAR (first_number));
 26      DBMS_OUTPUT.PUT_LINE('Second Number = ' || to_CHAR (second_number));
 27  END;
 28  /
First Number = 10
Second Number = 20
Swapping the two values now.
First Number = 20
Second Number = 10

PL/SQL procedure successfully completed.

SQL>
SQL>

           
       
Related examples in the same category
1. Define procedure to insert data
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.