![]() |
Subprograms![]() ![]() ![]() ![]() ![]()
The PL/SQL programs can be stored in the database as stored programs and can be invoked whenever required. This avoids repassing when multiple users invoke it. This also provides security and integrity control by allowing access on the sub program and not on the database objects directly. Actually subprograms are named PL/SQL blocks that can take parameters and be invoked.
A function is a subprogram that computes a value. It differs from procedure as function returns a value. The syntax is
FUNCTION name [(argument [,argument...]) ]
FUNCTIONAL SAL_OK (SALARY REAL, TITLE REAL) Return statement A RETURN statement immediately completes the execution of subprogram and returns control to the caller. A subprogram can contain several. return statement. Executing any one of them completes the program.
FUNCTION BALANCE (ACCT_ID INTEGER) Although the formal parameter list appears in the forward declaration, it must also appear in the subprogram body. The subprogram body can be placed anywhere after the forward declaration, but they must appear in the same block, subprograms, or package. Parameter Modes There are three parameter modes IN, IN OUT, OUT. Avoid out and inout modes. IN: An IN parameter lets you pass values to the subprogram being called. Inside the subprogram, an IN parameter acts like a constant. Thus value cannot be assigned to it. The actual parameter that corresponds to an IN formal parameter can be a constant, literal, initialized variable, or expression. OUT: The OUT parameter lets you returns value to the caller of a subprogram being called. Inside the Subprogram, an OUT parameter acts like an uninitialised variable. Therefore, its value cannot be assigned to another variable or reassigned to itself. The actual parameter that corresponds to an OUT formal parameter must be a variable. IN OUT: The INOUT parameter lets you pass initial values to the subprogram being called an, return updated values to the caller. Inside the subprogram, an IN OUT parameter acts like an initialized variable. Therefore, it can be assigned a value and its value can be assigned to another variable.
|
|
Domain NamesSQL Database Management Systems Relational Database Management System Properties of RDBMS Client Server Computing Oracle Relational Database Database Structure and Space Management SQL Data Types How to Use Data Types? What is Operators and Conditions Character OperatorsOperator Precedence Data Retrieval Using SQL Plus SQL Data Definitions Data Retrieval Using Select SQL Operator Precedence Selecting Rows and Columns The Group by Clause
Having Clause Union, Union all, Intersact and Minus Commands Playing with Numbers Date Functions Example of Date Arithmetic Working with Null Values
Joining Tables and Subqueries Views Synonyms Indexes Clusters Sequences Formatting Query Results with SQL Plus Data Integrity The Optimizer How Oracle Optimizes SQL Statements Evaluating Expression and ConditionsOptimization Hints PL-SQL PL-SQL Architecture Error Reporting Functions Character Functions Composite Data Types PL-SQL Structures How to use PL-SQL Structures Normalization Operator Precedence Cursor Error Handling Database Triggers Types of Triggers Locking Sub Programs Packages New and Improved Data Types Improved Select Statement Advanced Quering Improved Scalability Improved Performance Via Partitioning Object Relational Features Heterogeneous Data Access Improved Security Administration New Data Types Improved Select Statement Changes to the Select Statement Improved Scalability Data Partitioning Oriented Toward Objects Character Functions Creating Object Types Created Nested Tables Oracle8 and Distributed Database Oracle8 Database Management and Security Distributed Database Invoking Export Invoking ImportWeb DesignWeb HostingE Commerce |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |