while loop plsql

PL SQL WHILE LOOP: The pl sql while loop repeatedly executes a block of statements until a particular condition is true. It first check the condition and executes a block of statements if condition is true. PL SQL WHILE LOOP syntax: WHILE condition LOOP //block of statements; END LOOP; PL SQL WHILE LOOP example: DECLARE … Read more

exit loop plsql

Pl sql exit loop: The pl sql loop repeatedly executes a block of statements until it reaches a loop exit. The EXIT and EXIT WHEN statements are used to terminate a loop. Where: EXIT: The EXIT statement is used to terminate the loop unconditionally and normally used with IF statement. EXIT WHEN: The EXIT WHEN … Read more

switch plsql

PL/SQL Case Statement: Switch statement is used to execute a block of statement based on the switch expression value. An expression must be of type int, short, byte or char. A case value should be a constant literal value and cannot be duplicated. Expression value is compared with each case value. If a match found … Read more

if else plsql

PL/SQL If statement: If statement is used to execute a block of statements if specified condition is true. Commonly used PL/SQL If statement: IF-THEN statement: Syntax: IF condition THEN //Block of statements1 END IF; Block of statements1 executes when the specified condition is true. IF-THEN-ELSE statement: Syntax: IF condition THEN //Block of statements1 ELSE //Block … Read more

Hello world plsql

pl sql hello world program: DECLARE — variable declaration message varchar2(20):= ‘Hello World!’; BEGIN –output dbms_output.put_line(message); END; / Output: Hello World!  

Constants and literals in plsq

PL/SQL Constants: A constant holds a value used in a PL/SQL block that does not change throughout the program. It is a user-defined literal value. Syntax to declare a constant: constant_name CONSTANT datatype := VALUE; Where: constant_name – is a valid identifier name. CONSTANT – is a keyword. VALUE – is a value which must … Read more

Variables in plsql

Variable: Variable is the name of reserved memory location. Each variable has a specific data type which determines the range of values and set of operations for that variable. PL/SQL variables naming rules: A variable name can’t contain more than 30 characters. A variable name must start with an ASCII letter followed by any number, … Read more