Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label PL/SQL Basics. Show all posts
Showing posts with label PL/SQL Basics. Show all posts

Friday 23 March 2018

PL/SQL Basic Exit Loop


In PL/SQL Basic Loop all statements inside the block are executed at least once before loop termination, Basic loop encloses statement between LOOP and END LOOP and there must be an EXIT or EXIT-WHEN condition to terminate the loop

The syntax of Basic Exit loop is like this

LOOP

statements to execute

EXIT; or EXIT-WHEN

END LOOP;

See these examples for better understanding

Friday 9 March 2018

PL/SQL Variables and Constants


A variable in any programming language is the name of space where values are stored and controlled by our code/program

  • We can not use reserve keyword as a variable name 
  • Variable length should not exceed 30 characters
  • The variable name consists of letters followed by other letters, dollar sign, underscore and numerals
  • The variable name should be clear and easy to understand

Here we'll learn how to declare and initialize variables in PL/SQL

The basic syntax for declaring a variable in PL/SQL is following

variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT initial_value] 

Here variable_name is the identifier of variable and datatype is a valid PL/SQL datatype. CONSTANT and DEFAULT are keywords used to define constants and set default values of variables

Wednesday 7 March 2018

PL/SQL Basic Syntax, Block Structure and Anonymous block


PL/SQL is highly structured language and it's program units are written in the block of code, In this tutorial, we'll learn about basic syntax and the block structure of PL/SQL

A piece of code that is organized in a properly defined sequence is called a Block. A PL/SQL Block consists of 3 parts

DECLARE
<<declaration >>
--Declare Variables,Constants, Cursors and all elements

BEGIN
<<executable statements>>
--SQL, PL/SQL Commands 

EXCEPTION
<<exception handling>>
--Code to handle the exception

END;

Tuesday 6 March 2018

PL/SQL Tutorial - What is PL/SQL, Features and Advantages of PL/SQL


PL/SQL is developed by Oracle Corporation to increase/enhance capabilities of SQL, PL/SQL stands for Procedural Language extension to SQL . PL/SQL is highly structured and expressive language and because of its expressive syntax it is very easy to understand and learn

PL/SQL is integrated with Oracle Database and can be called from any other programming language. It is tightly integrated with SQL so it's easy to learn PL/SQL if you have knowledge of SQL