Insert the sequence inside the string number

Hello

What is the easiest way to insert sequences of numbers within the string, example

Can I have numbers of from 1 to 25, but I can't for the 'gaps', when this happens I filled with X

01020304050607080910 = > > > 01020304050607080910XXXXXXXXXXXXXXX
01030405060708091112 is > 01X03040506070809X1112XXXXXXXXXXXXX

How do I, I tried to use the TRANSLATE function, but no way






WITH the DATA (str) AS (SELECT ' 010203070911131516' FROM dual UNION ALL

SELECT "0205060809" FROM dual UNION ALL

SELECT '03050608091012' FROM dual)

, decompose AS (SELECT str, substr (str, (LEVEL - 1) * 2 + 1, 2) as ELEMENT, LENGTH (str) / 2 as items)

, MIN (substr (str, (LEVEL - 1) * 2 + 1, 2)) OVER (PARTITION BY str) AS min_element

, max (substr (str, (LEVEL - 1) * 2 + 1, 2)) OVER (PARTITION BY str) AS max_element

FROM THE DATA

CONNECT BY LEVEL<=>

and prior str = str

AND PRIOR sys_guid() IS NOT NULL)

COMPLETE AS (SELECT str, level elem

FROM (SELECT DISTINCT min_element, max_element, str

TO decompose) x

CONNECT BY LEVEL<= to_number(max_element)="" -="" least(to_number(min_element),1)="" +="">

AND str = str PRIOR

AND PRIOR sys_guid() IS NOT NULL)

SELECT c.str, listagg (NVL (d.element, 'X')) within the Group (order by c.elem)

C COMPLETE

LEFT OUTER JOIN decompose d ON (c.str = d.str

AND c.elem = to_number (d.ELEMENT))

C.str group

order of c.str;

HTH

Tags: Database

