Skip to content
No results
We use cookies to ensure that we give you the best experience on our website.

# How to access view alias in create view statement via SQL parser

Access view alias in create view SQL statement is very easily after SQL script was parsed successfully by General SQL Parser.

Take this SQL for example:

    CREATE OR replace VIEW test1
    (account_name_alias, account_number_alias)
    AS
      SELECT account_name,
             account_number
      FROM   AP10_BANK_ACCOUNTS t;

The parse result generated by SQL parser is something like this:

    create view statement:
    View name: test1
    View alias: account_name_alias
    View alias: account_number_alias

    Subquery:

    Columns
    	Fullname:account_name
    	Fullname:account_number

    from clause:
    	AP10_BANK_ACCOUNTS t
    	tablename:AP10_BANK_ACCOUNTS
    	tablealias:t

Download source code of this demo: C# version, Java version,