Re: Column aliasing

  • From: Stephane Faroult <sfaroult@xxxxxxxxxxxx>
  • To: rjamya@xxxxxxxxx
  • Date: Fri, 20 Jul 2012 16:17:32 +0200

On 07/20/2012 02:16 PM, rjamya wrote:
> Hi all,
> Is there a way to detect column aliasing (or double-aliasing) in view
> scripts other than manual look over? Here is a classic example of
> double aliasing that i see in some of the code
> create view view1 (col1, col2, col3) as select column_1 as a, column_2
> as b, column_3 as c from blah blah;
> so in select column_1 is aliased as "A", which is exposed in the view
> as "COL1". I know this is no harm, but sure confuses the heck when you
> read something when your view had 40+ columns and your view definition
> has UNION ALL etc.
> Just curious  (version 11.2)
> Raj
> --
> //
    Col1, Col2 and so on are in dba_tab_columns (or sys.col$).  I think 
that by retrieving the view text from dba_views or sys.view$ and using 
that good old dbms_sql package to parse it you can get the description 
of the columns and compare to what you have in the first one. I haven't 
tried it but it can probably be done.


Stephane Faroult
RoughSea Ltd <>
Konagora <>
RoughSea Channel on Youtube <>


Other related posts: