[MonetDB-users] Transaction management in stored procedures

Hi all, Does anyone knows how can I handle transactions in a stored procedure? In procedure definition on SQL Reference says that a procedure_statement may consists of transaction_statement etc. How transaction_statement implemented in a stored procedure? I tried (inside the BEGIN ... END block of stored procedure) the: START TRANSACTION; sql statements COMMIT; and: sql statements COMMIT; but both they do not work. Thanks, Vassilis

Hi Vassilis, could you please elaborate what exatly "do not work" means in your case? Do you get en error (if so, which)? Or what else does (not) happen? Thanks! Stefan On Tue, Feb 14, 2012 at 08:16:05PM +0200, Vassilis Papakonstantinou wrote:
Hi all,
Does anyone knows how can I handle transactions in a stored procedure? In procedure definition on SQL Reference says that a procedure_statement may consists of transaction_statement etc. How transaction_statement implemented in a stored procedure? I tried (inside the BEGIN ... END block of stored procedure) the:
START TRANSACTION; sql statements COMMIT;
and:
sql statements COMMIT;
but both they do not work.
Thanks, Vassilis
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |

Hi Stefan, when I try to load my stored procedure (in which i try to handle transactions in the manner i described) through the following command, mclient -d db < xxx.sql i'm getting nothing. Neither "operation successful" nor an error about sql syntax. And as I checked the stored procedure is not loaded. I just tried, for testing purposes, to create a simple stored procedure with only an insertion statement firstly, enclosed in START TRANSACTION ... COMMIT and secondly followed just by COMMIT and i'm getting in the 1st case: "Statement 'START' is not a valid flow control statement" and in the 2nd: "Statement 'COMMIT' is not a valid flow control statement" Vassilis On 02/20/2012 07:18 PM, Stefan Manegold wrote:
Hi Vassilis,
could you please elaborate what exatly "do not work" means in your case?
Do you get en error (if so, which)?
Or what else does (not) happen?
Thanks! Stefan
On Tue, Feb 14, 2012 at 08:16:05PM +0200, Vassilis Papakonstantinou wrote:
Hi all,
Does anyone knows how can I handle transactions in a stored procedure? In procedure definition on SQL Reference says that a procedure_statement may consists of transaction_statement etc. How transaction_statement implemented in a stored procedure? I tried (inside the BEGIN ... END block of stored procedure) the:
START TRANSACTION; sql statements COMMIT;
and:
sql statements COMMIT;
but both they do not work.
Thanks, Vassilis
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users

Hi Vassilis, please file a bug report (via bugs.monetdb.org) about this. Either we support transactions in stored procedures, then we need to check and fix our code, or we do not support transactions in stored procedures, then we need to fix our documentation (and check whether we issue the correct error message(s)). Right now, I cannot tell which is true; I actually cannot even tell out of my head what the SQL standard says. Thanks, Stefan On Mon, Feb 20, 2012 at 08:42:45PM +0200, Vassilis Papakonstantinou wrote:
Hi Stefan,
when I try to load my stored procedure (in which i try to handle transactions in the manner i described) through the following command,
mclient -d db < xxx.sql
i'm getting nothing. Neither "operation successful" nor an error about sql syntax. And as I checked the stored procedure is not loaded.
I just tried, for testing purposes, to create a simple stored procedure with only an insertion statement firstly, enclosed in START TRANSACTION ... COMMIT and secondly followed just by COMMIT and i'm getting
in the 1st case: "Statement 'START' is not a valid flow control statement" and in the 2nd: "Statement 'COMMIT' is not a valid flow control statement"
Vassilis
On 02/20/2012 07:18 PM, Stefan Manegold wrote:
Hi Vassilis,
could you please elaborate what exatly "do not work" means in your case?
Do you get en error (if so, which)?
Or what else does (not) happen?
Thanks! Stefan
On Tue, Feb 14, 2012 at 08:16:05PM +0200, Vassilis Papakonstantinou wrote:
Hi all,
Does anyone knows how can I handle transactions in a stored procedure? In procedure definition on SQL Reference says that a procedure_statement may consists of transaction_statement etc. How transaction_statement implemented in a stored procedure? I tried (inside the BEGIN ... END block of stored procedure) the:
START TRANSACTION; sql statements COMMIT;
and:
sql statements COMMIT;
but both they do not work.
Thanks, Vassilis
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |

Ok Stefan. Thanks for your response, Vassilis On 02/20/2012 08:49 PM, Stefan Manegold wrote:
Hi Vassilis,
please file a bug report (via bugs.monetdb.org) about this.
Either we support transactions in stored procedures, then we need to check and fix our code, or we do not support transactions in stored procedures, then we need to fix our documentation (and check whether we issue the correct error message(s)).
Right now, I cannot tell which is true; I actually cannot even tell out of my head what the SQL standard says.
Thanks, Stefan
On Mon, Feb 20, 2012 at 08:42:45PM +0200, Vassilis Papakonstantinou wrote:
Hi Stefan,
when I try to load my stored procedure (in which i try to handle transactions in the manner i described) through the following command,
mclient -d db< xxx.sql
i'm getting nothing. Neither "operation successful" nor an error about sql syntax. And as I checked the stored procedure is not loaded.
I just tried, for testing purposes, to create a simple stored procedure with only an insertion statement firstly, enclosed in START TRANSACTION ... COMMIT and secondly followed just by COMMIT and i'm getting
in the 1st case: "Statement 'START' is not a valid flow control statement" and in the 2nd: "Statement 'COMMIT' is not a valid flow control statement"
Vassilis
On 02/20/2012 07:18 PM, Stefan Manegold wrote:
Hi Vassilis,
could you please elaborate what exatly "do not work" means in your case?
Do you get en error (if so, which)?
Or what else does (not) happen?
Thanks! Stefan
On Tue, Feb 14, 2012 at 08:16:05PM +0200, Vassilis Papakonstantinou wrote:
Hi all,
Does anyone knows how can I handle transactions in a stored procedure? In procedure definition on SQL Reference says that a procedure_statement may consists of transaction_statement etc. How transaction_statement implemented in a stored procedure? I tried (inside the BEGIN ... END block of stored procedure) the:
START TRANSACTION; sql statements COMMIT;
and:
sql statements COMMIT;
but both they do not work.
Thanks, Vassilis
------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
participants (2)
-
Stefan Manegold
-
Vassilis Papakonstantinou