Update part of the string

Hello,
please, I have million of records and I need to replace LAST THREE characters, regardless of what they are,  in column that is always of the same length e.g.,1234abc need to be:
1234000
i.e., to keep first four characters!
thanks

Hi,
  If your column data type is of datatype varchar(max) or nvarchar(max)
  you can use the WRITE clause in the UPDATE statment
DROP TABLE tblupdatewrite
CREATE TABLE tblupdatewrite
c1 VARCHAR(MAX)
INSERT INTO tblupdatewrite
SELECT '12345abc'
UPDATE tblupdatewrite
SET C1.WRITE('000',LEN(C1)-3,3)
SELECT * FROM tblupdatewrite
Best Regards Sorna

Similar Messages

  • Converting part of the string to a date and subtract with sysdate.

    HINT! In order solve this you must know how the pnr is assembled. Study this:
    650323-5510, we only need the first six characters. They inform us about when the person (car owner) was born. In this case it is 23 Mars 1965. You have to use several oracle built-in-functions to solve this. Hint! Begin by converting part of the string to a date and subtract with sysdate.
    select to_char(to_date(cast(pnr,'YYMMDDMM'))) from car_owner;
    please what am i doing wrong. i need the result to be something like this
    Hans, Rosenboll, 59,6 years.

    Hi.
    The main problem here is you have only last two digits of year. That could be the problem in a couple of years from now, when somebody born after 2k would get in to your database. For now if we ignore this problem the right solution would be :
    <code>
    SELECT months_between(trunc(SYSDATE),
    to_date('19' || substr('650323-5510',
    1,
    6),
    'YYYYMMDD')) / 12 years_old
    FROM dual
    </code>
    Suppose you are expecting the age of the car owner as a result above code will give you that. One again notice the '19' I appended.
    Best regards.

  • Why doesn't the update part of the App Store work?

    Why doesn't the update part of the App Store work? It says I have an update and the screen is white. I've already restarted the phone. Every other part of the App Store works. I have the iPhone 4. Upgraded a week ago to iOS6 and it was working fine up until yesterday. Not sure what to do? Help!

    Why doesn't the update part of the App Store work? It says I have an update and the screen is white. I've already restarted the phone. Every other part of the App Store works. I have the iPhone 4. Upgraded a week ago to iOS6 and it was working fine up until yesterday. Not sure what to do? Help!

  • Addressing of part of the string in the container

    Hello,
    in a mail task I would like to print only some characters from a string - e.g. from second to tenth - is it possible to address some part of the string in the container as is usual in abap?
    thx,
    JJ

    Hi,
    Yes , it is possible. If you want to show only some part of the string value in mail description you can use normal abap string operations. For example: In Mail description if you want to show only a part variable VALUE. you can just use &VALUE+a(b)&. It will work !!
    You can try it out !!
    Regards
    Krishna Mohan

  • Using INSTR to extract part of the string ?

    Morning guys and Happy Friday.
    I have a situation where I have to pull out part of the string using a select statement.
    Here is the string and I have to get the contents between the 2nd and 3rd backslash. So, basically, I have to extract marypoppins. Any ideas ?
    C:\USERS\marypoppins\Docs\SpecificationHere is where I started ... and I have stumbled upon trying to find the 3rd backslash. I can easily start the INSTR at 4 because I know that it will always be 'C:\'
    select select substr(C:\USERS\marypoppins\Docs\Specification',
                                INSTRB('C:\USERS\marypoppins\Docs\Specification', '\', 4), .....) from dual;

    Additionally you can break it all up simply with regular expressions..
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'C:\USERS\marypoppins\Docs\Specification' as txt from dual)
      2  -- END OF TEST DATA
      3  select rownum, regexp_substr(txt, '[^\]+',1,rownum) as element
      4  from t
      5* connect by rownum <= length(regexp_replace(txt,'[^\]'))+1
    SQL> /
        ROWNUM ELEMENT
             1 C:
             2 USERS
             3 marypoppins
             4 Docs
             5 Specification
    SQL>

  • To validate each part of the string

    Hi,
    In one string, we have these
    ID_A,ID_B,ID_C, ..., ...
    I know that there's a way in PL/SQL to divide it into several parts and each part is for one ID. But can I expect that to divide the string into several parts, and then to store all IDs in something like an Array, in PL/SQL? Is this possible, though I know there's no array field type in PL/SQL?
    Regards,
    huamin

    xtender wrote:
    You can use my package xt_regexp - http://github.com/xtender/XT_REGEXP
    To install execute in this order:     types.sql,     xt_regexp.jsp,     xt_regexp.pck
    Example:
    with t as (
    select 'ID_A,ID_B,ID_C,' str from dual
    union all
    select 'ID_A,ID_B,ID_C,ID_D' str from dual
    select
    t.*,
    row_number() over (partition by t.str order by t.str) substr_number,
    substring.column_value substring
    from t,
    table(xt_regexp.split(t.str,',')) substring
    That's nice, but you may want to benchmark that against an approach that doesn't make a bunch of external calls (for performance)...
    with t as
      select 1 as id,'ID_A,ID_B,ID_C' str from dual
        union all
      select 2 as id, 'ID_A,ID_B,ID_C,ID_D' str from dual
    select
      t.*,
      regexp_substr (t.str, '[^,]+', 1, s.column_value) as split
    from
      t,
      table( cast (multiset (select level from dual connect by level <= length(regexp_replace(t.str, '[^,]+'))  + 1) as sys.odcinumberlist)) s
         ID STR                 SPLIT
          1 ID_A,ID_B,ID_C      ID_A
          1 ID_A,ID_B,ID_C      ID_B
          1 ID_A,ID_B,ID_C      ID_C
          2 ID_A,ID_B,ID_C,ID_D ID_A
          2 ID_A,ID_B,ID_C,ID_D ID_B
          2 ID_A,ID_B,ID_C,ID_D ID_C
          2 ID_A,ID_B,ID_C,ID_D ID_D
    7 rows selected.
    Elapsed: 00:00:00.02
    TUBBY_TUBBZ?For example.

  • Display only part of the STRING field, but search ALL field

    Hi all,
    I have a field VARCHAR2(4000) that holds a lot of text.
    When I make a report in APEX, it shows in each row, ALL text, so the report is very "ugly".
    I want to limit the display of that column for only the first 60 characters.
    I tried to use the SUBSTR function, that worked, but the search option will search for the text only in that 60 lenght characters, and will now search in the rest (not displayed) part of the field.
    Is there a way to do this full search and display only part of the field?
    Thanks

    You can have the 'substring' column displayed to the user, but have another column which shows the full text lets say it has an ALIAS of "*SEARCH_LARGE_TEXT*" in the report definition(and is among the displayed columns).
    You can hide the large text column(SEARCH_LARGE_TEXT) using JS as
    $('th[id="SEARCH_LARGE_TEXT"],TD[headers^="SEARCH_LARGE_TEXT"]').hide()
    Note: ^= syntax used to match data column even when break formatting used
    You can make sure that the column stays hidden even after an IR filter or refresh by binding it to the refresh event of the IR by
    $('#apexir_WORKSHEET_REGION').bind('apexafterrefresh', function(){ 
      $('th[id="SEARCH_LARGE_TEXT"],TD[headers^="SEARCH_LARGE_TEXT"]').hide()
    change the string "SEARCH_LARGE_TEXT" with your column's alias
    Hope it helps

  • Get a part of the string

    Hi SAP gurus 
    i have a string where i need to eliminate 'A.B.N' from the following string please advice
    as i am new to xslt i am not sure how
    xsl:value-of select="concat('A.B.N. ',$vABNNameValue)"/
    this is the part of the xsl i am trying to change the above statement in .
    :for-each select="/ORDERS02/IDOC/E1EDKA1" >
                                        <xsl:if test="PARVW = 'LF' ">
                                            <Name3>
                                                <xsl:variable name= "vABNNameValue">
                                                     <xsl:value-of select="''" />
                                                     <xsl:for-each select="E1EDKA3" >
                                                        < xsl:if test="QUALP = 'ABN' ">
                                                            <xsl:if test="STDPN != ''">
                                                                 <xsl:value-of select= "STDPN"/>
                                                             </xsl:if>
                                                         </xsl:if>
                                                     </xsl:for-each>
                                                 </xsl:variable>
                                                 <xsl:choose>
                                                     <xsl:when test= "$vABNNameValue != ''">
                                                        < !xsl:value-of select="concat('A.B.N. ',$vABNNameValue)"/-!>
                                                        <xsl:value-of select="concat(' A.B.N. ',$vABNNameValue)"/>
                                                        <!<xsl:value-of select="$vABNvalue"/>>
                                                    </xsl:when >
                                                    <xsl:otherwise >
                                                        <!-- OVSD Call 324728 End -- >
                                                        < xsl:variable name="Name3Test">
                                                            <xsl:call-template name="Template_GetE1EDKA1Name3">
                                                                 <xsl:with-param name= "TestValue">LF</xsl:with-param >
                                                            < /xsl:call-template>
                                                        < /xsl:variable>
                                                        < xsl:if test="$Name3Test != ''" >
                                                            <xsl:value-of select="$Name3Test"/ >
                                                        </xsl:if >
                                                        <!-- OVSD Call 324728 Begin -- >
                                                    < /xsl:otherwise>
                                                < /xsl:choose>
                                            < /Name3>
                                        < /xsl:if>
                                    < /xsl:for-eac
    please advice its so urgent i have a production issue
    i know there is a function substring
    thanks

    Have a look at this
    http://www.w3schools.com/xpath/xpath_functions.asp#string
    i guess this might be useful to you :
    <b>replace(string,pattern,replace)       </b>
    Returns a string that is created by replacing the given pattern with the replace argument
    Example: replace("Bella Italia", "l", "")
    Result: 'Bea Itaia'
    in your case
    <b>replace("someA.B.Nssss","A.B.N","")</b>
    I think it would work. try this....
    PS: award points if answer helps you.
    thanks,
    Pooja

  • Variable for restriction based on part of the String

    Hello Experts,
    I have a characteristic named Product Hierarchy (0PRODHIER) in the query. I want to create a variable so that the report displays the results based on the first character of 0PRODHIER.  How can this be achieved?
    Thanks,
    Rishi

    Hi Mayank
    Thanks for your response. I knew that we can do this at the Cube level but I was just wondering if there is any other way to achieve this at the BEx level.
    Thanks
    Rishi

  • Remove some portion of the String

    Hi,
    My problem is String contains data is
    artist1
    title1
    -1
    artist2
    title2
    2
    artist3
    title3
    -1
    artist4
    title4
    2
    i want to remove some portion of the string like artist2, title2, 2 so my updated string should be like
    artist1
    title1
    -1
    artist3
    title3
    -1
    artist4
    title4
    2
    Here i am using String.replaceAll("artist2","");
    String.replaceAll("title3","");
    String.replaceAll("2","")("[\code]
    its deleting whole data in a string, can any one please help me how to delete particular part of the string. Here artist and title are unique and no are reapeated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hey I had the same problem like you yesterday.
    I tried using regEx with positiv lookahead but noticed that there was a problem when the String went over multiple lines. There is probably some solution to it that i havent found yet.
    So what I did was get the Index of the first text I wanted deleted(in your case I guess "artist2"). Then got the Index of the end of the deletion point(In your case the "2"?) and then formed a new String with the substring from the orginal one and the indexes of the two deletion points.
    Sounds kinda dirty but it did work out. Anyway I'll dig myself into regular expressions more today because if you get them to work, they're a charm :)

  • Recording Audio Cuts off the first part of the region?

    Hi. When i record audio the regions show up after recording and i have to pull the beginning of the region back a bit so that i can see the full length of the audio recording. Its non destructive but very annyoing. How can i stop it doing this everytime? Thanks

    Thanks Mike for replying
    But the thing is; I want to perform a computation process on the list manager values to trim off the first part of the string. I have the dynamic lov for list manager. But when I insert/update list manager item values I don't want the first part of string in the database.
    Please help with the function. i was trying the below function but it doesn't work; errors out saying
    ORA-06550: line 16, column 14: PLS-00597: expression 'V_ARRAY_1' in the INTO list is of wrong type ORA-06550: line 17, column 9: PL/SQL: ORA-00904: : invalid identifier ORA-06550: line 15, column 7: PL/SQL: SQL Statement ignored
    {code}
    DECLARE
       v_array          apex_application_global.vc_arr2;
       v_array_1         apex_application_global.vc_arr2;
       v_string         VARCHAR2 (32767);
       BEGIN
       -- Convert delimited string to array
       v_array :=
          APEX_UTIL.
           string_to_table (:P3_LM_USES);
       FOR i IN 1 .. v_array.COUNT
       LOOP
          SELECT LTRIM (SUBSTR (v_array (i), INSTR (v_array (i), '..') + 2))
            INTO v_array_1
            FROM DUAL;
    v_string := HTMLDB_UTIL.table_to_string(v_array_1,':');
    apex_application.g_print_success_message := apex_application.g_print_success_message || v_string;
             END LOOP;
    RETURN (v_string);
    END;
    {code}
    Thanks,
    Orton

  • Delete part of a string question

    Hello I have this String 12a
    I need to get a the value 12 of it an make it an int
    But the problem is that I don't know what the string is it can be
    12
    or 12 a
    or 12a
    It is for people to fill in there house address and this is the number part.
    The string is like this String number ="\"12a\"";
    Is it possible to look for a letter in a String and delete it if you only want ints???

    Try this on the command line. Dealing with java.lang.NumberFormatException in cases where the number is too large is left as an exercise.
    Harald.
    import java.util.regex.*;
    * demonstrates use of <code>java.util.regex</code> to check if a
    * string starts with digits.
    public class bla {
       * thrown by {@link #getNumber} if the given string does not start
       * with digits.
      private static class BoomBoom extends Exception {
        public BoomBoom(String msg) {super(msg);}
       * reusable pattern to check for digits.
      private static Pattern p = Pattern.compile("[0-9]+");
       * convert leading digits of the parameter to an <code>int</code>
       * and return it.
       * @throws BoomBoom if the parameter does not start with digits.
      public static int getNumber(String s) throws BoomBoom {
        Matcher m = p.matcher(s);
        if( !m.lookingAt() ) {
          throw new BoomBoom("The string `"+s+"' does not start with "
                    +"a positive number.");
        return Integer.parseInt(m.group(0));
      // don't clutter the javadoc
      private bla() {}
       * passes each command line argument through {@link #getNumber} and
       * prints the output or error to <code>System.out</code> or
       * <code>System.err</code> respectively.
      public static void main(String[] argv) {
        for(int i=0; i<argv.length; i++) {
          try {
         System.out.println("Your string `"+argv[i]
                      +"' starts with number "
                      +getNumber(argv));
    } catch( BoomBoom e ) {
         System.err.println(e.getMessage());

  • How to replace part of a String with another String :s ?

    Got a String
    " Team_1/Team_2/Team_3/ "
    And I want to be able to rename part of the string (they are seperated by '/'), for example I want to rename "Team_3" to "Team C", and "Team_1" to "Team A" while retaining the '/' character how would I do this?
    I have tried using String.replace(oldValue, newValue); but this doesnt work, any ideas?

    What do you mean that it doesn't work? You do know that the method returns the modified string? The actual string that you invoke the method on is not altered.
    /Kaj

  • CS3: grep search to replace part of a string

    Can I do a grep search for a string of text but only replace a portion of the string while leaving the remainder intact?
    iMac G5, OS 10.5.5

    In addition to Eric:
    Find "some search string", Replace "some replacement string " also replaces part of the string, not touching anything...
    But the GREP search has two advantages: First, if you define formatting in the Replace field (italics, superscript, a character style), only the 'search'/'replacement' part will be affected, rather than the entire found string (as in regular search).
    The second big advantage is you can use any regular GREP single character wildcard in the 'left' and 'right' (matching-but-not-marking) parts. A few useful examples: '\d' (digit), '\l' and '\u' (lowercase and uppercase), '.' (any character), or even '[a-f]' (lowercase 'a' to 'f'). The only limitation is that you cannot use the once, zero-or-more, or once-or-more modifiers -- the strings must have a fixed length. FYI, those three modifiers are, respectively, ?, *, and +.
    This restriction does not apply to the 'middle' string, the one you are going to replace anyway -- use whatever GREP you want.

  • Grep to replace only part of the found text

    I'm using ^.+~> to search the begging of a paragraph up to an EN space, but is it possible with GREP to format just PART of the string found?
    There are roman numerals that precede a period and an EN space and I want to apply formatting to just the roman numerals, leaving the period and EN space alone.
    I did found one post that mentions using "some" but I'm not familiar enough with GREP to know how it works.
    Can anyone commend a good source for GREP coding?
    Thanks,
    Ken

    Try this:
    ^(.+)(?=\.~>)
    I just changed your original code to use the period and en-space as a positive lookahead -- it'll only find characters at the beginning of the line if they're followed by a period and an en-space, but will not include them as part of the found text.
    If these items all have the same paragraph style applied to them and that style isn't used anywhere that you wouldn't want the formatting, I'd also consider setting this up as a GREP style. You could also do it as a nested style applying your character style up to (.~>). (Don't include the parantheses - I was just trying to make it clear what the expression to use is.) 
    Hope that helps.

Maybe you are looking for

  • Third party payload installer DistillrStarter.exe failed with exit code: 1603

    I need to reinstall FrameMaker 11 after a system crash. At 99% of the installation process, I get the following message. (For my understanding, downloading a new DistillrStarter.exe should solve the issue. The file is for creating Japanese PDFs. I do

  • Save sitemap in Dreamweaver CS6

    I can see the site map in the site navigation map view but when try to save it by going to File/save site map, I never get a dialog box.  I have no idea if it is saving and if it is where.  I am trying to have Google crawl my site but the Google mana

  • Anyone know what this device is? Guitar - Computer

    If you go to http://www.apple.com/ilife/garageband/ and watch the main video (left hand side) at 1:02 you see a device that is used to plug the guitar into the computer. Anyone know what this specific device is? Also does anyone have any experience w

  • How to reset auto completion?

    Hello, I know how to disable the auto-completion in Numbers but how can I reset this feature? In some cells it completes integer numbers to dates but only the zeros and the ones and not in every table of the document. Regards, Steffen

  • Problems with photo in movieclip

    Hello everyone, I'm working on a mobile application with Flash Lite. I want to load some photos into a movieclip. I use a SQL database and one field is called 'photo1_huis'. The URL in that field is http://www.eventeffects.nl/FundaMobile/1/foto1_huis