MonetDB 存储过程 return table
MonetDB stored procedure return table
来自 MonetDB 用户的:
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?
在 MonetDB 上创建类型的正确方法是什么:
CREATE XXXX
BEGIN
SELECT * FROM table;
END
谢谢
这似乎更像是 VIEW
的工作,例如
CREATE VIEW XXXX AS SELECT * FROM table;
SELECT * FROM XXXX;
如果你想创建一个函数,你可以这样做:
CREATE FUNCTION XXXX()
RETURNS TABLE (name string)
RETURN TABLE (SELECT name from tables);
SELECT * FROM XXXX();
注意第二种情况,需要在函数定义中指定返回table的schema
来自 MonetDB 用户的:
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?
在 MonetDB 上创建类型的正确方法是什么:
CREATE XXXX
BEGIN
SELECT * FROM table;
END
谢谢
这似乎更像是 VIEW
的工作,例如
CREATE VIEW XXXX AS SELECT * FROM table;
SELECT * FROM XXXX;
如果你想创建一个函数,你可以这样做:
CREATE FUNCTION XXXX()
RETURNS TABLE (name string)
RETURN TABLE (SELECT name from tables);
SELECT * FROM XXXX();
注意第二种情况,需要在函数定义中指定返回table的schema