![]() |
PL/SQL Structures![]() ![]() ![]() ![]() ![]()
Using SQL statements, we can retrieve or manipulate data present in a table. Using SQL statements above it is not possible to gain the power of procedural language constructs. This aspect has been taken care of by PL/SQL, which is of a procedural extension of SQL. • PL/SQL block can contain DML & DCL statements, but not DDL statements - but not DDL statements. • PL/SQL block can also contain any number of SQL statements integrated with flow of control statements. Using PL/SQL we can also trap runtime errors. What are PL/SQL Structures? With PL/SQL, You can use SQL statements to manipulate Oracle data and flow control statements to process data to meet all your requirements. PL/SQL combines the data manipulating power of SQL with the data-processing power of procedural languages. PL/SQL provides many different structures to control the flow of your statement execution and data handling. These structures include the following:
Cursors
Why use PL/SQL Structures? Control structures are the most important PL/SQL extensions to SQL. Not only does PL/SQL let you manipulate data, it lets you process the data using conditional, iterative, sequential, and unconditional flow-control statements such as if-then-else, for-loop, while-loop,exit-when,and goto. How to use PL/SQL Structures?
Control Structures Conditional control The IF statement lets you execute a: series of statements conditionally. There are three forms IF-THEN, IF-THEN-ELSE, and IF-THEN-ELSIF. If-Then IF associates a condition with a sequence of statements enclosed by the keywords THEN and END IF. The statements are executed only when the condition is TRUE.
IF condition THEN Example:
IF Sales > Quata THEN If-Then-Else The second form of IF statements adds the keyword ELSE followed by alternative sequence of statements. The sequence of statements in the ELSE clause will be executed only when the condition evaluates to FALSE.
IF condition THEN Example:
IF trans_type = 'CR' THEN
UPDATE accounts SET balance balance + credit WHERE.... If-Then-Elsif The third form introduces the keyword ELSIF to introduce additional conditions. If any condition evaluates to TRUE then that sequence of statements get executed. We can have any number of ELSIF clause but the last one is optional.
If condition1THEN
|
|
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. |