You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for Alter Table Add Multi Columns Statement #246
I'm not an author of JSqlParser but as far as I know JSqlParser does have support for ALTER TABLE statements, although maybe not for all forms of them.
The following query can be parsed successfully as a net.sf.jsqlparser.statement.alter.Alter object: ALTER TABLE MyTable ADD COLUMN MyColumn Int
Could you post a (simplified) version of your ALTER TABLE statement which throws a parse exception?
There seem to be two things that JSqlParser does not seem to support here (@wumpz, can you confirm this?):
adding multiple columns in a single ALTER TABLE statement
adding columns without the COLUMN keyword
If you add the COLUMN keyword and make two separate statements out of it, it can be parsed successfully. The following statements work: ALTER TABLE TABLE1 ADD COLUMN COLUMN1 VARCHAR2(751); ALTER TABLE TABLE1 ADD COLUMN COLUMN2 VARCHAR2(600);
Activity
mlkammer commentedon Apr 6, 2016
I'm not an author of JSqlParser but as far as I know JSqlParser does have support for ALTER TABLE statements, although maybe not for all forms of them.
The following query can be parsed successfully as a
net.sf.jsqlparser.statement.alter.Alterobject:ALTER TABLE MyTable ADD COLUMN MyColumn IntCould you post a (simplified) version of your ALTER TABLE statement which throws a parse exception?
imben1109 commentedon Apr 6, 2016
I am using CCJSqlParserUtil.parse to parse the alter table statement and it throw JSQLParserException
wumpz commentedon Apr 6, 2016
You should post your exact alter statement. As mlkammer mentioned, JSqlParser does support it to a certain degree.
imben1109 commentedon Apr 6, 2016
ALTER TABLE TABLE1 ADD ( COLUMN1 VARCHAR2(751), COLUMN2 VARCHAR2(600) )
This is my tested alter statement.
mlkammer commentedon Apr 6, 2016
There seem to be two things that JSqlParser does not seem to support here (@wumpz, can you confirm this?):
If you add the COLUMN keyword and make two separate statements out of it, it can be parsed successfully. The following statements work:
ALTER TABLE TABLE1 ADD COLUMN COLUMN1 VARCHAR2(751);ALTER TABLE TABLE1 ADD COLUMN COLUMN2 VARCHAR2(600);@imben1109, does this work for you?
imben1109 commentedon Apr 7, 2016
Tested the below statement.
"ALTER TABLE TABLE1 ADD COLUMN COLUMN1 VARCHAR2(751);"
It works.
[-]Support for Alter Table Statement[/-][+]Support for Alter Table Add Multi Columns Statement[/+]wumpz commentedon Apr 14, 2016
@mlkammer: confirmed. JSqlParser does not support adding multiple columns through one sql.