Substring Procedure for Long Data Type

Posted on 2006-04-13
Last Modified: 2008-02-01
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.
Question by:cyberonics
    LVL 9

    Expert Comment


    Author Comment

    Thanks raopsn. Whats the syntax to run it. I can't seem to figure his out.
    LVL 9

    Accepted Solution

    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


    Author Comment

    Excellent solution.
    Thanks raopsn

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
    In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now