Advertisement

02.29.2008 at 02:48AM PST, ID: 23203318
[x]
Attachment Details

writing a mysql stored procedure

Asked by niidmore in MySQL, SQL Query Syntax

Tags: MySQL

Hello Guys,

I want to write a MySQL stored procedure which returns OK message, if all went well.
I have to do quite a few data manipulations before starting my script. In the snippet below I have shown you as an example, the procedure should return some message or value back if all the statements passes. perhaps 1 for ok 0 to say there is something wrong.

Could you please assist me in making it right,

Regards
Sam
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
DELIMITER $$
 
DROP PROCEDURE IF EXISTS `mysql`.`sp_data_update` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_data_update`()
BEGIN
	
	INSERT INTO Temp SELECT (id,price,title) FROM prodcut;
	
	UPDATE table2, table1
		  SET table2.title = table1.title
		  , table2.date = table1.disp_date
		  , table2.action = table1.action
	WHERE tabel1.id = table2.id	
 
	update temp set price = 0 where price =''
 
END $$
 
DELIMITER ;
[+][-]02.29.2008 at 03:50AM PST, ID: 21012462

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 04:52AM PST, ID: 21012713

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 05:41AM PST, ID: 21013034

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 06:37AM PST, ID: 21013522

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 07:15AM PST, ID: 21013909

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MySQL, SQL Query Syntax
Tags: MySQL
Sign Up Now!
Solution Provided By: Nellios
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02.29.2008 at 07:39AM PST, ID: 21014152

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.29.2008 at 08:00AM PST, ID: 21014402

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.01.2008 at 12:41PM PST, ID: 21023428

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628