Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How would I write this sql

Re: How would I write this sql

From: Hans Forbrich <forbrich_at_telusplanet.net>
Date: Tue, 10 Jun 2003 01:06:01 GMT
Message-ID: <3EE52D7C.481EE2CF@telusplanet.net>


Nuno Souto wrote:

> Hans Forbrich <forbrich_at_telusplanet.net> wrote in message news:<3EE1F7B4.7497749E_at_telusplanet.net>...
>
> > Since this is open source - let the dev team know they are trampling on top of
> > standards with this construct. The standard is ANSI, not Oracle, so they
> > should NOT be doing this!!!!!!!
>
> Akshally, correct me if I'm wrong. But I seem to recall
> the standard provides use of "(rabbit's ears) around any
> reserved word to avoid its interpretation as such.

You are right about using the "

I am saying the developer of the orginal code in question should not have used USER in the first place whether inside rabbit's ears or not. It's considered poor programming practise to use a reserved keyword unless necessary for readability and/or maintenance.

Hence my bold statement & strong encouragement back to the dev community to avoid this.

> So what he's done is actually the correct way to approach this.
> I mean, quote *user* and be done with it. Rather than remove
> *user*

Yes - the method is correct. (And my orginal reply directs the OP to the documentation where this is discussed.)

<rant>
But ....

Unless this is used in a correlated subquery or something similar, there is absolutely no reason for using USER as an table alias in the cited example. It doesn't even improve maintainability in this case. For reference, the cited example is:

>SQL> SELECT user.id
> 2 FROM organization user
> 3 WHERE userid = 'myname'
> 4 /

</rant>

Finally - the originator states s/he can not make changes to the table alias and yet can make changes to the statement. That is really, really confusing. Received on Mon Jun 09 2003 - 20:06:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US