convert the data that are not text

create table x as
(line_1 varchar2(10))
INSERT INTO x  VALUES ('001165899', '0506', 'ZIP1003', 'ABC', 'xyz')
It is the source table, it transforms (to meet the requirements of the company) to another table where column line_1 is converted to a data type of number, and all the data in the column of line_1 which is the text are converted to-1.

user628919 wrote:
How the hyphen may be replaced for the data where it grows in different places within the data.

The solution needs to keep other rules - convert to_number, text-1 column, ignore nulls (see below)-, more remove the hyphen of digital data.

to_number(regexp_replace(line_1, '.*\D.*', '-1'))

As Vivek L, complete with a convenient link for documentation, said "replace should work.

to_number(regexp_replace(replace(line_1, '-'), '.*\D.*', '-1'))

John

Tags: Database

Similar Questions

  • How to check the data that are not digital?

    I have a varchar field and I would check for all of the lines where it does not contain a numeric value. How can I achieve this?
    Thanks in advance.

    One option is to write a small function

    CREATE OR REPLACE FUNCTION is_numeric( p_str IN VARCHAR2 )
      RETURN NUMBER
    IS
      l_num NUMBER;
    BEGIN
      l_num := to_number( p_str );
      RETURN 1;
    EXCEPTION
      WHEN others THEN
        RETURN 0;
    END;
    

    only then can you call

    SELECT *
      FROM some_table
     WHERE is_numeric( some_string_column ) = 0
    

    Of course, you can adapt the function to return the numeric value rather than a 1 or a 0 more.

    Justin

    Published by: Justin Cave on June 21, 2011 18:15

    Depending on the version of Oracle (which you don't mention), you can also write a regular expression to search for things other than numbers. This can become a little difficult if you have to manage commas and dots as decimal separators and grouping because different regions use the symbols differently and have different rules about what are valid models.

  • How is possible to create a smart collection to find all the photos that are not belongs to any collection?

    Hello

    How is possible to create a Smart Collection to find all the photos are not belongs to any collection?

    "Yesterday I was importing a lot of photo when my camera battery died then I succeeded him and continued to import without thinking that the previous import collection literally means" previous import. "

    So I need to find a way to create a smart collection that will reveal all the photos that do not belong to any collection.

    I solved the problem with a workaround is creating a collection based on the date of the photo which worked well, but must be nice to have a more general collection to find all the photo that are not from the collections.

    Thanks in advance,

    Marco.

    Another way to do

    1. Select all photos in the catalog

    2 dismiss a color label

    3. go to collections and multi select all your collections (ctrl)

    4. select images and give them a color

    5. return to the catalogue

    6. filter by color label - No

  • I want to see just all the Photos that are not in an album - possible?

    Hello

    is it possible to see all the photos that are not in the album?

    Photo on Mac

    THX

    Stefan

    Yes, create smart albums with the rule 'Album isn't everything. "

    For the file menu: file > new Smart album

    This album will contain all the photos that are not in any standard album.

  • How can I see the photos that are not in an album?

    How can I see the photos that aren't in an album in the App "Photos"? I noticed that in the Album 'Pictures' are pictures I thought I deleted already. I would like to see all the photos in an album, so I can finally delete them.

    You can go the the file menu Photos and click New Smart Album, and then set the condition of Album - is not. This will create a smart album that will show you all the photos that are not in any other album.

  • y at - it a button to remove all the nuances that are not used in an file?

    Hey all,.

    I was wondering is there a button that removes all the nuances that are not used in an illustrator file?

    Any help would be great

    Look in the Actions Panel. It should be an action he who says to remove all unused items in the Panel.

  • queue on the profile that are not used

    Hi guys,.

    is anyway to wrap on the profile that are not used or attributed to any user name or roles?

    flaskvacuum wrote:
    Hi guys,.

    is anyway to wrap on the profile that are not used or attributed to any user name or roles?

    SQL> CREATE PROFILE test LIMIT
      2     FAILED_LOGIN_ATTEMPTS 5
      3     PASSWORD_LIFE_TIME 60
      4     PASSWORD_REUSE_TIME 60
      5     PASSWORD_REUSE_MAX 5
      6     PASSWORD_VERIFY_FUNCTION null
      7     PASSWORD_LOCK_TIME 1/24
      8     PASSWORD_GRACE_TIME 10;
    
    Profile created.
    
    -- Created but not assigned --
    SQL> select distinct profile from dba_profiles where profile not in (select profile from dba_users);
    
    PROFILE
    ------------------------------
    TEST
    
    SQL>
    
  • Help - why the songs that are not on my iPhone appearing in my list of app music albums/songs?

    I have over 500 GB of music on my Mac, so I create a playlist for the songs I want to sync my iPhone. Yet when I look at my phone, there are many songs that are not in sync would be playlist. They cannot be read unless the phone is connected to my wifi at home, but I don't want them cluttering up my phone and makes it almost impossible to find the tracks I want to listen to.

    I hate the new music app. For the first time since I converted to Apple 10 years ago, I wonder if I can be forced away because it's so horrible. Why ruin a great product with terrible software? Anyway, if anyone can help me to fix this serious bug, I would be very grateful.

    If you go to the library of the screen and press the red text just below the icons of the album/playlist (where you select whether you want the screen to show the view of the artist/Album/songs downstairs there is a toggle to only show that downloaded music.) If you enable this, then only the songs that are actually ON your iPhone will be in BLACK characters. The rest of your music library to iCloud either won't display at all or be grey. Now - if you have a few streaming, you can see more songs, because the songs that are heard are cached in the memory of the iPhone box and supposedly deleted automatically when it fills up (but not user accessible unless you use some third-party programs).

    What you can do - so they need WiFi or data cell-, it's make a playlist in iTunes that you want on your iPhone. Then (assuming that Apple music and iCloud music library are running on both), you can go to the playlist and press the small cloud/down arrow icon and download these tracks on your iPhone. Then, you can play these songs without access to wifi or cell phone.

  • When I open the site in Contribute CS5, it moves items to the bottom of the page that are not in the regions of editiable

    Site was created in DW CS5 and so it is edited in DW it's fine. The minute you click on edit in Contribute CS5 text, links, and div tags is pushed to the bottom of the page. This is before I touch event whatever it is in an editable and the elements that are affected are not in an editable? If I go ahead and make changes in the region of editiable and save, he recorded with all of these elements encountered towards the bottom of the page. I convinced a client that Contribute was the way forward, they bought 3 licenses and now can't change their site.

    Any ideas?

    This problem is the adjustment of spacing of the paragraphs in the role of setting.

    (1) administer site in Contribute.

    (2) select the role, then click on change settings for role...

    (3) in the dialog box change the parameters of role (mentioned below), choose "two lines, as in (uses standard web page editors '.

    Tags)' option under the spacing of the paragraphs in the editing category.

    (4) to save the settings and try to place again the page in edit mode.

    Hope this has solved your problem.

  • Find indexes in the schema that are not used

    Hello
    Anyone know an easy way to SQL or EM to find all indexes that are not used (not accessed) in a schema?
    Greetings

    Published by: user552215 on January 26, 2012 04:15

    Salvation;

    Please see:

    Identify unused indexes [ID 144070.1]
    Identify unused indexes with the ALTER INDEX TRACKING controls [ID 136642.1]

    Respect of
    HELIOS

  • Generate data that are not available in the table

    I have a table that has monthly data for agents. Example of table structure is the following:

    create table agt_dum)

    agent_id number,

    number of months,

    Commission number)

    Examples of data include:

    AGENT_ID MONTHS COUNCIL

    1150
    12100
    1625
    2110
    2220

    Month value can be from 1 to 12.

    So as you can see these data is missing for the agents a few months.

    Here, the requirement is I need to generate data for each agent for 12 months. If the data is not already in the table and are should include agent_id, month number and commission is equal to zero.

    The output for the above data would be:

    AGENT_ID MONTHS COUNCIL

    1150
    12100
    130
    140
    150
    1625
    170
    180
    190
    1100
    1110
    1120
    2110
    2220
    230
    240
    250
    260
    270
    280
    290
    2100
    2110
    2120

    I tried SQL query with full outer join. I was able to generate data for columns of MONTHS and the COMMISSION using the NVL function. But I have been unable to generate the AGENT_ID.

    Please share your suggestions.

    I'm using Oracle 11 g 2.

    Thank you

    Sudhanshu

    If you need something like:

    WITH agt_dum (agent_id, MONTH, commission)

    (SELECT 1, 1, 50 IN all double union)

    Select 1, 2, 100 of all the double union

    Select 1, 6, 25 Union double all the

    Select double union all 2, 1, 10

    SELECT 2, 2, 20 DOUBLES)

    all_months as (select rownum as LUN double connect by rownum<=>

    SELECT *.

    To all_months:

    partition outer join agt_dum ad bequeathed (agent_id) on (ad.month = am.mon)

    /

    It is not yet complete, but I'm sure you can handle the rest...

    HTH

  • How to track the URLS that are not in the 'history', but were actually visited by the browser?

    I open a page web mith several links that appear the same:
    www.someurl.com/somepage.SD#
    When I click on links, the section of the web page is expanded and more information is displayed. the web page contains JavaScript. So, I want to follow the real URL that the browser visits.

    These data are retrieved via a XMLHttpRequest to rebuild the part of the page and the URL in the location bar remains the same.

    You can see in the Web Console (Web Developer > Web Console;) CTRL + SHIFT + K) as a POST and GET action.

    You won't see a history entry in this case because you are not actually visit this web page.

    These data are simply used by JavaScript to update the content of the current page.

  • Separate the values that are not in the hierarchy...

    Hi all

    Please help me build the following query:

    Parent child
    ==== ===
    10 20
    20 30
    30 40
    50 60
    70 80

    etc... In the above data we ensure there's a great single parent say 10 and values 50,60,70,80 etc are not attached to the grandparent 10. so I need to display values that are forgotten to fix on the Top 10 of node that is to say, here 50,60,70,80 etc. If my query is useful in retreving these values then I can attach them to the hierarchy.

    Thanks in advance.

    Kind regards
    Kalyan
    SQL>WITH t AS
      2       (SELECT 10 AS par, 20 AS chi FROM DUAL UNION ALL
      3        SELECT 20, 30 FROM DUAL UNION ALL
      4        SELECT 30, 40 FROM DUAL UNION ALL
      5        SELECT 50, 60 FROM DUAL UNION ALL
      6        SELECT 70, 80 FROM DUAL)
      7  SELECT *
      8    FROM t
      9   WHERE chi NOT IN(SELECT     chi
     10                          FROM t
     11                    CONNECT BY PRIOR chi = par
     12                    START WITH par = 10);
    
           PAR        CHI
    ---------- ----------
            50         60
            70         80
    

    HTH, Urs

  • Spectrum of HP x 360: replacements of cord/power from the aftermarket that are not so ugly block?

    I just got a new spectrum of HP 360 x which is a computer laptop beautiful aluminium but it comes with this ugly brick black power.

    Apple has figured out how to include the power cord in its overall design. Why manufacturers of PC/Windows cannot do the same?

    Does anyone know of blocks replacement power supply for HP laptops that have a sense of design and are not so ugly?

    Hi, you can buy a thin travel adapter, here is a page that can help you with the selection.

    http://store.HP.com/webapp/WCS/stores/servlet/ContentView?StoreID=10151&eSpotName=BatteryFinder&catalogId=10051&langid=-1

    Thin adapters are nicer :-)

  • Search for Windows 7, why not if give me the files that are not yet in my augument search?

    Windows 7 Home premium 64-bit OS.

    Have a lot of files are duplicated.

    In Windows 7 lets say the files in the folder have files that look like:

    Bill 120.le rar
    Bill 121, rar
    Bill 1 .rar

    and we want to remove duplicates with '(1) '.
    and we enter research * (*)

    Under XP it would only list the file: Bill 1 .rar IF you entered *(*.)  or *) * or (1), etc.

    Bill 1 .rar

    In Windows 7, since I started to use Win 7 years, everything I do is get frustrited when it will sometimes give me what I ask for the Bill 1 .rar.
    but most of the time like now, will give me ALL the files WITH and WITHOUT the "()".

    Bill 120.le rar
    Bill 121, rar
    Bill 1 .rar

    WHY?  and how can he give me what I asked?

    (I tried ALL the settings and they all do the same thing)

    Enter in the search box:

    name: ~ = "{}"

    The ~ = indicates to Windows 7 search to look anywhere in the name.  Usually, the quotes would not be needed, but( ) has a functional use of search for Windows 7, and the quotes tell Windows 7 search just deal with ( ) as a chararacter.  I tried to find a way to search for a (?), after? as a wildcard but couldn't.  [Update: solution concludes, at the end of the post]  However, you can enter this to search for files named with the two ( and ), but not necessarily appearing in the (#) form.

    nom : ~ = "(" nom : ~ = "")" »

    or more compactly,

    nom : (~ = "(" ~ = "")" »)

    Update: more than a month later, I realized the more compactly.  Subsequently, the? is interpreted as a wildcard character.  If more digits is possible, then additional search with? exactly two for? for exactly three and so on.

    Name: ~ "* (?) *"

    If filename: is used instead, then the tilde is redundant:

    filename: "* (?)" *"

Maybe you are looking for