MySQL Forums
Forum List  »  Stored Procedures

Procedure with multiple selects and one update
Posted by: Jorgen Hoffmeister
Date: January 04, 2006 04:26PM

Why dows this procedure not work. Isn't it possible to make multiple selects to variables and then update an table

My procedure is as follow.


CREATE PROCEDURE `UpdateServerStats`()
NOT DETERMINISTIC
SQL SECURITY DEFINER
COMMENT ''
BEGIN

Declare Statscount Bigint;
Declare Forensicscount Bigint;
Declare AlertClosed Bigint;
Declare AlertCreated Bigint;
Declare Alertcount Bigint;

select count(timecollected) from srcdststats where timecollected between 1133391600 and 1133477999 into Statscount;
select count(timecollected) from srcdstforensics where timecollected between 1133391600 and 1133477999 into Forensicscount;
Select count(timeresolved) from alerts where timeresolved between 1133391600 and 1133477999 and resolution = 255 into AlertClosed;
Select count(timecreated) from alerts where timecreated between 1133391600 and 1133477999 into AlertCreated;
Select count(timecreated) from alerts where resolution < 250 into Alertcount;

update statisticstoday set Alertstoday = Alertcount, ClosedAlertsToday = AlertClosed, OpenAlerts = AlertCreated, StatsToday = Statscount, ForensicsToday = Forensicscount;

END;


Regards Jorgen Hoffmeister

Options: ReplyQuote


Subject
Views
Written By
Posted
Procedure with multiple selects and one update
2092
January 04, 2006 04:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.