Question

in hsqldb I want to generate a procedure that is returning a cursor and execute a query taken from a varchar input string. Here's the code:

CREATE PROCEDURE EXECUTE (
   IN piv_query      VARCHAR(400)
)
BEGIN ATOMIC
    DECLARE pov_output  CURSOR  WITH RETURN FOR piv_query;
    OPEN pov_output;
END;

I receive the error: unexpected token, PIV_QUERY: line 5 / error corde -5581 / State 42581

Many thanks!

Was it helpful?

Solution

Ok, got it. Impossible to return a cursor as an out variable, and impossible to have something similar to "EXECUTE IMMEDIATE", so I can't run a dynamic query in this way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top