Skip to content
Related Articles
Open in App
Not now

Related Articles

Sum Of Two Numbers in PL/SQL

Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 29 Dec, 2020
Improve Article
Save Article
Like Article

Prerequisite PL/SQL introduction
In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. 

In declare part, we declare variables and between begin and end part, we perform the operations.

Here, first, we take three variables x, y, and z and assign the value in x and y and after addition of both the numbers, we assign the resultant value to z and print z.


Input : 15 25
Output : 40
Input : 250 400
Output : 650

Below is the required implementation: 


-- declare variable x, y
-- and z of datatype number
x number(5);            
y number(5);           
z number(7);       
-- Here we Assigning 10 into x
-- Assigning 20 into x
-- Assigning sum of x and y into z
-- Print the Result
dbms_output.put_line('Sum is '||z);
-- Program End

Output : 

Sum is 30


My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!