Skip to content

Support for Alter Table Add Multi Columns Statement #246

Closed

Description

@imben1109

the Alter table statement would throw JSQLParserException.

It mean JSQLParser does not support it.

Activity

  1. mlkammer commented on Apr 6, 2016

    @mlkammer

    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?

  2. imben1109 commented on Apr 6, 2016

    @imben1109
    Author

    I am using CCJSqlParserUtil.parse to parse the alter table statement and it throw JSQLParserException

  3. wumpz commented on Apr 6, 2016

    @wumpz
    Member

    You should post your exact alter statement. As mlkammer mentioned, JSqlParser does support it to a certain degree.

  4. imben1109 commented on Apr 6, 2016

    @imben1109
    Author

    ALTER TABLE TABLE1 ADD ( COLUMN1 VARCHAR2(751), COLUMN2 VARCHAR2(600) )
    This is my tested alter statement.

  5. mlkammer commented on Apr 6, 2016

    @mlkammer

    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);

    @imben1109, does this work for you?

  6. imben1109 commented on Apr 7, 2016

    @imben1109
    Author

    Tested the below statement.
    "ALTER TABLE TABLE1 ADD COLUMN COLUMN1 VARCHAR2(751);"

    It works.

  7. changed the title [-]Support for Alter Table Statement[/-] [+]Support for Alter Table Add Multi Columns Statement[/+] on Apr 7, 2016
  8. wumpz commented on Apr 14, 2016

    @wumpz
    Member

    @mlkammer: confirmed. JSqlParser does not support adding multiple columns through one sql.

  9. self-assigned this
    on May 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions