Created
August 29, 2019 16:02
-
-
Save forstie/4ac177ae424597bfdc5fe0b42907bf03 to your computer and use it in GitHub Desktop.
This example shows how to use dynamic SQL (PREPARE and EXECUTE) to implement a VALUES INTO statement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create procedure qgpl.values_into (out pout integer) | |
begin | |
declare values_into_stmt varchar(1000) ccsid 37; | |
set values_into_stmt = 'values 1+2+3 into ?'; | |
prepare values_into_query from values_into_stmt; | |
execute values_into_query using pout; | |
end; | |
call qgpl.values_into(?); | |
-- Note that 6 is returned... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is only necessary on prepare and execute? Because parameter markers cannot be used like so:
or
Is there a reason why parameter markers cannot be used with the SET or SELECT INTO statements?