rachayita jaiswal

rachayita jaiswal

  • NA
  • 217
  • 104.5k

MySql Stored Procedure

Jul 4 2013 11:39 PM
Hi, I am creating a stored procedure for Insert and Select data in MySql , my stored procedure is - 

DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `new_procedure`(_action varchar(10) ,File varchar(100))
BEGIN
if _action = 'INSERT' then
insert into tab_file (File) values (File);
end if;
if _action = 'select' then
select ID,File from tab_file; 
end if;
END 
With this stored procedure i am able to insert data but select query is not working.It is giving error like "Expected 2,got 1"
Please help me how to write stored procedure in mysql forselect, insert, update and delete scripts?
Thanks

Answers (11)