Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to obtain text of a view definition

3049977Mar 8 2016 — edited Mar 8 2016

Hi, thanks for taking the time to read my question.

I need to get the definition of a view that was defined by others.  Note that I am not a DBA on this database.  

I tried to query ALL_VIEWS to get the text definition of the view.   Problem is, ALL_VIEWS defines the TEXT column as type LONG.  

Column definitions for ALL_VIEWS can be found here http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2117.htm#REFRN20305 

So I need either 1) a different way to get the text of the view or 2) a way to convert LONG to VARCHAR2 so that I can display it.

I discovered that 2) is a question that has been asked on this forum about a bazillion times.   However, though it has been asked a bazillion times, I couldn't find a thread that had an answer.    Most of the threads simply say "don't use long, its been deprecated for 15 years. Use CLOB instead".    Unfortunately that's not an option for me.

So, with apologies for asking an question that has been asked before, how do you convert LONG to VARCHAR2 in an SQL statement?  

Here are some things  I tried that didn't work....

SELECT TO_CHAR(TEXT) FROM ALL_VIEWS

SELECT UTL_RAW.CAST_TO_VARCHAR2(TEXT) FROM ALL_VIEWS

Thanks!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2016
Added on Mar 8 2016
19 comments
66,704 views