Answers inserted below.


On 03-05-17 02:37, Luis Larios wrote:

Hi,

 

We’d like to know if there is a way to create and execute prepared statements within an SQL function.  In particular, once that we use:

“prepare select * from table”

 

How can I retrieve the prepared statement ID to use in an exec()?

That is currently not possible/supported in SQL.

If your prepare statement is a SELECT ...  then you could create a view instead, for instance:
  CREATE VIEW user_tables AS select * from sys.tables where not system;
and use the view name in the function body instead of the prepare and exec #().


Note: If you use ODBC then you can create and use prepared statements via:
SQLPrepare(SQLHSTMT StatementHandle, SQLCHAR *StatementText, SQLINTEGER TextLength)

If you use JDBC then you can also create and use prepared statements via:
PreparedStatement pstmt = con.prepareStatement(String sql);
http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html

 

Thanks,

 

Luis Ángel.

_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list