The question speaks for itself. This is the reproducible script

create table t (c1 int, c2 int);
begin
  declare x int = 1;

  insert into t (c1, c2) values (x, 1);
  insert into t (c1, c2) values (1, 1), (1, 2);
  insert into t (c1, c2) values (x, 1), (x, 2); //=> Invalid value for INSERT near 'x' on line 6"
end

create variable y int = 1;
insert into t (c1, c2) values (y, 1);
insert into t (c1, c2) values (y, 1), (y, 2); //=> Invalid value for INSERT near 'y' on line 1

asked 10 Jan, 03:06

Christian%20Hamers's gravatar image

Christian Ha...
48691223
accept rate: 40%

Fails also with v17.0.10.5963...

(10 Jan, 04:17) Volker Barth
1

The Help contains these three poorly written stream-of-conciousness sentences:

"If you specify multiple row value constructors, they must be separated by commas. If the insert-expression is a host variable or procedure variable, then an error is returned. Using single-row INSERT...VALUES for host and procedure variables is supported."

The Help never clearly defines what a "procedure variable" is, and it only refers to "procedure variable" in this and one other location.

This is proof of the adage, "If you can't document it, you can't code it", something I have proven by personal example many times :)

(10 Jan, 08:14) Breck Carter
Replies hidden

Well at least they documented it a bit better compared to version 16... The help for version 16 only says:

If you specify multiple row value constructors, they must be separated by commas.

(10 Jan, 09:08) Christian Ha...

Yeah, there are two ways to fix a bug, as discussed here: change the code, or change the documentation.

(10 Jan, 10:41) Breck Carter
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×246
×32
×17

question asked: 10 Jan, 03:06

question was seen: 80 times

last updated: 10 Jan, 10:41