Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Column Alias That's Also A Reserved Keyword

Ray WinkelmanAug 4 2016 — edited Aug 5 2016

You folks are probably going to laugh at how trivial this one is. However, Google searches have not presented me with any sufficient answers, so the question may deserve a place here.

I've got the following query:

select '1969' from dual;

But, what if I want to alias the column with a reserved keyword? For example (This doesn't work):

select '1969' as date from dual;

'date' is a type, and Oracle doesn't like this.

I've tried the following to no avail:

select '1969' as date from dual;

select '1969' as 'date' from dual;

select '1969' as `date` from dual;

select '1969' date from dual;

select '1969' 'date' from dual;

select '1969' `date` from dual;

The error is informative when getting an understanding of Oracle's order of interpreting tokens in the statement, but is not alias related.

ORA-00923: FROM keyword not found where expected

00923. 00000 -  "FROM keyword not found where expected"

I'm sure this is incredibly easy. Easy rep for someone!

I'm just a monkey with a keyboard.

This post has been answered by JuanM on Aug 4 2016
Jump to Answer

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 2 2016
Added on Aug 4 2016
36 comments
8,540 views