You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Nikhil <bh...@gmail.com> on 2010/12/21 14:14:14 UTC
[dbutils]
Hi,
I am new to DbUtils, I tried it and found it very helpful.
But now I am having problem in executing queries that have alias name
e.g. SELECT USER_ID as user, USER_NAME as name FROM T_USER_MSTR
When I run my program I get error shown below:
java.sql.SQLException: ORA-00923: FROM keyword not found where expected
Query: SELECT USER_ID as user, USER_NAME as name FROM T_USER_MSTR
Parameters: []
Please help me
Thanks,
Nikhil
Re: [dbutils]
Posted by Petite Abeille <pe...@mac.com>.
On Dec 21, 2010, at 2:14 PM, Nikhil wrote:
> Query: SELECT USER_ID as user, USER_NAME as name FROM T_USER_MSTR
"user", like half of the English language, is a reserved word in Oracle:
http://download.oracle.com/docs/cd/B10500_01/appdev.920/a42525/apb.htm
If you insist in using it, you must double quote it:
SELECT USER_ID as "user", USER_NAME as name FROM T_USER_MSTR
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [dbutils]
Posted by Steve Ash <st...@gmail.com>.
wow-- sorry I mis-remembered. Oracle doesn't support the "as" keyword
when aliasing elements in the FROM clause. I will try to invoke the
brain before the fingers next time. Sorry for wasting the lists time.
On Tue, Dec 21, 2010 at 3:52 PM, Petite Abeille <pe...@mac.com> wrote:
>
> On Dec 21, 2010, at 6:31 PM, Steve Ash wrote:
>
>> Oracle doesn't support "as" to alias names in the projection list.
>
> Oracle supports 'as' since, well, the ice age or perhaps before.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [dbutils]
Posted by Petite Abeille <pe...@mac.com>.
On Dec 21, 2010, at 6:31 PM, Steve Ash wrote:
> Oracle doesn't support "as" to alias names in the projection list.
Oracle supports 'as' since, well, the ice age or perhaps before.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [dbutils]
Posted by Guy Rouillier <gu...@burntmail.com>.
On 12/21/2010 12:31 PM, Steve Ash wrote:
> Nikhil,
>
> This is an oracle syntax problem, not a DbUtils problem. Oracle
> doesn't support "as" to alias names in the projection list. Try
> SELECT USER_ID user, USER_NAME name FROM T_USER_MSTR
That must be for very old versions of Oracle. Since at least Oracle 8,
this works fine:
select sysdate as today from dual
--
Guy Rouillier
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [dbutils]
Posted by Steve Ash <st...@gmail.com>.
Nikhil,
This is an oracle syntax problem, not a DbUtils problem. Oracle
doesn't support "as" to alias names in the projection list. Try
SELECT USER_ID user, USER_NAME name FROM T_USER_MSTR
Steve
On Tue, Dec 21, 2010 at 7:14 AM, Nikhil <bh...@gmail.com> wrote:
> Hi,
>
>
>
> I am new to DbUtils, I tried it and found it very helpful.
>
>
>
> But now I am having problem in executing queries that have alias name
>
>
>
> e.g. SELECT USER_ID as user, USER_NAME as name FROM T_USER_MSTR
>
>
>
> When I run my program I get error shown below:
>
>
>
> java.sql.SQLException: ORA-00923: FROM keyword not found where expected
>
> Query: SELECT USER_ID as user, USER_NAME as name FROM T_USER_MSTR
> Parameters: []
>
>
>
> Please help me
>
>
>
>
>
> Thanks,
>
> Nikhil
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org