When using DML statements within a SQL Remote passthrough session with 12.0.1.4314, these DML statements were rejected with SQLCODE -707 ("Statement is not allowed in passthrough mode"). Initially, I was surprised because we have eventually used such DML statements within passthrough mode in older versions without problems (*), and I wondered whether I had noticed a possible limitation in v12 I had not been aware of. A closer look revealed that the error messaged appeared when two INSERT or UPDATE statements followed each other without a statement delimiter, such as
Adding a semicolon after each statement fixed the problem easily. Outside passthrough mode, such DML statements are accepted without delimiters (as long as they remain unambiguous, of course), I guess as T-SQL syntax. So is that need for a delimiter a known restriction in SQL Remote Passthrough mode? (*) Aside: One might ask why we use DML statements in a passthrough session and do not simply run them "normally" and let SQL Remote distribute the values. - Well, it's handy when you are about to alter an existing, non-empty table to add a NOT NULL column and want to handle that within one passthrough session, such as PASSTHROUGH FOR SUBSCRIPTION TO ...; SETUSER ...; ALTER TABLE MyTable ADD MyNewColumn INT NULL; -- can't be NOT NULL while empty UPDATE MyTable SET MyNewColumn = <whatever>; ALTER TABLE MyTable ALTER MyNewColumn NOT NULL; ... COMMIT; PASSTHROUGH STOP; Comment Text Removed
|
Without the semicolons, the 2 inserts are treated as a SQL Batch and that is the source of the issue you are seeing. Putting GO statements between and after them would also work to correct this. In one sense this is covered by the description of that error OK, that's understood. So I guess older versions were less strict w.r.t. batches and delimiters...
(28 Jan '16, 09:57)
Volker Barth
More correctly ... it is a documented limitation as well
(28 Jan '16, 10:15)
Nick Elson S...
Replies hidden
Well, as stated, I was more surprised because it had worked with older versions like v8, and I'm quite sure the documented limitations have not changed in-between...
(28 Jan '16, 10:34)
Volker Barth
|