Is there a right way to include comments in DB SQL Executor? It seems to recognize both simple and bracketed comments, but I am having to remove them as I add more lines of code to it to get it to not err out.
The error message being returned is:
Execute failed: Invalid SQL type: sqlKind = UNINITIALIZED
Hi @kevinnay , I’m not sure what you mean by “simple and bracketed comments”, but typically you can include the standard sql comments in the DB SQL Executor
-- single line comment
/* multi
line comment */
e.g.
-- this is a comment
create table if not exists myschema.mytable(mycolumn varchar(20));
/* this is
another comment */
create table if not exists myschema.mytable2(mycolumn varchar(20));
If they don’t work, what database are you using?
edit: I’ve done some googling for the error you mentioned. This error appears to be sometimes related to spaces (or maybe lack of them) in your sql. (Not specifically KNIME related, but potentially an issue with some jdbc drivers/databases)
For example, I found one mentioned that including a comment such as
--HINT
caused it to error, but by changing this to
-- HINT
(i.e. adding a space after the “--” it then worked. Maybe that is what you are experiencing?
This was with Oracle and it wasn’t accepting all comments so I think the manner in which it parses the code was encountering something that was confusing it. I know that much to be true because as soon as I removed the comments it would start work so there’s something about how comments are introduced that it doesn’t like and the comments were formatted no differently than they were in a sql client where the scripts ran fine.
Hi @kevinnay , if you could perhaps post a small example of commented code that exhibits this problem it would be easier to assist.
Without, it’s just guesswork about what specifically is causing your issue as I include comments with oracle code and haven’t had this error occur.
Agreed. I think it has to do with the placement and the spacing because I have other code with comments that runs. I’ll have to see if I can recreate the issue and then I can post something. Thanks.