Similar Questions

  • Insert the next number primary key

    Hello
    I have students of the table than with the number of columns as the primary key stud_id, stud_no in number and varchar2 data type stud_name

    I need a pl/sql code used with the form generator that automatically inserts the next number in primary key
    When I want to insert a new record
    for example if the sql > select count (*) students;
    result = 11 means there are 11 students
    the code then between 12 as a new issue of stud_id then I will perform the registration manually.
    I'll start from the number
    Thank you

    Windows OS
    database to Oracle 10 g
    Oracle form builder 6i generator

    (1) it is not the right way to fill a primary key column. In addition to being very ineffective (as the table grows, grows the amount of work required to count all rows), it does not work for multi-user applications (number of sessions repeatedly see the same indictment and that you are trying to insert the same value).

    (2) the right way to generate primary keys is to create a sequence, i.e.

    CREATE SEQUENCE seq_student_id
      START WITH 1
      INCREMENT BY 1
      CACHE 100;
    

    and use this sequence in your INSERT statement, i.e.

    INSERT INTO students( stud_id, stud_no, stud_name )
      VALUES( seq_student_id.nextval, <>, <> );
    

    Justin

  • I have a MacBook Pro.  Is there a way to implement a rarely used keyboard key that - WHENEVER - it is pressed the computer will insert the string, predetermined character at the cursor position?

    I have a MacBook Pro.  Is there a way to implement a rarely used keyboard key that - WHENEVER - it is pressed the computer will insert the string, predetermined character at the cursor position?

    Yes. You can add in system preferences > keyboard > text.

  • I bought the upgrade to lightroom from Adobe site 6, regularly paid with credit card, receive e-mail of confirmation of payment and the serial number, just start the program installation insert the serial number provided to me by email and I get this wa

    Bought @I upgraded lightroom to Adobe site 6, regularly paid with credit card, receipt of payment confirmation e-mail and serial number, just start the program installation insert the serial number provided to me by email and I get this warning: COULD NOT VALIDATE THIS serial NUMBER for LIGHTROOM CALL SERVICE since the upgrade I paid I might have a valid serial number thanks

    Have you contacted service the customer the message instructed? Generally, we cannot help with password issues in this forum.

  • How to insert the phone number in icloud?

    How can I insert phone number in the I cloud id. There is no option to add the phone number.

    Hi, gurkiratfrommoga.

    Please visit Apple support communities.

    Looks like you want to add the number of your iPhone to iMessage and FaceTime.  If this is the case, please see the instructions below.

    If your phone number is missing on your iPad or iPod touch

    Disconnect from the iMessage and FaceTime on all your devices:

    1. Go to settings > Messages > send & receive. Enter your Apple ID, then tap Sign Out.
    2. Go to settings > FaceTime. Enter your Apple ID, then tap Sign Out.

    Reconnect to the iMessage and FaceTime on all your devices:

    1. Go to settings > Messages > send & receive. Click on use your Apple ID for iMessage. Then sign in with your Apple ID.
    2. Go to settings > FaceTime. Click on use your username for the FaceTime Apple. Then sign in with your Apple ID.

    Link your number of iPhone and Apple ID to use iMessage and FaceTime

    See you soon

  • Split the string number

    Hello

    I have string like below, and I want to divide and insert the numbers in another column.

    Example of

    ---------------

    test012345

    ABC] 9876

    Output should be as below so that once I am able to split can insert into 2 separate table columns

    test 012345

    ABC] 9876

    Try this

    with t as

    (

    Select 'test012345' c all the double union

    [Select ' abc] 9876' double

    )

    Select col1, col2 regexp_replace(c,'[^[:digit:]]') t regexp_replace(c,'[[:digit:]]')

    COL1 COL2

    ---------- ----------

    test 012345

    ABC] 9876

    2 selected lines.

  • check the string number

    Hello

    In my application, TestStand receives a response from a DLL I give the floor. This DLL can return either a numeric value (casting in a string), as "120" or some sunk in a text string, as a "MISTAKE." I would like to make the test step fails, if the return string is NOT a number.

    Someone at - it a clues on how to do it? I tried something like an IsNumeric function, but couldn't find one.

    Jeroen

    Hello

    You can use the Val (string, ) function in an expression to convert your value chain. Check using this function.

  • Insert the string xml in a clob column. ??

    https://drive.Google.com/file/d/0BwAVQqYmX0-zMHZiS1F0SVdOMmc/view?USP=sharing

    DECLARE
            v_clob CLOB := to_clob('xml string from local file'); --pls. download xml file from above url;
            stmt NVARCHAR2(500) := 'INSERT INTO TEST(XMLDATA) VALUES(:x)';
    BEGIN
            EXECUTE IMMEDIATE stmt USING v_clob;
    END;
    

    If I use xmltype so I can use XMLType (bfilename ('test_dir', '"Data.xml" '), nls_charset_id ('AL32UTF8'))

    but I have to use clob for storing the xml string. because oracle xmltype cannot correctly parse these xml data. ;

    Google search for 'oracle insert clob from the file' would you find this answer fairly quickly.

    You don't need to use dynamic sql statements.

  • The string number fails when letter after the number?

    kind of confused I hope someone can answer this question. I have a function to verify that a string is a number as such.

    
    
    
    isNaN(parseInt(num));
    
    
    
    return !isNaN(parseInt(num));}
    
    
    Public function isNumeric(num:String):Boolean             { 
    


    so, if a shipment in the 'aa' value, it returns false. Great! However, if I send '1a', it returns true. However, it is not a number? can anyone offer suggestions. I ti I test more away this by looking at what value the function it's after I have send value "1a" and he thinks that the value is '1', so I guess my only other option to stop this would be to move the channel to a table and to loop through the entire string looking for non-numeric values? what I do?

    Miguel

    Maybe try to use instead of parseInt number?

    public void isNumeric(num:String):Boolean {}

    return! isNaN (Number (num));

    }

  • Retrieves the string number

    Hello world.

    Thank you to everyone who helps everyone. I need your help

    1. Select regexp_replace ('Add freon to a 1/2 ',' [^ [: digit:]]') twice;

    I am trying to execute the query and I make the output voltage

    Output

    ----------

    12

    But I need the output voltage

    Output

    -----------

    1/2

    2. Select regexp_replace (' add 5 * freon ',' [^ [: digit:]]') twice;

    Output

    ------------

    5

    second query is good but for the first query, I need "/" to be displayed in the output.

    Like this?

    Select regexp_replace ('Add freon to a 1/2 ',' [^ [: digit:] /]') twice;

  • Inserting the object in a datagrid data

    Hi guys.

    I'm building a flex application with data from webservice. The result of the Web service looks like to stuck the coded in at the buttom.

    An array of person objects each with a unique inside info-object. Everything is right for the part firstname and lastname, I can use the following code - where event.result is the answer of my webservice:

    var arrResult:ArrayCollection = new ArrayCollection();
    arrResult.source = event.result.toArray ();
    DG1. DataProvider = arrResult;
    firstnameField.dataField = "first name";
    lastnameField.dataField = "name";

    But what happens if I want to insert the phone number in the 3rd column called phoneField? I like to use:

    phoneField.dataField = "Info.Phone"; Does not...

    but this does not work, I guess that's because flex does not know if there is one or 10 info-objects inside each person object.

    So, how can I do?

    I see that I can use Person (arrResult.getItemAt (0)). Info.Phone to retrieve the value of the object-specific one (the first in the result here, but how to fill in all the for each person in the grid?)

    Thanks in advance.

    / Nibby

    "Myonlycrummynick" wrote in message
    News:gli9f9$APQ$1@forums. Macromedia.com...
    > Hi guys.
    >
    > I'm building a flex application with data from webservice. The
    > result
    > Web service looks like to stuck the coded in at the buttom.
    >
    > Array of person objects each with a unique inside info-object. All the
    > is
    > good for the firstname and lastname part, I use the following code.
    > where
    > event.result is the answer of my webservice:
    >
    > var arrResult:ArrayCollection = new ArrayCollection();
    > arrResult.source = event.result.toArray ();
    > dg1.dataProvider = arrResult;
    > firstnameField.dataField = "first name";
    > lastnameField.dataField = "name";
    >
    > But what happens if I want to insert the phone number in the 3rd column called
    > phoneField? I like to use:
    >
    > phoneField.dataField = "Info.Phone"; Does not...

    Try rather labelFunction.

    HTH;

    Amy

  • How to put the serial number in XP Home Edition

    A friends computer has been infected with three Trojan virus that touched the MBR, as well as the entire disk.

    "I have eliminated the virus in all but the MBR, then supported the drive I have rebuilt the WD (of zeros) drive and reformatted it using a different boot CD, its had disappeared a long time ago"

    I then restored the backup file to completely replace the boot CD.

    I try inserting the serial number on the side of the computer

    How to accomplish this task?

    "Serial number" is ambiguous.  Do you mean the 25-character Windows product key?

    In addition, "restored the backup file to completely replace the boot CD" is ambiguous.  If the backup file is a disk image, then the product key (if that's what you mean by serial number) has been included in the image.

    To save time-

    If you are referring to the product key, and if the backup file was NOT a disk image, and the "boot CD" you used was the same flavor of XP (Home/Pro, retail/OEM) initially installed, you can replace the product key by following the steps here--> http://pcsupport.about.com/od/productkeysactivation/ht/changexpkey.htm

  • Add the string with another string.

    I got the text of the source XML document to appear in the BrowserField

     src="wp-content/uploads/2011/01/Chris_bild.jpg" 
    

    I thought too much about it.  The question is more simple I thought originally.

    How can I programmatically insert the string "fie: / / / store/home /" in the string above, so he says?

    src="fie:///store/home/users/wp-content/uploads/2011/01/Chris_bild.jpg"
    

    find the index you want to manipulate, for example using indexof("src=")

    use substrings and add up the parts you want.

  • Where to find the serial number of first 10 items?

    I need to spend the first 10 items from a desktop to my new laptop.  What I've read, I'm supposed to download it from Adobe and insert the serial number to a place in time.  However I do not know where to find the serial number. Where?  Thank you!

    DressageVid

    If you bought the first 10 Elements as a download Adobe online, the installation files should be made available to you after you Sign-In of Adobe under the orders of my at http://www.adobe.com.

    You should have the serial number. But your only hope is that you will find after Adobe Sign In in your Adobe account under my products at http://www.adobe.com. First 10 Elements should be included, and if clicked, would reveal your serial number.

    Please let us know the result.

    Thank you.

    RTA

  • PL/SQL insert new string in the string specified to a specific Position

    Hello

    I would like to know the way to insert the new string into the used rope to the specific position. Is there a syntax for the same thing?

    Example:

    Old rope: D100

    New string:APPROX100 D

    Thank you

    Something like that

    DECLARE
      L_VARIABLE          VARCHAR2 (100) := 'D100';
      L_POSITION          NUMBER := 2;
      L_APPENDED_STRING  VARCHAR2 (100) := 'ENV';
      L_NEW_VARIABLE      VARCHAR2 (100);
    BEGIN
      SELECT    SUBSTR (L_VARIABLE, 1, L_POSITION - 1)
              || L_APPENDED_STRING
              || SUBSTR (L_VARIABLE, L_POSITION)
        INTO L_NEW_VARIABLE
        FROM DUAL;
    
      DBMS_OUTPUT.PUT_LINE ('INITIAL VALUE IS ' || L_VARIABLE);
      DBMS_OUTPUT.PUT_LINE ('REQUIRED VALUE IS ' || L_NEW_VARIABLE);
    END;
    

Maybe you are looking for