RE: Display view equations?

  • From: "Mark W. Farnham" <mwf@xxxxxxxx>
  • To: <ltiu@xxxxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 12 Jun 2008 12:29:00 -0400

Do you simply want the text of the view? Describe dba_views or user_views
and you'll get the idea. You'll need to set "long" to at least text_length
for the view in question if you want to get back all the text, and since the
column is type long (at least through 10g, I don't have a running 11g at the
moment to check) you'll find routine sql functions won't operate on the text
column for parsing, so for a dynamic report on the formula for each column
you'll probably want to either select out the text and pass it to a parser
of your choice or just do the whole thing in perl (if just showing them the
text isn't enough.)

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]
On Behalf Of Lyndon Tiu
Sent: Thursday, June 12, 2008 10:01 AM
To: oracle-l@xxxxxxxxxxxxx
Subject: Re: Display view equations?

Thanks for the quick reply.

I need it to dynamic and not hard coded. If I change the equation in the
primary view showing the results of the equation, the secondary view showing
the equation must auto update.

The "1 + 2" is just a simplification of what I am doing.

The equations that go into my views are actually very complicated scientific
calculations. The client wants to see the results of the equations plus the
actual equations used to calculate the results. 

I thought it be best to have it all dynamically (automatically) documented
instead of me having to manually type the equations into a manual that may
become outdated (wrong) when the equations are updated in the database
views.

Any more suggestions?

On Thu, 12 Jun 2008 08:48:31 -0500 piontekdd@xxxxxxxxx wrote:
> how about
> 
> create view test_calc_view as
>   select '1 + 2' "test_col" from dual;
> 
> ??
> SQL> create view test_calc_view as
>   2    select '1 + 2' "test_col" from dual;
> 
> View created.
> 
> SQL> select * from test_calc_view;
> 
> test_
> -----
> 1 + 2
> On Thu, Jun 12, 2008 at 8:39 AM, Lyndon Tiu <ltiu@xxxxxxxxxxxxx> wrote:
> 
> > Hi guys,
> >
> > Hypothetical situation.
> >
> > I have a view.
> >
> > The view has one field.
> >
> > The DDL:
> >
> > create view test_view
> > as
> > select 1 + 2 "test_col" from dual;
> >
> > Now if a user does this:
> >
> > select * from test_view;
> >
> > The output is:
> >
> > test_col
> > 3
> >
> > Now I need to be able to show to user the background calculation that
> > occurs in the view. Other than explcitly indicating it in a manual, I
> > want it to show up in the database as another view.
> >
> > So that the user can select * from see_view_calculations view and see
> > something like this:
> >
> > test_view.test_col
> > 1 + 2
> >
> > Any suggestions appreciated.
> >
> > Thank you.
> >
> > --
> > Lyndon Tiu
> > --
> > //www.freelists.org/webpage/oracle-l
> >
> >
> >
> 
> 
> -- 
> Bradd Piontek
> Twitter: http://www.twitter.com/piontekdd
> Oracle Blog: http://piontekdd.blogspot.com
> Linked In: http://www.linkedin.com/in/piontekdd
> Last.fm: http://www.last.fm/user/piontekdd/


--
Lyndon Tiu
--
//www.freelists.org/webpage/oracle-l




--
//www.freelists.org/webpage/oracle-l


Other related posts: