Toad World® Forums

14.1.22.778: "ilm" not accepted as table alias

By coincidence, I just found that Toad generates an error in the editor when I use "ilm" as a table alias in a query, like this:

select * from dual ilm;

Ctrl+Shift+F refuses to format the statement and the editor underlines the "ilm" with red.

I tried to execute the statement above on a 12.2 database and it executed without error. Is "ilm" a reserved word in a later version?

It seems like it would be valid as an alias, but yes, that's a reserved word so it's probably best avoided. For example:

CREATE TABLE EMP
(
  EMPNO     NUMBER(4),
  ENAME     VARCHAR2(10 BYTE),
  JOB       VARCHAR2(9 BYTE),
  MGR       NUMBER(4),
  HIREDATE  DATE,
  SAL       NUMBER(7,2),
  COMM      NUMBER(7,2),
  DEPTNO    NUMBER(2)
)
ILM ADD POLICY COMPRESS SEGMENT AFTER 1 MONTH OF NO ACCESS;

Ah, yes, the fun of Oracle reserved words, keywords and the distinction between them.

select * from v$reserved_words order by keyword;

ILM seems to be a keyword, but not a reserved word. So it can be used as a non-quoted identifier, but Oracle recommends against it.

I learned something new today. I did not know about ILM.

Perhaps you could add a feature request to make a distinction between keywords and reserved words? I doubt many people know all of them and the error I got is not very clear about it.

By the way, many keywords are not reserved, even though you might think so. The below code, while highly inadvisable, is valid PL/SQL (and doesn't raise the same error in Toad):

DECLARE
  TO_CHAR   VARCHAR2(10);
BEGIN
  TO_CHAR   := 'a';
  dbms_output.put_line(TO_CHAR);
END;