![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias |
#3
| |||
| |||
|
|
Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias |
#4
| |||
| |||
|
|
Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias |
#5
| |||
| |||
|
|
Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias |
#6
| |||
| |||
|
|
"Mathias Waack" <M.Wa... (AT) gmx (DOT) de> wrote in message news:4NR0k.512$9W3.42551 (AT) se2-cb104-9 (DOT) zrh1.ch.colt.net... Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias This is called a natural join and is a very bad idea. *It is relying on the same column names in different tables being keys to a join. *There are alot of circumstances where this is not true. *So while you can use a natural join it is not advisable to do so. In the above alias the columns. *Then they will have different names. Jim- Hide quoted text - - Show quoted text - |
#7
| |||
| |||
|
|
"Mathias Waack" <M.Wa... (AT) gmx (DOT) de> wrote in message news:4NR0k.512$9W3.42551 (AT) se2-cb104-9 (DOT) zrh1.ch.colt.net... Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias This is called a natural join and is a very bad idea. *It is relying on the same column names in different tables being keys to a join. *There are alot of circumstances where this is not true. *So while you can use a natural join it is not advisable to do so. In the above alias the columns. *Then they will have different names. Jim- Hide quoted text - - Show quoted text - |
#8
| |||
| |||
|
|
"Mathias Waack" <M.Wa... (AT) gmx (DOT) de> wrote in message news:4NR0k.512$9W3.42551 (AT) se2-cb104-9 (DOT) zrh1.ch.colt.net... Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias This is called a natural join and is a very bad idea. *It is relying on the same column names in different tables being keys to a join. *There are alot of circumstances where this is not true. *So while you can use a natural join it is not advisable to do so. In the above alias the columns. *Then they will have different names. Jim- Hide quoted text - - Show quoted text - |
#9
| |||
| |||
|
|
"Mathias Waack" <M.Wa... (AT) gmx (DOT) de> wrote in message news:4NR0k.512$9W3.42551 (AT) se2-cb104-9 (DOT) zrh1.ch.colt.net... Hi, assume a situation where we have two tables: create table t1 (c1 number, c2 varchar2(10)); create table t2 (c1 number, c2 date); and a select like this: select t1.c1, t2.c1 from t1, t2; This statements comes as an opaque string into an OCI routine which tries to analyze the query. Its easy to obtain column names, datatypes aso from the query, but OCI returns only the short column names. Thus the select list from the query above becomes (c1,c1). Is there a way to distinguish both columns within OCI? I'm currently extending an application which generates queries which joins tables containing columns with the same name. Would be nice to find out, which column comes from which table. Mathias This is called a natural join and is a very bad idea. *It is relying on the same column names in different tables being keys to a join. *There are alot of circumstances where this is not true. *So while you can use a natural join it is not advisable to do so. In the above alias the columns. *Then they will have different names. Jim- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |