On 2012-01-17 11:13, Miguel Chang wrote:
Hello there, before I start with my question I would like to thank all those developers who put so much effort on this great Open Source Database.
My name is Miguel, I´m currently using the MonetDB database for a university project and so far it´s been great. By following the documentation on the webpage I´ve build a fully functional system but I´ve encoutered one problem: So far I´ve been unable to create an stored procedure, even after following all the instructions on the documentation page: http://www.monetdb.org/Documentation/Manuals/SQLreference/Procedures
Here´s an example I´ve tried but that does not works:
CREATE PROCEDURE SP_GET_ALL_EVENTS () BEGIN SELECT * FROM DEMO.EVENTS; END;
From the many variation I tried with the last query I always get these errors: "Unexpected From, Expected In" or "unexpected END"
I´ve been trying many variations (INSERT, UPDATES, DELETES) and I get the same responses...
So can someone please point me what´s the error in my code? and also show me some examples codes for stored procedure creation?
Much Appreciated.
The syntax for creating a stored procedure is correct, except for one important detail. You cannot use an ordinary select query in a procedure. You can change the contents of tables or set variables, but you cannot use a query like this. Remember, with such a query, there is a result, and where should the result go? -- Sjoerd Mullender