Exforsys
+ Reply to Thread
Results 1 to 3 of 3

Please solve the follwing problems

This is a discussion on Please solve the follwing problems within the Oracle Database forums, part of the Database category; select strreplace('This is a beautiful day!', 'beautiful', 'horrible') from dual The given query selects the string 'This is a horrible ...

  1. #1
    purnarao80 is offline Junior Member Array
    Join Date
    May 2005
    Answers
    3

    Please solve the follwing problems

    select strreplace('This is a beautiful day!', 'beautiful', 'horrible')
    from dual

    The given query selects the string 'This is a horrible day!'. The string 'beautiful' is replaced by 'horrible'. Write the function strreplace.



    There is table itemfile.

    ITEMCODE VARCHAR2(7)
    ITEMDESC VARCHAR2(6)

    Write three queries:

    * Select Rows, which have only numbers in ITEMCODE field.

    * Select Rows, which have only chars in ITEMCODE field.

    * Select Rows, which have only chars & numbers both in ITEMCODE field.


  2. #2
    sarunraj is offline Junior Member Array
    Join Date
    Nov 2006
    Location
    Bangalore, India
    Answers
    16

    hi strreplace()

    function strreplace(parent_string varchar2(100), to_replace varchar2(50), replace_by varchar2(50)) return varchar2
    as
    string1 varchar2(100);
    string2 varchar2(100);
    final varchar2(200);
    begin
    string1 = substr(parent_string,1, instr(parent_string,to_replace,1,1) - 1)
    string2 = substr(parent_string,length(to_replace) + instr(parent_string,to_replace,1,1), length(parent_string))
    final_string = string1||replace_by||string2
    return(final_string);
    end;

    hope this helps,
    RaJ


  3. #3
    sanereddy is offline Member Array
    Join Date
    Nov 2004
    Answers
    85
    good one


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...