I want to create a procedure with the text:
When you try to save this process getting an error message:
Q: What kind of error (in the help, it is not described) and why is it happening ?
asked 13 Apr '16, 02:37
Thiago is correct in his comment above: when there are multiple value tuples in the values clause then only constant values are allowed, so as a result variables are not allowed. I am unsure why there is this restriction. I have sent a note to the doc team to add a note to the VALUES clause section in the INSERT statement documentation.
[Update] After some more scanning of the code I see that host variables are also allowed in the list of values of the value row constructor when there are multiple values specified.
FWIW, while the restriction seems to hold as Mark has explained, you might use an INSERT SELECT instead of an INSERT with multiple rows if you want to insert multiple rows with variables, such as
begin declare nInt int = 6; insert T_Test select null, nInt, nInt union all select null, nInt, nInt; end;
answered 15 Apr '16, 08:05