Here’s a simple PL/SQL program
• This program adds two variables and prints the total
• –Three sections are demonstrated in this program with indentations for clarity
•
• DECLARE
• Var1 number := 35;
• Var2 number := 60;
• –Var3 will be used to save the result
• var3 number;
• BEGIN
• Var3 := var1 + var2;
• DBMS_OUTPUT.PUT_LINE(‘ The result of addition is ‘);
• dbms_output.put_line( var3 );
• End;
Arithmetic Operators Used in Statements
| ** | Exponentiation | 2 ** 3 | 8 |
| * | Multiplication | 2 * 3 | 6 |
| / | Division | 9/2 | 4.5 |
| + | Addition | 3 + 2 | 5 |
| - | Subtraction | 3 – 2 | 1 |
| - | Negation | -5 | Negative 5 |
Filed under:
PL/SQL
Leave a comment