From: "Spencer" <spencerp@swbell.net>
Newsgroups: comp.databases.oracle.server
References: <97ivp9$me4$1@nereid.worldonline.nl>
Subject: Re: Identifing the source of a view column
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <v2ho6.406$na.8110@nnrp1.sbc.net>
Date: Sat, 3 Mar 2001 19:41:11 -0600
NNTP-Posting-Host: 208.190.213.153
X-Complaints-To: abuse@swbell.net
X-Trace: nnrp1.sbc.net 983670043 208.190.213.153 (Sat, 03 Mar 2001 19:40:43 CST)
NNTP-Posting-Date: Sat, 03 Mar 2001 19:40:43 CST
Organization: SBC Internet Services


no.  a script to do what you propose would be of dubious
value, since the "source" for a view column can be any
expression, not necessarily a simple expression like the
name of a column from a view or table.

you need the complete source of the view to tell the whole
story. simply picking out an expression from the outermost
select list and taking it out of context could be misleading.

take, for example, this view definition:

CREATE OR REPLACE VIEW v1 (f1, f2)
AS
SELECT t3.f3
     , t2.f2
  FROM (SELECT f1 As f3
             , f2 As f2
          FROM t1
       ) t3
     , t2
 WHERE t3.f3=t2.f1;

outside of the context of the view definition, "t3.f3" does
not have much meaning.  and since "t3" could actually be
the name of another view or table containing a column
named "f3", reporting the "source" of "v1.f1" as "t3.f3"
could be misleading.

you really need to review the entire text of the view definition
in order to determine the "source" of a column from the view.

"Peter" <P.Slingerland@IMN.nl> wrote in message
news:97ivp9$me4$1@nereid.worldonline.nl...
> Hello,
>
> Does anyone know a script to select the source column for a view column.
>
> For example:
>
> create view v1 (f1, f2)
> as select t1.f2, t2.f2
> from t1,t2
> where t1.f1=t2.f1;
>
> When I want the know the source for v1.f1 the script or function should
> return
> t1.f2.
>
> Thanks,
>
>
> Peter
>
>



