Substring Procedure for Long Data Type

Hi all I have a requirement in Oracle 10g to run the substring command on a long datatype in a table. For example this is what I would like to do.
note: col1 is LONG datatype

select substr(col1,1,2000), substr(col1,2001,4001)  from table1;
I'd also like to run the trim function if possible from start to end.

I remember someone in my last place had a pl/sql procedure with input/output variables. Can someone help.

Thankss all.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cyberonicsAuthor Commented:
Thanks raopsn. Whats the syntax to run it. I can't seem to figure his out.
These are the parameters for the function :

in_rowid rowid  
in_owner varchar
in_table_name varchar

You can call this in your query like this..

SELECT LONG_TO_CHAR(rowid, 'scott', 'table1', col1) as col1, col2, col3
FROM table1


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cyberonicsAuthor Commented:
Excellent solution.
Thanks raopsn
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.