[MonetDB-users] Problem with Create Function sintaxis
Hi, I'm using MonetDB over Fedora 15 and the driver monetdb-1.20-jdbc.jar I have problems with the sintaxis of the following function: ----------------------- create function hts.Get_idimage() returns int begin declare idimag int; select max(Imag_id) into idimag from hts.Image; returns idimag+1; end; ----------------------- the error message is: ----------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin declare idimag int;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin declare idimag int ----------------------- Can you give me some clues of how to fix this sintaxis error? I've checked the SQL 2003 framework and the script looks fine. Thanks in advance for your help. Enrique.
Hi Enrique, Replacing "returns idimag+1" with "return idimag+1" should work. Moreover, unless there are reasons to define 'idimag', you can simplify the function body as, e.g.: return select max(Imag_id)+1 from hts.Image; Hope this helps a bit. With kind regards, Jennie On Jul 19, 2011, at 14:11, elarios@liacs.nl wrote:
Hi,
I'm using MonetDB over Fedora 15 and the driver monetdb-1.20-jdbc.jar I have problems with the sintaxis of the following function: ----------------------- create function hts.Get_idimage() returns int begin declare idimag int; select max(Imag_id) into idimag from hts.Image; returns idimag+1; end; ----------------------- the error message is: ----------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin declare idimag int;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin declare idimag int ----------------------- Can you give me some clues of how to fix this sintaxis error? I've checked the SQL 2003 framework and the script looks fine.
Thanks in advance for your help.
Enrique.
------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
Hi Jennie, I'm using SQuirreL SQL Client Version 3.2.1 and I replaced the script as follows: ------------------------------------------------------ create function hts.Get_idimage() returns int begin return select max(imag_id)+1 from hts.Image; end; ------------------------------------------------------ but the error persists: ------------------------------------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin return select max(imag_id)+1 from hts.image;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin return select max(imag_id)+1 from hts.Image ------------------------------------------------- Thanks in advance for your help, Enrique. Ying Zhang wrote:
Hi Enrique,
Replacing "returns idimag+1" with "return idimag+1" should work. Moreover, unless there are reasons to define 'idimag', you can simplify the function body as, e.g.: return select max(Imag_id)+1 from hts.Image; Hope this helps a bit.
With kind regards,
Jennie
On Jul 19, 2011, at 14:11, elarios@liacs.nl wrote:
Hi,
I'm using MonetDB over Fedora 15 and the driver monetdb-1.20-jdbc.jar I have problems with the sintaxis of the following function: ----------------------- create function hts.Get_idimage() returns int begin declare idimag int; select max(Imag_id) into idimag from hts.Image; returns idimag+1; end; ----------------------- the error message is: ----------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin declare idimag int;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin declare idimag int ----------------------- Can you give me some clues of how to fix this sintaxis error? I've checked the SQL 2003 framework and the script looks fine.
Thanks in advance for your help.
Enrique.
------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://old.nabble.com/Problem-with-Create-Function-sintaxis-tp32090523p32098... Sent from the monetdb-users mailing list archive at Nabble.com.
Enrique et al., With the Apr2011 branch (and I assume also with the Apr2011-SP1 release), this works fine with me (using mclient): sql>create schema hts; operation successful sql>creat table hts.image (imag_id int); syntax error, unexpected IDENT in: "creat" sql>create table hts.image (imag_id int); operation successful sql>create function hts.Get_idimage() returns int more>begin more> return select max(imag_id)+1 from hts.Image; more>end; operation successful Stefan On Wed, Jul 20, 2011 at 03:11:26AM -0700, elarios wrote:
Hi Jennie,
I'm using SQuirreL SQL Client Version 3.2.1 and I replaced the script as follows: ------------------------------------------------------ create function hts.Get_idimage() returns int begin return select max(imag_id)+1 from hts.Image; end; ------------------------------------------------------
but the error persists: ------------------------------------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin return select max(imag_id)+1 from hts.image;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin return select max(imag_id)+1 from hts.Image -------------------------------------------------
Thanks in advance for your help,
Enrique.
Ying Zhang wrote:
Hi Enrique,
Replacing "returns idimag+1" with "return idimag+1" should work. Moreover, unless there are reasons to define 'idimag', you can simplify the function body as, e.g.: return select max(Imag_id)+1 from hts.Image; Hope this helps a bit.
With kind regards,
Jennie
On Jul 19, 2011, at 14:11, elarios@liacs.nl wrote:
Hi,
I'm using MonetDB over Fedora 15 and the driver monetdb-1.20-jdbc.jar I have problems with the sintaxis of the following function: ----------------------- create function hts.Get_idimage() returns int begin declare idimag int; select max(Imag_id) into idimag from hts.Image; returns idimag+1; end; ----------------------- the error message is: ----------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin declare idimag int;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin declare idimag int ----------------------- Can you give me some clues of how to fix this sintaxis error? I've checked the SQL 2003 framework and the script looks fine.
Thanks in advance for your help.
Enrique.
------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://old.nabble.com/Problem-with-Create-Function-sintaxis-tp32090523p32098... Sent from the monetdb-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ 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, You're right, using the mclient works fine! Ok thanks, I'll use now this way because the same script using the SQuirreL SQL Client gives me the error that I described before. Thanks, Enrique. Stefan Manegold wrote:
Enrique et al.,
With the Apr2011 branch (and I assume also with the Apr2011-SP1 release), this works fine with me (using mclient):
sql>create schema hts; operation successful sql>creat table hts.image (imag_id int); syntax error, unexpected IDENT in: "creat" sql>create table hts.image (imag_id int); operation successful sql>create function hts.Get_idimage() returns int more>begin more> return select max(imag_id)+1 from hts.Image; more>end; operation successful
Stefan
On Wed, Jul 20, 2011 at 03:11:26AM -0700, elarios wrote:
Hi Jennie,
I'm using SQuirreL SQL Client Version 3.2.1 and I replaced the script as follows: ------------------------------------------------------ create function hts.Get_idimage() returns int begin return select max(imag_id)+1 from hts.Image; end; ------------------------------------------------------
but the error persists: ------------------------------------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin return select max(imag_id)+1 from hts.image;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin return select max(imag_id)+1 from hts.Image -------------------------------------------------
Thanks in advance for your help,
Enrique.
Ying Zhang wrote:
Hi Enrique,
Replacing "returns idimag+1" with "return idimag+1" should work. Moreover, unless there are reasons to define 'idimag', you can simplify the function body as, e.g.: return select max(Imag_id)+1 from
hts.Image;
Hope this helps a bit.
With kind regards,
Jennie
On Jul 19, 2011, at 14:11, elarios@liacs.nl wrote:
Hi,
I'm using MonetDB over Fedora 15 and the driver monetdb-1.20-jdbc.jar I have problems with the sintaxis of the following function: ----------------------- create function hts.Get_idimage() returns int begin declare idimag int; select max(Imag_id) into idimag from hts.Image; returns idimag+1; end; ----------------------- the error message is: ----------------------- Error: syntax error, unexpected $end, expecting WHILE in: "create function hts.get_idimage() returns int begin declare idimag int;" SQLState: null ErrorCode: 0 Error occured in: create function hts.Get_idimage() returns int begin declare idimag int ----------------------- Can you give me some clues of how to fix this sintaxis error? I've checked the SQL 2003 framework and the script looks fine.
Thanks in advance for your help.
Enrique.
Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://old.nabble.com/Problem-with-Create-Function-sintaxis-tp32090523p32098... Sent from the monetdb-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ 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) |
------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://old.nabble.com/Problem-with-Create-Function-sintaxis-tp32090523p32099... Sent from the monetdb-users mailing list archive at Nabble.com.
participants (4)
-
elarios
-
elarios@liacs.nl
-
Stefan Manegold
-
Ying Zhang