Home Sql Mysql-example MySQL Area



MySQL Area
Posted on: February 16, 2005 at 12:00 AM
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);
sel




					ect @a;
Output
@a
---
200

 

Related Tags for MySQL Area:


More Tutorials from this section

Ask Questions?    Discuss: MySQL Area  

Post your Comment


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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.