AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mysql - transaction e stored procedures

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
OldFriend
Guest





PostPosted: Tue Nov 21, 2006 8:10 pm    Post subject: mysql - transaction e stored procedures Reply with quote



ciao a tutti..sto usando la versione 5.0.21-community-nt(ricopiato
fedelmente da prompt) di mysql e naturalmente non riesco ad usare le
transaction o le stored procedures.

1) - transaction : ho già letto che le tabelle myIsam non le
supportano ed infatti non ci sono errori ma se faccio una select...for
update(che dovrebbe bloccarmi in lettura le righe selezionate non
blocca proprio niente), quindi dove trovo della documentazione sulle
innoDB?

2) - stored procedures : qui non riesco proprio a crearne una dopo aver
letto un po di documentazione in giro.Ecco un tentativo non riuscito >>

DELIMITER //
CREATE PROCEDURE procedura1 (param1 INT, param2 CHAR(3),
OUT param3 INT)
BEGIN
DECLARE finito INT default 0;
DECLARE a INT;
DECLARE b CHAR(50);
DECLARE cur1 CURSOR FOR SELECT id,nome
FROM clienti WHERE cat = param2;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000'
SET finito = 1;
OPEN cur1;
SET param3 = 0;
FETCH cur1 INTO a,b;
ciclo: WHILE NOT finito DO
IF param3 < param1 THEN
SET param3 = param3 + 1;
FETCH cur1 INTO a,b;
ELSE
LEAVE ciclo;
END IF;
END WHILE ciclo;
END; //
DELIMITER ;

errore >>

#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 'DELIMITER //
CREATE PROCEDURE procedura1 (param1 INT, param2 CHAR(3),
' at line 1
Back to top
Davide Consonni
Guest





PostPosted: Tue Nov 21, 2006 9:58 pm    Post subject: Re: mysql - transaction e stored procedures Reply with quote



OldFriend wrote:

Quote:
1) - transaction : ho già letto che le tabelle myIsam non le
supportano ed infatti non ci sono errori ma se faccio una select...for
update(che dovrebbe bloccarmi in lettura le righe selezionate non
blocca proprio niente), quindi dove trovo della documentazione sulle
innoDB?

ma in mysql non volevano abbandonare innoDB ? ricordo male ?

--
Davide Consonni <davideconsonni (AT) virgilio (DOT) it> http://csvtosql.sourceforge.net
Felicita', s.f.: Una gradevole sensazione scaturita dalla contemplazione
della sofferenza altrui. -- Ambrose Bierce, "The Devil's Dictionary"
Back to top
TizianoCaietto
Guest





PostPosted: Tue Nov 21, 2006 11:48 pm    Post subject: Re: mysql - transaction e stored procedures Reply with quote



OldFriend wrote:

Quote:
#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 'DELIMITER //

a me la prende la tua procedura,
ma che versione usi di mysql ?
"SELECT VERSION();"
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.