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.