String to number list

I have separate numbers by- and fate as string. I need numbers in select statements as a list of numbers.

Can someone please help me to get this done?

Example of a string: "7001-5001-8001.

I must use this as

Select * from table1 where id in ( 7001,5001,8001);

Any help on this will be greatly appreciated.

Based on Frank's proposal, Oracle has a blog about it

How to split string separated by commas and pass to the clause of the select statement

https://blogs.Oracle.com/aramamoo/entry/how_to_split_comma_separated_string_and_pass_to_in_clause_of_select_statement

Here's my example

DROP TABLE t1;

CREATE TABLE t1
(
ID NUMBER
);

INSERT INTO t1 VALUES (7001);
INSERT INTO t1 VALUES (5001);
INSERT INTO t1 VALUES (8001);
INSERT INTO t1 VALUES (9001);

COMMIT;

WITH datum AS
     (SELECT REPLACE('7001-5001-8001', '-', ',') AS token
        FROM dual)
SELECT *
  FROM t1
 WHERE id IN (SELECT TO_NUMBER(REGEXP_SUBSTR(token, '[^,]+', 1, LEVEL)) AS ids
                FROM datum
             CONNECT BY REGEXP_SUBSTR(token, '[^,]+', 1, LEVEL) IS NOT NULL);

The output is:

Elapsed: 00:00:00.02

        ID
----------
      7001
      5001
      8001

Tags: Database

