Click here to Skip to main content
13,047,502 members (62,593 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi Friends,,


How to create a stored procedure in MySql which doesn't take any parameters.

I tried following code:


Create procedure loadGrid()
as
begin 
select *from custdetails
end 


but i m getting error..

Query : CREATE PROCEDURE custdetailLoad() BEGIN SELECT *FROM custdetail end
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000

please give me a solution
Posted 21-Jan-13 20:48pm
Updated 12-Apr-17 0:45am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Please try below code.
CREATE PROCEDURE loadGrid()
BEGIN
    SELECT * FROM custdetails;
END

Please read more about stored procedure using this LINK.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

This is how you do it

CREATE PROCEDURE [dbo].[loadGrid]
 
AS
BEGIN
      SELECT * FROM custdetails
 
END
GO
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

DELIMITER @@
create procedure usp_sum_of_sales(
IN pro_id int )
begin
select sum(Price) from Sales where Product_id =pro_id group by Product_id ;
end
 
call usp_sum_of_sales (200);
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 12 Apr 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100