Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

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.

Ads

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

Share on Google+Share on Google+

MySQL Area

Posted on: February 16, 2005 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: MySQL Area  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads