Listing All Non-SQL92 Keywords Used by a Database

A keyword is a reserved word used by the database. Database objects such as tables or columns cannot be named with a keyword.

This example retrieves a list of keywords for a database. The keyword list from getSQLKeywords() is a comma separated list.

try { DatabaseMetaData dbmd = connection.getMetaData(); // Get a list of keywords String[] keywords = dbmd.getSQLKeywords().split(",\\s*"); } catch (SQLException e) { }
Examples in an Oracle database include:
ACCESS, ADD, ALTER, AUDIT, CLUSTER, COLUMN, COMMENT, COMPRESS, CONNECT, DATE, DROP, EXCLUSIVE, FILE, IDENTIFIED, IMMEDIATE, INCREMENT, INDEX, INITIAL, INTERSECT, LEVEL, LOCK, LONG, MAXEXTENTS, MINUS, MODE, NOAUDIT, NOCOMPRESS, NOWAIT, NUMBER, OFFLINE, ONLINE, PCTFREE, PRIOR, all_PL_SQL_reserved_ words
Examples in a MySQL database include:
AUTO_INCREMENT,BINARY,BLOB,ENUM,INFILE,LOAD,MEDIUMINT,OPTION,OUTFILE,REPLACE, SET,TEXT,UNSIGNED,ZEROFILL

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.