Re: Display view equations?
Date: Thu, 12 Jun 2008 23:33:51 -0400
Message-ID: <9c9b9dc90806122033r570281b7yfb307b495ae60a40@mail.gmail.com>
Here's another choice.
If you create the view with parsable tokens embedded within comments and then use regular expression to get what you want.
e.g.
create view test_view as
SELECT /*|*/ 1+2 /*|*/ calc FROM DUAL;
Now the following SQL can be used to retrieve the calculation:
SELECT regexp_substr( 'SELECT /*|*/ 1+2 /*|*/ calc FROM DUAL;', '[^|]+,1,2)
FROM DUAL;
which returns
*/1+2/*
You could then remove the first and last two letters in the substr to get at what you want.
One comment with this type of an approach. The USER_VIEWS presents the "text" as a LONG column. Regular expressions don't function on LONG columns. So the view you create might need to be a pipelined table function that handles the conversion to a string.
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Jun 12 2008 - 22:33:51 CDT