Substr -instr

What's the best way to remove a word from a string?
If I have:
select 'xyz Dell product' product from dual
union all
select 'Intell product' product from dual
and I want to remove the beginning xyz word from the string so that I get:
select 'Dell product' product from dual
union all
select 'Intell product' product from dual

Hi,
Is this what you're looking for?
CREATE TABLE     table_x
AS
select 'xyz Dell product' product from dual
union all
select 'Intell product' product from dual
SELECT     product
,     CASE
         WHEN  SUBSTR (product, 1, 4) = 'xyz '
         THEN  SUBSTR (product, 5)
         ELSE  product
     END          AS no_xyz
FROM     table_x
;Output:
PRODUCT          NO_XYZ
xyz Dell product Dell product
Intell product   Intell productIf you really want to use INSTR, here's one way to get the same results:
SELECT     product
,     CASE
         WHEN  INSTR (product, 'xyz ') = 1
         THEN  SUBSTR (product, 5)
         ELSE  product
     END          AS no_xyz
FROM     table_x
;This will not remove 'xyz ' from elsewhere in the string, as you specified:
Rinne wrote:
... and I want to remove the beginning xyz word from the string ...Edited by: Frank Kulash on Oct 28, 2010 9:20 AM

Similar Messages

  • Dynamic PL/SQL & substr, instr function

    I am having trouble with incorporating the SUBSTR and INSTR functions into my dynamic PL/SQL procedure using Oracle 8i.
    I have data that is packed into one column seperated by a delimiter (':')
    I need to seperate the data to use indicidual pieces.
    If I run my query in general -
    select substr(secondcol, 1, instr(secondcol, ':',1,1)-1) ONE,
    substr(secondcol,instr(secondcol, ':',1,1)+1,instr(secondcol, ':',1,1)-1) TWO,
    substr(secondcol,instr(secondcol, ':',1,2)+1,instr(secondcol, ':',1,1)-1) THREE,
    substr(secondcol,instr(secondcol, ':',1,3)+1,instr(secondcol, ':',1,1)-1) FOUR
    from temp_table where firstcol=100
    This works and gives me the right result.
    e.g
    DATA :
    Firstcol SECONDCOL
    100 1:2:3:4
    Result:
    ONE TWO THREE FOUR
    1 2 3 4
    However to make this generic if I use it in a function passing it a parameter which has ':' delimited data it does not work and gives me errors. All I want is to get the output as a string that looks like my query above so I can use it in my proc.
    create or replace function MYJUNK(TFieldNew IN CHAR)
    RETURN CHAR IS
    UpdateString Varchar2(100);
    BEGIN
    UpdateString := 'First=substr('||TFieldNew||', 1, instr('||TFieldNew||', '':'',1,1)-1) ONE, ';
    UpdateString := UpdateString || ' Second=substr('||TFieldNew||', instr('||TFieldNew||', '':'',1,2)+1, instr('||TFieldNew||', '':'',1,1)-1) TWO, ';
    UpdateString := UpdateString || ' third=substr('||TFieldNew||', instr('||TFieldNew||', '':'',1,3)+1, instr('||TFieldNew||', '':'',1,1)-1) THREE from temp_table';
    return UpdateString;
    END;
    The function compiles but gives me run time errors
    This is what I get -
    SQL> select myjunk('''1:2:3:4''') from dual;
    select myjunk('''1:2:3:4''') from dual
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SGHDTA.MYJUNK", line 8
    ORA-06512: at line 1

    You are getting an error because updatestring is longer than the 100 characters you defined it as. Try using VARCHAR2(4000). Also, if you are trying to generate the sql statement, you need to get rid of first=, second= and third= when you build the string.
    This is what your function returns. I put in line breaks for clarity:
    First=substr('1:2:3:4', 1, instr('1:2:3:4', ':',1,1)-1) ONE,
    Second=substr('1:2:3:4', instr('1:2:3:4', ':',1,2)+1, instr('1:2:3:4',':',1,1)-1) TWO, 
    third=substr('1:2:3:4', instr('1:2:3:4', ':',1,3)+1,instr('1:2:3:4', ':',1,1)-1) THREE
    from temp_tableIf you are trying to actually parse the column, then you need something more like:
    create or replace procedure MYJUNK(TFieldNew IN VARCHAR2,out1 OUT VARCHAR2,
                                       out2 OUT VARCHAR2, out3 OUT VARCHAR2) is
    BEGIN
       out1 := SUBSTR(TFieldNew,1, INSTR(TFieldNew,':',1,1)-1);
       out2 := SUBSTR(TFieldNew, INSTR(TFieldNew,':',1,2)+1, INSTR(TFieldNew,':',1,1)-1);
       out3 := SUBSTR(, INSTR(TFieldNew,':',1,3)+1, INSTR(TFieldNew,':',1,1)-1);
    END;

  • Substr / Instr or Subquery

    Hi All,
    I have a requirement for which I am looking for solution, kindly do the needful.
    CREATE TABLE CO_VENDOR_COMMODITY
    (VENDOR_CODE VARCHAR2(240),
    COMMODITY_CODE NUMBER);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',1);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',2);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',3);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('25',4);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',1);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',2);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',3);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',4);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('20',5);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',21);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',22);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',23);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',24);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('30',25);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',15);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',16);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',17);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('40',18);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('35',15);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('35',16);
    INSERT INTO CO_VENDOR_COMMODITY VALUES ('35',17);
    CREATE OR REPLACE VIEW OV_VENDOR AS
    select
    VENDOR_CODE,
    rtrim (xmlagg (xmlelement (e,COMMODITY_CODE || ',')).extract ('//text()'), ',') commcode
    from
    CO_VENDOR_COMMODITY
    group by
    VENDOR_CODE;     
    Output should display as below
    VENDOR_CODE     COL1 COL2 COL3 COL4 COL5
    20 1 2 3 4 5
    25 1 2 3 4
    30 21 22 23 24 25
    35 15 16 17
    40 15 16 17 18
    as of now I have built the below query further I am not able to proceed.
    SELECT VENDOR_CODE,
    COMMCODE,
    SUBSTR(COMMCODE,1,(INSTR(COMMCODE,',',1,1) -1)) COL1,
    SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,1)+1),(LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,1)+1)))-LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,2)))))) COL2,
    SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,2)+1),(LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,2)+1)))-LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)))))) COL3,
    SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)+1),(LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)+1)))-LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,4)))))) COL4_1,
    SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,4)+1)) COL5,
    'SUBSTR(COMMCODE,('||INSTR(COMMCODE,',',1,3)||'+1),('||LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,3)+1)))||' - '||LENGTH(SUBSTR(COMMCODE,(INSTR(COMMCODE,',',1,4))))||'))' COL4
    FROM OV_VENDOR
    To acheive the above output whether I need use substr/instr or should I go for subquery? which one is best? It is possible to acheive the above output by using subquery?
    Thanks in advance.
    -Satyam

    Oh wait, I now see you want the commodity codes in separate columns.
    If you have a fixed maximum of possible commodity codes, you can use a subquery:
    SQL> select vendor_code
      2  ,      max(case when rn=1 then commodity_code else null end ) col1
      3  ,      max(case when rn=2 then commodity_code else null end ) col2
      4  ,      max(case when rn=3 then commodity_code else null end ) col3
      5  ,      max(case when rn=4 then commodity_code else null end ) col4
      6  ,      max(case when rn=5 then commodity_code else null end ) col5
      7  from ( select vendor_code
      8         ,      commodity_code
      9         ,      row_number() over (partition by vendor_code order by commodity_code) rn
    10         from   co_vendor_commodity
    11       )
    12  group by vendor_code;
    VENDO       COL1       COL2       COL3       COL4       COL5
    20             1          2          3          4          5
    25             1          2          3          4
    30            21         22         23         24         25
    35            15         16         17
    40            15         16         17         18

  • Substring instr issue in obiee

    Hi,
    I want to use the INSTR function in OBIEE
    POSITION function found in the forum
    INSTR function takes four values:
    INSTR (string1, string2, number, number)
    Eg IP address
    111.222.333.444
    The desired result
    SUBSTR (IP_ADD, 1, INSTR (IP_ADD, '.', 1,3) -1)
    111.222.333
    POSITION function, how should I use?
    Thanks,
    Mino

    1st example '0.0.0.0' will def be a problem here. Unfortunately, I don't think any other OBIEE string function could support this.
    I was assuming for min 2 numbers like 00.00.00.00. Do you have any case like the first one in your table ?
    =========
    As I said, you can't use POSITION function here..Just do help for String Function in RPD)
    Position
    Returns the numerical position of the character_expression1 in a character expression. If the character_expression1 is not found, the function returns 0.
    Syntax:
    POSITION(character_expression1 IN character_expression2)
    where:
    character_expression1
    Any expression that evaluates to a character string. Used to search in the second string.
    character_expression2
    Any expression that evaluates to a character string.
    So, these are the 2 expression, In your case its '.' & IP_ADDR.
    =========
    Hope its helpful

  • How to fetch data using Substring & Instring

    Hi ,
    I have data like
    a_76488b_2780c
    a_76488b_2780c_
    a_76488b_c2780
    a_76488b_c2780
    a_31487b_5542
    a_76488b_2780
    i want to fetch data like last 4 numeric digit only
    2780
    2780
    2780
    2780
    5542
    2780

    I don't know what you have against rexexp_replace, but this works if you want all the digits after the second underscore:
    WITH t AS
            (SELECT 'a_76488b_2780c' str FROM DUAL
             UNION ALL
             SELECT 'a_76488b_2780c_' FROM DUAL
             UNION ALL
             SELECT 'a_76488b_c2780' FROM DUAL
             UNION ALL
             SELECT 'a_76488b_c2780' FROM DUAL
             UNION ALL
             SELECT 'a_31487b_5542' FROM DUAL
             UNION ALL
             SELECT 'a_76488b_2780' FROM DUAL
    SELECT replace(after_second_und
                  ,replace(translate(after_second_und
                                    ,'0123456789'
                          ,NULL
                  ,NULL
                  ) your_number
    FROM   (SELECT   SUBSTR(str,instr(str,'_',1,2)+1) after_second_und
            FROM t
    YOUR_NUMBER
    2780
    2780
    2780
    2780
    5542
    2780

  • Substr/Instr/analytics question

    I have a table like this on 9i (soon to be 10g)
    CREATE TABLE BASELINE_TESTRUN
    RUNID VARCHAR2(42 BYTE) NOT NULL
    with data like this:
    insert into BASELINE_TESTRUN values ('DEV1-XXX-01');
    insert into BASELINE_TESTRUN values ('DEV1-XXX-03');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-01');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-02');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-03');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-05');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-06');
    insert into BASELINE_TESTRUN values ('DEV2-XXX-06');
    The output should be the next higher number of the last substring in runid
    DEV1-XXX 04
    DEV2-XXX 07
    There may be missing no, and/or duplicates.
    This was my Query for this - It works but seems rather clumsy. I would like to have done it in 1 SQL (avoiding the select from (select)):
    select runid , max (next_runno) next_runno
    from
    select substr(runid,1,instr(runid,'-',1,2)-1) runid,
    max(substr(runid,instr(runid,'-',1,2)+1))
    over(partition by substr(runid,1,instr(runid,'-',1,2)-1)) + 1 next_runno
    from baseline_testrun
    where instr(runid,'-',1,2) > 0
    ---where runid like 'whatever%'
    group by runid;
    Alternate solutions would be appreciated ... and NO I did not define that table like this.
    I would have preferred a sequence and a keys that was not composit (Codd/Date, pls. forgive the creators of the table)
    best regards
    Mette

    You are grouping you data. In this case an aggregate function could be more helpful than an analytic function.
    In 9i already you are be able to use the KEEP syntax for aggregates.
    Look at this example
    SQL> select substr(runid,1,instr(runid,'-',1,2)-1) group_run,
      2  to_number(
      3  max(substr(runid, instr(runid,'-',1,2)+1))
      4  keep (dense_rank last order by substr(runid, instr(runid,'-',1,2)))
      5  )+1 max_run
      6  from BASELINE_TESTRUN
      7  group by substr(runid,1,instr(runid,'-',1,2)-1);
    GROUP_RUN                                     MAX_RUN
    DEV1-XXX                                            4
    DEV2-XXX                                            7
    SQL> Dimas Version is better, since it avoids the keep syntax, that is not really needed for this special case.
    Message was edited by:
    Sven W.

  • Replace substr, instr with Reg_exp, is this possible,

    Hi Team,
    I have Small requirement below, i have writen Query For this but was thinking Is there Any better way Of
    doing it, esp With Use To reg_exp,
    i have Some code As shown below
    '23456_TR_ABC_CODE12_JPM-(1)100-(1)150'
    From this code i Only want portion which Is Between 'TR_' And '_CODE12' i.e. ABC,
    given Is my Query And its output
    Select
    substr( substr('23456_TR_ABC_CODE12_JPM-(1)100-(1)150',instr('23456_TR_ABC_CODE12_JPM-(1)100-(1)150','TR_',1,1)+3),
            1,
            instr(
                  substr('23456_TR_ABC_CODE12_JPM-(1)100-(1)150',instr('23456_TR_ABC_CODE12_JPM-(1)100-(1)150','TR_',1,1)+3),
                  '_',1,1
                  -1) "word"
    From dual;
            word
    1     ABC
    kindly let me know If there Is Any better way Of doing it,,,

    Jeneesh, in case there are several TR_ or _CODE12 in the line I'd advice to use non-greedy operators.
    SQL> with t as
      2     (select '23456_TR_ABC_CODE12_JPM_(1)_100_CODE12_ASJ' word from dual)
      3     select regexp_replace(word, '.*TR_<font color="red">(.*)</font>_CODE12.*', '\1') word
      4       from t;
    WORD
    <font color="red">ABC_CODE12_JPM_(1)_100</font>
    SQL>
    It is working with (+) sign.
    SQL> with t as
      2     (select '23456_TR_ABC_CODE12_JPM_(1)_100_CODE12_ASJ' word from dual)
      3     select regexp_replace(word, '.*TR_<font color="blue">(.+?)</font>_CODE12.*', '\1') word
      4       from t;
    WORD
    <font color="blue">ABC</font>
    SQL>
    But I don't understand why it is not working with (*) sign :((
    SQL> with t as
      2     (select '23456_TR_ABC_CODE12_JPM_(1)_100_CODE12_ASJ' word from dual)
      3     select regexp_replace(word, '.*TR_<font color="green">(.*?)</font>_CODE12.*', '\1') word
      4       from t;
    WORD
    <font color="green">ABC_CODE12_JPM_(1)_100</font>Maybe someone can explain?
    Several more examples:
    the first and the last of them are really strange, at least for me:
    SQL> with t as
      2     (select '23456_TR_ABC_CODE12_JPM_(1)_100_CODE12_ASJ' word from dual)
      3     select regexp_replace(word, '^<font color="red">.*</font>TR_<font color="red">(.*?)</font>_CODE12.*$', '\1') word
      4       from t;
    WORD
    <font color="red">ABC_CODE12_JPM_(1)_100</font>
    SQL>
    SQL> with t as
      2     (select '23456_TR_ABC_CODE12_JPM_(1)_100_CODE12_ASJ' word from dual)
      3     select regexp_replace(word, '^<font color="blue">.*?</font>TR_<font color="blue">(.*?)</font>_CODE12.*$', '\1') word
      4       from t;
    WORD
    <font color="blue">ABC</font>
    SQL>
    SQL> with t as
      2     (select '23456_TR_ABC_CODE12_JPM_(1)_100_CODE12_ASJ' word from dual)
      3     select regexp_replace(word, '^<font color="red">.*?</font>TR_<font color="red">(.*)</font>_CODE12.*$', '\1') word
      4       from t;
    WORD
    <font color="red">ABC</font>
    SQL>

  • Using substr / instr to parse a filepath help

    I'm having trouble parsing a string per say using sql. I have a column full of file paths. The file paths are similar to:
    C:\Users\Guest\Pictures\example.jp
    I want to be ablt to grab just the file name of the image. I've been working on several variations of a query using the substr function and the instr function. I've come up with the query below. FILEPATH is the name of the column. So far it gives me the file name, but has the '\' in front of it. Can anyone help me get rid of this. Thanks in advance.
    Select substr(FILEPATH, (instr(FILEPATH,'\',-1,1)))
    from Table_Name
    where ID = '101'

    Hi,
    Here's one way:
    SELECT  SUBSTR ( filepath
                   , INSTR ( filepath
                           , -1
                           , 1
                           ) + 1    -- Note   + 1   at end
                    ) AS file_name_only
    FROM    Table_Name 
    WHERE   id = '101'
    SUBSTR (str, p)        returns the last part of string str, starting at position p.  You were passing the position of the last '\' as p; that's why the '\' was included.  If you add 1 to p, like this:
    SUBSTR (str, p+1)      then you'll be passing the position of the 1st character after the last '\'.

  • How to use Substr & Instr to get data from a file

    hi i have a Scenario
    i am getting a file like this
    1,20,ram,sales
    i am getting a file like this data as a column
    i want to split this data in 4 different column like
    1     20      ram     Sales

    Hi,
    this query will help you.
    select
         SUBSTR(C1,0,INSTR(C1,',')-1),
         SUBSTR(C1,INSTR(C1,',')+1,INSTR(C1,',',1,2)-INSTR(C1,',',1,1)-1),
         SUBSTR(C1,INSTR(C1,',',1,2)+1,INSTR(C1,',',1,3)-INSTR(C1,',',1,2)-1),
         SUBSTR(C1,INSTR(C1,',',1,3)+1,INSTR(C1,',',1,4)-INSTR(C1,',',1,3)-1),
         SUBSTR(C1,INSTR(C1,',',1,3)+1)
    from (
         select '1,20,ram,sales' C1 from dual
    remember that a comma isn't really safe as field separator
    Message was edited by: DecaXD

  • Urgent: Need Help with Substring/Instring

    I am taking a user input P_User_Name.
    P_User_Name is firstname/middlename/lastname
    Some examples:
    'James/Earl/Jones'
    '//Madonna'
    'Alec//Baldwin'
    Can someone tell me the code in PL/SQL to extract first name, middlename, lastname for a given P_User_Name.
    I would really appreciate your help.
    Thanks
    Home722

    Duplicate/triplicate posting... pathetic!!
    Urgent: SQL Gurus: Please Help
    Substring

  • Urgent - INSTR() Functions in OBIEE?

    Hi All,
    I just got some very good help from the DB experts on these forums about solving a problem with a table join that I had.
    But now I have this SQL query and I'm trying to figure out how to implement this in OBIEE:
    select *
    from TABLE1,TABLE2
    where instr(TABLE2.USER_ID,TABLE1.USER_ID) > 0
    My question is how do I implement this instr() function on OBIEE? I checked physical and business model mapping layers in the repository and it does not allow me to configure this type of join. Is it possible to configure this type of join function to be invoked automatically everytime a user runs a certain query in OBIEE (as if it was a natural join)?
    Any help would be greatly appreciated.
    Alan

    Hi,
    You can refer the below links,
    Substring instr issue in obiee
    extract a string from a string
    http://108obiee.blogspot.in/2009_10_01_archive.html
    Award points it is useful.
    Thanks,
    satya

  • Substr issue

    I have a column called vehicle desc
    which will have this type of info in it:
    "2007 light blue Kawasakme Eclipse"
    or
    "2006 cream Toyotwa Forerunner"
    I need to pull this data into three separate columns called YEAR, MAKE, and MODEL.
    I can pull out the year with a simple substr, but as you can see the position of the make and model varies.
    Luckily there are only about 12 makes, and the model always follows the make.
    Any ideas? Do I have to make a long "case" statement or "with" clause?

    Here if only the last word in the string is MODEL then you can start cutting the string from end and cut it till first space from end of string.
    If MODEL includes the last two words then pick up the first letters of the words after the space from the end using substr, instr.

  • Chars - subString - String

    Good morning...
    I got a sub sequence of a string... n now I'm trying to use this sub string as a string... but the javac only tells me a warning like incompatible types...
    inputLine.subSequence(tamanho-contador,tamanho-(contador-5))
    I tryed to convert that charSequence (that java says me) and convert to a string.. but it brings me that java.lang.Object cannot be applied to java.lang.charSequence
    How may I do to take that substring n use like another independent string?
    I would like to put more three chars before convert it.
    Like:
    abc123def
    I took c123d using subSequence n I want to put more three chars "jav" to finally my string stay like c123djav
    How may I do to put more chars n convert it to a String? (In start I was suposed that the substring was a string... but it makes me an error....)
    Thanks...

    Ok... I used that
    String anT = inStr.substring(inStr.indexOf('c'), inStr.length()-2)+"jav";
    But it makes a warning like:
    subSequence(int,int) in java.lang.String cannot be applied to (int, java.lang.String)
    I think I need to mix the "jav" after take the string... c123d ... but even only taking that subSequence, and trying to put in a string, I have a warning like:
    incompatible types
    found: java.lang.charSequence
    required: java.lang.String

  • Need to convert long data type to varchar2

    I need to convert a long datatype in an existing table to a
    varchar2, in either another table or view. I have a 3rd party
    application which needs to query the data in the long data type,
    but it can "handle" the long.
    What is the best way to do this? I tried to make a trigger, but
    I must be missing something. Here is the trigger.
    CREATE OR REPLACE TRIGGER "PROD".SV_GET_RTG_COMNT
    BEFORE INSERT OR UPDATE ON PROD.RELS_RTG_SEQ_COMNT
    FOR EACH ROW
    WHEN (OLD.rels_rtg_no = NEW.rels_rtg_no)
    DECLARE
    -- DECLARE VARIABLES
    RTG_COMNT_VAR VARCHAR2(32);
    RTG_COMNT_LONG LONG;
    BEGIN
    Select COMNT_TXT into RTG_COMNT_LONG
    from rels_rtg_seq_comnt;
    RTG_COMNT_VAR := 'TEXT' || substr(RTG_COMNT_LONG,1,32);
    -- If INSERTING
    Insert into SV_RTG_SEQ_COMNT (print_cd, comnt_no,
    seq_no, rtg_no, comnt_txt) values
    (:new.print_cd, :new.comnt_no, :new.seq_no, :new.rels_rtg_no,
    rtg_comnt_var);
    END;
    I tried to use the substr command on the comnt_txt in view but
    received an invalid datatype error.
    Any help would be greatly appreciated.
    Doug

    create another table with clob datatype
    1)create table clob_tab(pkval number,clob_col clob);
    2) insert into clob_tab (select pkval,to_lob(long_col) from
    long_tab);
    3) use dbms_lob package to do string manipulation using
    substr,instr functions on clob column.

  • Getting all occurrences from a clob field

    I created a clob field to store an XML document. I have tried the SUBSTR, INSTR, REGEXP_SUBSTR, DBMS_LOB.INSTR functions to extract all occurrence of the XML tab <systemLink>.
    I just get 1 occurrence of the XML tag.
    Has anyone done this before.
    Thanks.

    All occurrences in a single row
    select extract(xmltype(your_clob_field),'//systemLink')
    from dualOr all occurrences in distinct rows
    select *
    from TABLE (XMLSEQUENCE (EXTRACT (XMLTYPE (your_clob_field), '//systemLink'))) ; Max
    http://oracleitalia.wordpress.com

Maybe you are looking for

  • Any way to use OBDC in SAP to access MySQL DB and retrieve data

    I'd like to logon to an external MySQL DB (can de done easily enough with PHP)   but I'd like to do it with ABAP if possible. Connecting via OBDC I should be able to retreive the data from the DB  and then use it in my SAP application. Some databases

  • Itunes does not read id3 tags and its a problem

    Ok I have 60 gig of music and all of it is labeled correctly in id3 tags. But when i add them all to itunes some of the songs are blank with no information at all but if i go into "show in explorer" the information in the id3 tags instantly pops up.

  • Branch office setup with L3 switch and router with IOS security

    Hello, I am in the process of putting together a small branch office network and I am in need of some design advise. The network will support about 10-15 workstations/phones, 3-4 printers, and 4-5 servers. In addition we will eventually have up to 25

  • ITunes crashes when backing up iPhone 4 on Windows XP

    Hopefully someone can help.. This is doing my head in.... I have the latest version of iTunes, v10.5, and the latest version of Quicktime installed on my desktop PC running Windows XP. I am trying to update the software on our iPhone 4's, and it does

  • Header Pricing Condition (SD)

    Hello, We have a header pricing condition type both applicable to header and line items. When manually putting an amount on the header, it automatically distributes the amount on the line items proportionally. When running in batch or IDoc via requir