Bluehost.com Web Hosting $6.95

Help with Store procedure

This is a discussion on Help with Store procedure within the MySQL Database forums, part of the Database Forums category; Hi gurus, here is a snippet of the procedure, don't know if mysql support labels as SQL Server and ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-31-2007
lala4life
 
Posts: n/a
Default Help with Store procedure

Hi gurus,
here is a snippet of the procedure, don't know if mysql support
labels as SQL Server and Oracle and i can't find more doc about error
control in mysql. So if anyone can tell me more hints about this topic
i would really appreciate


DECLARE error_check INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET error_check = 1;


START TRANSACTION

INSERT INTO child_table (child_id,parent_id) VALUES (1,1); <---
Constraint Error Parent Id does not exits
IF error_check = 1 THEN GOTO ERROR_LABEL END IF; <-- not sure about
this

COMMIT;

ERROR_LABEL:
IF error_check = 1 THEN
ROLLBACK;
END IF;

Reply With Quote
  #2 (permalink)  
Old 01-31-2007
Captain Paralytic
 
Posts: n/a
Default Re: Help with Store procedure

On 31 Jan, 12:53, "lala4life" <rafael.ava...@gmail.com> wrote:
> Hi gurus,
> here is a snippet of the procedure, don't know if mysql support
> labels as SQL Server and Oracle and i can't find more doc about error
> control in mysql. So if anyone can tell me more hints about this topic
> i would really appreciate
>
> DECLARE error_check INT DEFAULT 0;
> DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET error_check = 1;
>
> START TRANSACTION
>
> INSERT INTO child_table (child_id,parent_id) VALUES (1,1); <---
> Constraint Error Parent Id does not exits
> IF error_check = 1 THEN GOTO ERROR_LABEL END IF; <-- not sure about
> this
>
> COMMIT;
>
> ERROR_LABEL:
> IF error_check = 1 THEN
> ROLLBACK;
> END IF;


The stuff that you couldn't find in the docs wouldn't be this would
it?
http://dev.mysql.com/doc/refman/5.1/...-handlers.html

Reply With Quote
  #3 (permalink)  
Old 01-31-2007
lala4life
 
Posts: n/a
Default Re: Help with Store procedure

On Jan 31, 10:15 am, "Captain Paralytic" <paul_laut...@yahoo.com>
wrote:
> On 31 Jan, 12:53, "lala4life" <rafael.ava...@gmail.com> wrote:
>
>
>
> > Hi gurus,
> > here is a snippet of the procedure, don't know if mysql support
> > labels as SQL Server and Oracle and i can't find more doc about error
> > control in mysql. So if anyone can tell me more hints about this topic
> > i would really appreciate

>
> > DECLARE error_check INT DEFAULT 0;
> > DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET error_check = 1;

>
> > START TRANSACTION

>
> > INSERT INTO child_table (child_id,parent_id) VALUES (1,1); <---
> > Constraint Error Parent Id does not exits
> > IF error_check = 1 THEN GOTO ERROR_LABEL END IF; <-- not sure about
> > this

>
> > COMMIT;

>
> > ERROR_LABEL:
> > IF error_check = 1 THEN
> > ROLLBACK;
> > END IF;

>
> The stuff that you couldn't find in the docs wouldn't be this would
> it?http://dev.mysql.com/doc/refman/5.1/...-handlers.html



Is the same that i read. don't say anything about labels.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0