Similar Questions

  • How convert string to number

    How convert string to number


    my character


    Select form double to_number ('1,6,9,4'); my putting here 1,6,9,4

    get the character of number conversion error.

    concerning

    Published by: vr on March 31, 2011 23:59

    Published by: vr on March 31, 2011 23:59

    VR says:
    Getting error while the conversion of character to the number in instring is possible to get the position of the channels at one time

    I have the following table, called pack

    Acct_No pack2 pack3 pack1
    1000 10101011 111111101 01010101111

    Select * Pack
    where instr (pack2, ' 1') and * (to_number (replace('1,6,9,4',','))); * - getting values of function as string '1,6,9,4'

    If you want to retrieve lines where the position of the first "1" in the pack2 chain is one of the positions in your list number e.g. position 1, 6, 9, or 4?

    Something with regexp_like can help...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with pack as (select '1000' as acct_no, '10101011' as pack1, '111111101' as pack2, '01010101111' as pack3 from dual union all
      2                select '1001', '10101011', '000011111', '10101010110' from dual union all
      3                select '1001', '10101011', '000000001', '10101010110' from dual)
      4  --
      5  -- end of test data
      6  --
      7  select pack.*, case when regexp_like('1,6,9,4','(^|,)'||to_char(instr(pack2,'1'),'fm9999')||'(,|$)') then 'Yes' else 'No' end as x
      8* from pack
    SQL> /
    
    ACCT PACK1    PACK2     PACK3       X
    ---- -------- --------- ----------- ---
    1000 10101011 111111101 01010101111 Yes
    1001 10101011 000011111 10101010110 No
    1001 10101011 000000001 10101010110 Yes
    
  • "Decimal string to Number.vi" bug in LabVIEW 2009 SP1

    The "decimal string to Number.vi' seems to be the conversion of the input data in the type int32 internally even when the input tape in vi data is expanded floating point (no points of constraint).  This is causing me grief.  See attached vi

    This bug is still present in LabVIEW 2010?

    Thank you

    Richard Ballantyne

    There is no bug. You use the wrong function (see Help) If you want a floating point output. Use Fract/Exp string to a number.

  • How to convert string to number in TS?

    Hello

    Anyone know how to convert string to number in TS?

    I couldn't find the Num() function.

    Thank you

    Val()

  • Whole singed to hexadecimal string to number converter

    HI guys...

    I want to convert the number to hex string to number converter but when I connect integer, otherwise it does not change the value (as if you write 'EC78' you should get "-5000", but I get the value in the range of 60 thousand ")...

    Any ideas?

    Thanks in advance...

    MADO...

    Hi Eric,.

    clearly, the OP asked for signed integers!

    Use this approach:

    ,

    It will mean by '-' 5000 for your example EC78h...

  • String conversion number

    Hi all

    I need to convert the string like "-73.28" to the number - 73.28. With decimal string to number Vi I get only - 73,00 output with "-73.28" Dim input As string. What I've done wrong? How to get the required results? Also, note that it must be. the number of output!

    Thank you!

    Hi Nina,

    Firstly: have the decimal separator ',' in a digital indicator is just for aesthetic purposes, you can always calculate using the value...

    (1) you can change the settings of the operating system (Win: settings regional aka regional Einstellungen). I do this for all my computers as it seems "natural" for me when working with scientists/measurement data

    (2) you can move LV to ignore the decimal separator system settings - you will find in the dialog box options...

    But when using properly formatted output functions you do not need to change any setting...

  • String to number conversion problem

    I have a VI that pulls in data from a device using VISA, and I got it on another computer to work a few weeks back. I had to transfer the VI to a laptop computer to run a few tests, and now I can't make it work. I am unable to put my VI because the laptop on it's is unable to access the network companies, I will do my best to explain it all, I apologize for the inconvenience! My problem is not however with VISA, it's with an exit VISA number conversion chain.

    I have attached a painting drawing of VI to better explain it.

    I use the block series Visa football match in baud rate and all that many good things to the unit and port settings set of device management. Then, a while loop is entered. The loop will run until you press the stop"" button. The next block of visa is the writing block, he asks for a reading of the device. The next block of visa is the first block of reading, he returns playback in the form of "NA-XXX. X' where x are numbers. The next block of visa is the second reading block, this block just echoes back the command sent to the device. Playback of the first visa read block, "NA-XXX. X' is going exponential/fractional chain to digital converter.

    When you perform a run/debug to highlight run, the release of visa reports the correct value, is the value of the device reading - however the string to number converter generates a 0,000, no matter what channel number is. I am at a loss as to what may be wrong because it's the EXACT set up I had to work very well a few weeks ago!

    I'm using Labview 10 on the laptop, the old computer was labview 7. I'm guessing that this is perhaps the rub... I Redid the VI from scratch, although I have not opened the old VI in labview 10.

    Any help would be appreciated. Again, sorry I am unable to attach the VI.

    DARB wrote:

    I have attached a painting drawing of VI to better explain it.

    Would it not have been easier to just post a screenshot? You might also have used the Tool of Capture of Code. (Which reminds me that I need to install it to my previous versions of LabVIEW, as evidenced by the screenshot I took. )

    As to the question: you probably either:

    • employee analysis of chain initially and when you rewrote the VI you used the regular string conversion functions.
    • Wired an offset value in the string to the number function.

  • Sub - VI with the entry as a string og number

    At this small Subvi. I wonder if I could make it more flexible and be able to take the string and number as a value ('value dbl' market) entry.  Is there some sort of variable of variant type that could be used?

    Michael.Koppelgaard wrote:

    At this small Subvi. I wonder if I could make it more flexible and be able to take the string and number as a value ('value dbl' market) entry.  Is there some sort of variable of variant type that could be used?

    It is possible with the key to write OpenG (varying) _ogtk.vi. But the problem is that when you want to read this back, you need to know what type it is. If you write to a different section of the config file each with a specific type, the TI will work. With this solution, you must use the key to reading OpenG (varying) _ogtk.vi to read and convert the value to LV

    Another way is to use Get Type Information.vi of the Variant Data Type palette. The trick here is to convert double or string before saving it in the config file (wire structure dealing with the output type of the vi and do conversions in the case of type dbl and string). Here, too, you must use a different section, one for dbl for string. Here, you use the standard Read button live file configutaion palette.

    Ben64

  • Why is my iPhone 5 number listed as 'unknown' and not listed in iMessage and FaceTime?

    I am a customer of StraightTalk. Originally, I had an iPhone CDMA 5 purchased directly from this company. After three years, the battery swelled and I came out of the Apple Store on Thursday with a replacement. After inserting a SIM to speak directly into the device and setting up, I can make calls, send text messages, use the cell data, etc.

    However, my phone number in the settings is listed as 'unknown', and it is not listed at the top of the contacts screen. I can't send messages in my phone number iMessage, because it is not even listed as an option. Ditto for FaceTime. After several hours on the phone with Straight Talk, they determined that my phone service is configured properly, and it is a phone number.

    Does anyone have a solution for this? It is incredibly frustrating that the iPhone 5 does every thing I need to do, and I prefer to keep my phone from replacement $ 75 for three years before moving on to an iPhone SE.

    Hello, smirza!

    Thank you for using communities of support from Apple!  What I understand in your post, you got a replacement iPhone 5 and have found that your phone number is not listed in settings > phone and iMessages/FaceTime.  Your number should certainly be in all those places, so I'm happy that you came here, then we can help you understand what is happening together.  Check with your mobile provider was a big first step.  I have other ideas for you as well:

    1. It seems that you already have the latest version of iOS (9.3.4), but we will also check your carrier settings are up to date: iOS: update your carrier settings
    2. If you haven't already done so, save your iPhone on iCloud or iTunes: How to backup your iPhone, iPad and iPod touch
    3. On your iPhone, go to settings > Contacts > My Info and make sure that your personal contact (with your iPhone phone number) card is selected.
    4. Go to settings > phone > my number and see if you are able to manually, enter your number and save it.
    5. If none of these steps work, try to restore your phone from the backup that you made: restore your iPhone, iPad or iPod touch from a backup
    6. If you still don't see your issue, try restoring your phone as a new and see if your number is: use iTunes on your Mac or PC to restore the iPhone, iPad or iPod to factory settings

    Have a fantastic week!

  • Convert the string with number of floats a number

    How to convert the string as "- 8.9E - 03" to a number of TestStand?

    Thanks in advance

    Hello

    Try to use the Val() function

    In the expression, it looks like this

    People of the country

    .nValue = val (Locals.strValue)

    Locals.nValue = Val("-8.9E-03")

    Hope this helps

    Jürgen

  • The decimal string to number Conversion, cutting necessary zeros

    I'm new to the forum, but have been using labview for awhile. Finally found something that really puzzled me, hope I can find someone who is smarter than me! It may be something obvious too, but here goes. The attached vi is the cause of the error. I have a serial number I need to convert a decimal string into a number, I use later the number of "math" so he need as a number. The system always receives a serial number of 6 characters (ie. 123456), but today the system has received a serial number with two leading figures of the scale (ie. 003456) zeros. This compensation of all the bells of alarm stream (sent 4 digits), but the error found that started the 'intelligence' at the beginning of the monitoring program. I would like to know if there is a way to force the zeros in the decimal number in string to not shave off the coast of the 6-digit value above.

    File is located in LabVIEW 2014

    Ideas or comments, thank you!

    The problem is not the string functions.  This is the display format for your digital indicator.  Change the properties on that.

  • Conversion string in number

    Why the number does not contain the entire string and how to solve?

    VI is attached


  • How to convert string to number

    Hi everoyne, I need to make a program simple calculation of the GPA in 5 classes. Where A, B, C, D, F are the entries for each other...

    Here's what I've done so far.

    But it seems that it is not recognized when I assigns numeric values to each letter. So I would appreciate any help. I tested for the release of "GP" and input A (4) = CT. The answer for GP should be 4 x 3 = 12. But I get a number beyond that.

    I'm relatively new to Labview so sorry if this is a stupid question.

    -Daniel

    I would like to make a table of the clusters.  Each element of the array corresponds to a single course.  Inside of the bunch, I would have a string for the name of the course, an enum for the grade and a digital for the number of credit hours.  Use an enum for the grade, so you can make sure that the user space only in the values that you no longer the enum is actually a number.  No actual conversion.  Then you just use a loop FOR (autoindexing) including some shift registers to keep your totals, then divide the totals of the year by the credit hours.

  • binary string to number

    Hello

    I would like to convert a binary string of the form: "000011' to a numeric value (3).

    I tried to use Byte Array to the string and then use the decimal number string, but I gives me 0 all the time

    Thank you

    Use a function of Scan chain with %b as a format string.

  • How to cast from object to String or number (oracle.jbo.domain.Number)

    Hello!

    How can I throw it a data type string or object in numbers (oracle.jbo.domain.Number)?

    Thank you.

    Please see below the code.

    Number of numValue = new (strVal);

    BR, 906099

Maybe you are looking for

  • Update iPhone 5s Icloud account

    Hello I have a question about the icloud account, I have and Iphone 5 s Verizon and upgrade my phone to the iphone 6. We used to have a cable internet provider and we used enamel of the internet service provider for our exodus from apple (shawn@class

  • Game for the Satellite L300-1BW.

    Hey! Has never really been a PC Gamer if im this announcement at the request of a former veteran to help me. I've already lost nearly £ 30 tent of the game that I thought would go on my laptop, but unfortunately none did. Can anyone suggest me some g

  • Re: Satellite P200 (PSPB6E) - keyboard problem

    Hello I have a keyboard with Satellite P200, series PSPB6E problem. Keyboard seems to generate Press Page Down constantly, although nothing has been paid to this subject.It is even difficult to turn on laptop, because it produced consecutive beeps an

  • Read multiple files in the folder and add data to a file

    Hello world Normal 0 false false false MicrosoftInternetExplorer4 / * Style Definitions * / table. MsoNormalTable {mso-style-name: "Table Normal" "; mso-knew-rowband-size: 0; mso-knew-colband-size: 0; mso-style - noshow:yes; mso-style-parent:" ";" ms

  • Podcast files

    When I transfer my gPodder podcasts in my Clip +, I find some of the podcasts in the folder music Podcasts, but not all.  I can find the missing podcasts in Play All or recently added.  How can I get all the podcasts to go in the Podcasts folder?