Home Sql Mysql-example MySQL Area
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

MySQL Area

Advertisement
This example illustrates how to find the area of rectangle in MySQL. In this example we create a procedure to find the area of rectangle.

MySQL Area

     

This example illustrates how to find the area of rectangle in MySQL.

In this example we create a procedure to find the area of rectangle. In the query below we take two double type variable l and b to be used as input to the procedure and one variable "a" to be used as an output from the procedure. Create the procedure and call it by providing appropriate parameters to display the area of the rectangle.

 

 

 

 

Create Stored Procedure:

Query

 

delimiter //
create procedure rect_area (in l double, in b double, out a double)
begin
set a = l * b;
end
//
delimiter ;

Run Procedure to calculate area: You can run MySQL stored procedure by using the call method.

Query
call rect_area(10, 20, @a);
select @a;
Output
@a
---
200

 

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 16, 2005

Ask Questions?    Discuss: MySQL Area  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com