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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Question about origin fieldname and tablename

Re: Question about origin fieldname and tablename

From: Jürgen Bauer <jb_at_bauer-software.de>
Date: Mon, 26 Jan 2004 17:40:04 +0100
Message-ID: <bv3ft6$c22$05$1@news.t-online.com>


Hello, Daniel,

thanks for your reply.

> All of this information is available in the data dictionary views:
>
> SELECT column_name
> FROM all_tab_columns
> WHERE owner = ...
> AND table_name = ...
>
> But why are you writing such code in the first place? Why are you
> aliasing column names? Why are you using 'AS' at all?

We have written a general application server which is supposed to "understand" any SQL statement and to update the data. So it is not predictable which statement is sent to fetch the data. On the application server side we want to know which rows in which table we have to update. So it is very important for us to be able to extract this information.
We already saw that the original ADO driver is capable to do this. Now we are looking for a way to obtain this via OCI.

> Either way if you can write this:
>
> > SELECT a.NAME as SORTNAME, c.*
> > FROM ADRESSES AS a, CONTACTS AS c
> > WHERE a.ID = c.MASTERID
>
> Then you already know that SORTNAME's base column is NAME. Which, by the
> way, is a reserved word in Oracle and should never be used as a column
> name. Same goes for ID ... it is a reserved word.

The statement is only supposed to be an example - not a real world statement :-).

Bye,
Jürgen Bauer
BauerSoftware, Germany Received on Mon Jan 26 2004 - 10:40:04 CST

Original text of this message

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