Compare non-numeric data by using arithmetic operations

Hello

Anyway is to compare non-numeric data in a table to a number.

To run a query like
SELECT rank_id 
                                      FROM   mas_rank
                                      WHERE  rank_code > 26 
Rank_code contains digital and non-digital data


Thanks for the help

Yes, it will work if you just say > '26' see this demo:

SQL> create table mas_rank(rank_id number,rank_code varchar2(2));

Table created.

SQL> insert into mas_rank values (100,'aa');

1 row created.

SQL> insert into mas_rank values (101,'ab');

1 row created.

SQL> insert into mas_rank values (102,'ad');

1 row created.

SQL> insert into mas_rank values (103,'ag');

1 row created.

SQL> insert into mas_rank values (104,'ac');

1 row created.

SQL> insert into mas_rank values (105,'22');

1 row created.

SQL> insert into mas_rank values (106,'25');

1 row created.

SQL> insert into mas_rank values (107,'26');

1 row created.

SQL> insert into mas_rank values (108,'27');

1 row created.

SQL> insert into mas_rank values (109,'aa');

1 row created.

SQL> insert into mas_rank values (110,'28');

1 row created.

SQL> SELECT rank_id
  2                                        FROM   mas_rank
  3                                        WHERE  rank_code not in ('ab','ad','ag')
  4                                                 and rank_code > 26;
                                               and rank_code > 26
                                                   *
ERROR at line 4:
ORA-01722: invalid number

SQL> ed
Wrote file afiedt.buf

  1  SELECT rank_id
  2                                        FROM   mas_rank
  3                                        WHERE  rank_code not in ('ab','ad','ag')
  4*                                                and rank_code > '26'
SQL> /

   RANK_ID
----------
       100
       104
       108
       109
       110

SQL>

Concerning
Girish Sharma

Tags: Database

Similar Questions

  • Is it possible to download non-numeric data in the planning of the ODI?

    Dear all,
    I have problem to download non-numeric data in planning?


    Kind regards
    Thomas

    If it is a member of type text then have a read here for a possible solution to the loading of the text member information.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • SQL to select non-numeric data

    Version of db Oracle 10.2.0.4.0

    Using these sample data:
    GET sampledata
    WITH sampledata AS
         (SELECT 'AA' FROM DUAL UNION ALL
          SELECT 'AB' FROM DUAL UNION ALL
          SELECT 'AC' FROM DUAL UNION ALL 
          SELECT '34' FROM DUAL UNION ALL
          SELECT '85' FROM DUAL)
    SELECT *
      FROM sampledata;
    Is it possible to use a regular expression to return only the rows that are NOT a number?

    I don't want to do the homework for you! It's just something I do to extract data from our GL tables, and I want only to choose non-numeric values.

    Any advice much appreciated

    Thank you!

    Try this:

    SQL> WITH sampledata AS
         (SELECT 'AA' col1 FROM DUAL UNION ALL
          SELECT 'AB' FROM DUAL UNION ALL
          SELECT 'AC' FROM DUAL UNION ALL
          SELECT '34' FROM DUAL UNION ALL
          SELECT '85' FROM DUAL UNION ALL
          SELECT 'A0' FROM DUAL)
    SELECT *
      FROM sampledata WHERE REGEXP_INSTR(col1,'^[0-9]]*') = 0
    /
    
    COL1
    -------
    AA
    AB
    AC
    A0
    
    SQL>
    

    Published by: AP on August 5, 2010 02:19

    Published by: AP on August 5, 2010 02:23

  • Arithmetic operation resulted in an overflow - System.Data.Odbc.OdbcDataReader.FirstResult)

    Hello

    I installed Oracle Database 11g Release 2 full Client for Microsoft Windows (x 64) of: (link)of Oracle Database 11 g Release 2 for Microsoft Windows (x 64)

    When I run an ODBC statement from a .NET (64-bit) application, I get the following error:

    Type of exception: System.OverflowException

    Exception message: arithmetic operation resulted in an overflow.

    Exception trace: at System.Data.Odbc.OdbcDataReader.FirstResult)

    I tried the same statement from another machine (same configuration), but with only the components of the ODAC 11.2 and it worked perfectly fine.

    I don't want to use 11g ODAC components because it does not support transactions responsible MTS (known bug). The full client for its works perfectly fine for this kind of scenario. I did some research online and I find that there are available patches to fix the above point. Please give me a link to download the fix or tips on how I can fix this problem.

    Concerning

    Regnier

    Hi Ben Amor,.

    You could be hitting the known, documented problem in Note below:

    Data recovery using a .NET ODBC Application may fail with: "arithmetic operation caused an overflow" (Doc ID 1181253.1)

    If you're on 11.2.0.1 Oracle client download and install the patch 11.2. 0.1 PATCH 5:9966926

    Download link:

    https://updates.Oracle.com/download/9966926.html

    This bug is fixed in 11.2.0.2.0 or a later version of the Oracle client.

    The 11.2.0.2 software can be downloaded from My Oracle support: Patch: 10098816

    https://updates.Oracle.com/download/10098816.html

    Last client version 11.2 that is 11.2.0.4, can be downloaded from My Oracle support: Patch: 13390677

    https://updates.Oracle.com/download/13390677.html

    Kind regards

    Ravi

  • How to display the data, that contains non-numeric characters.

    Hello

    I have table t1 with column of type varchar2 below

    ID

    ------

    11151

    11412

    1113

    1 to 114

    11b 15

    111 6

    Now, I need to display the data, that contains non-numeric characters.

    Did you get the result like:

    STR

    ----------

    1 to 114

    11b 15

    111 6

    WITH t
         AS (SELECT '11151' str FROM DUAL
             UNION ALL
             SELECT '11412' FROM DUAL
             UNION ALL
             SELECT '1113' FROM DUAL
             UNION ALL
             SELECT '1a114' FROM DUAL
             UNION ALL
             SELECT '11b15' FROM DUAL
             UNION ALL
             SELECT '111c6' FROM DUAL)
    SELECT *
      FROM t
      where regexp_like(str,'[^[:digit:]]');
    

    See you soon,.

    Manik.

  • How perforem arithmetic operations on time

    Studio Edition Version 11.1.2.3.0

    How to perform arithmetic operations on time

    I have a timestamp of data type attribute in VO

    based on the Oracle database field

    I can get the hour and the minutes using the value default adf.currentDateTime and simple date format hh: mm a

    I'm trying to add more hours to calculate the hours of service as Expression groovy

    Ex DocumentDate +(2/24) 2 hours

    I have error

    (oracle.jbo.JboException) Houston-29000: Unexpected exception caught: groovy.lang.MissingMethodException, msg = no signature of method: java.sql.Timestamp.plus () applies to the types of arguments: (Java.Math.BigDecimal) values: [0.2083333333]

    -Level 1: retail - 0

    (groovy.lang.MissingMethodException) no signature of method: java.sql.Timestamp.plus () applies to the types of arguments: (Java.Math.BigDecimal) values: [0.2083333333]

    I have added a transitional attriburte TestHire to the Employees (from a HR DB schema) table

    and in the expression of the value the groovy

    When I run now present in the Module Tester Application I see that the TestHire attribute is HireDate + 2 h

    Timo

  • Return of the Non-numeric characters

    Hi all

    IM using Oracle 11 g 2. Here is my sample data and I want to search for the string has non-numeric characters in it.
    with t as
    (
    select '123' val from dual
    union
    select ' 123' val from dual
    union
    select '1123' val from dual
    union
    select 'A123' val from dual
    union
    select 'x 123' val from dual
    union
    select '#123' val from dual
    )
    select val from t
    where regexp_like (val, '[[:alpha:]|[:blank:]|#]')
    Query works perfectly for result value but would break if another string, say 123 @', with a special character comes. There is therefore no format specifier (as we [: alpha:], [: digit :]) to directly identify the non-digit character, including the space in a string?]) If not what is the round job for her?

    Thank you
    Vivek
    with t as
    (
    select '123' val from dual
    union
    select ' 123' val from dual
    union
    select '1123' val from dual
    union
    select 'A123' val from dual
    union
    select 'x 123' val from dual
    union
    select '#123' val from dual
    union
    select '@123' val from dual
    )
    select val
    from   t
    where  regexp_like (val, '[^[:digit:]]');
    

    must not specify a figure

  • Unable to recover the old data synchronization after reinstalling operating system

    Hello

    I was using Firefox 26. Recently, I've upgraded to the latest version. A few reasons, I had to reinstall my windows 7 OS.

    After I installed Windows 7, I installed the latest Firefox and tried to synchronize data. I was unable to connect because I forgot the password. I tried using the link "password forgotten", but he said there is no such thing as e-mail id. It was surprising to me. I'm still all emails, including the secret key, I used to add new devices earlier, since Firefox in my mail box.

    Since I left without another option, if I'm creating a new represent now on Firefox with old email ID. The account is created successfully. Again, it is strange to me. However, my old data are not synchronized.

    I need the old data. Help, please.

    -
    Thank you
    Ravi

    Sorry, Sync was not intended to be used to backup Firefox data before reinstalling the operating system. Its purpose is to synchronize several separate installations of Firefox, usually on the various devices.

    The old version of Firefox 26 uses another version of Sync, the latest version of synchronization happen in Firefox 29. The largest variation in sync had to do with the recovery key ('secret key') - is no longer something to see the user or has to deal.

    You should have installed Firefox 28 or earlier and then connected to your account synchronization to recover your data and then put updated for Firefox 32. By creating a new account with the same email address, your data has been wiped out by synchronization servers to allow you to start a new.

  • The analysis of the non-numeric characters in a string

    Hello

    I am communicating a robot to LabVIEW (2013) via TCP/IP and sockets. The robot is the server, and LV is the customer.

    I start with the target data in this format (in a string):

    "[0 ~ 100 ~ 0] ~ [0.96593 ~-0.25882 ~ 0 ~ 0] ~ [1 ~ 0 ~ 0 ~ 0] ~ [150 ~ 50]."

    [X, Y, Z], [Q1, Q2, Q3, Q4], [C1, C4, C6, Cx], [TCPVel, OrientVel] except replacement ',' (comma) with a ' ~ ' (tilde) because I load the target data in a spreadsheet which is a comma-delimited file.

    In LV, I take this string, the analysis of the chain and split individual items. I then pulled the singular elements as unique, 32-bit of real numbers. I take each one and convert them individually to a string, concatenate them and send them to the robot. The robot decompresses these raw bytes individually and converts them to a target of robot (position in space).

    I train (BT) check if the user has sent a bad character (non-digital) in the target data. Example of this is:

    [- 50 ~-150 ~ 0] ~ [0.96593 ~-0 ] [B2has5D882 ~ 0 ~ 0] ~ [1 ~-1 ~ 0 ~ 0] ~ [150 ~ 50]

    Now in BT, when I'm scanning the chain, these bad character becomes the entire element to zero and everything else then to zero as well. See attachment for example screen similar.

    My question is, my VI, I can analyze all non-numeric characters (that are inside the parentheses and characters that are NOT a ' ~ ' (tilde))? In this way, I can always get this item numbers and do not have this element or other items turn to zero?

    Thanks in advance for any help!

    Sorry for the question of the test

    SM


  • Data recovery using Microsoft Money Standard bought in New Zealand

    I use Microsoft Money Standard bought in New Zealand.

    As a result of a malfunction of the hard drive, I installed a new and recovered all my data files.
    I reinstalled Microsoft Money, but Money files will not open.
    A message informs you that the file cannot be located or is read-only, I don't have the permission to open or it is write protected. None of this is true then I suspect it has something to do with Microsoft withdraws this product.
    I can see there are no version sunset for my version, so how I can I recover my data for use in Microsoft Money or importing to another product I need of course to buy at one time?

    Yay! Success.

    It's hotfix QFE, whatever they are, that became a problem when Microsoft has ceased to produce and support money.
    Users of the United States had a "Sunset Version" to allow them to continue to use the program, but international users have been left in the cold.
    Finally, Microsoft provided a download to help users with the UK or International English. Why they did not consider their international users from the very beginning, God alone knows that!
    For the Version of Money 2005 - published July 28, 2011
    For users of the International English Version of Money 2005 - published July 29, 2011
    I have downloaded and run the NASB and my Money file open immediately. Great!
    Now, I just need to look at what it takes to pass when I decide it is time to move from Microsoft Money.
  • copy of a dvd/data disc using vista

    I have a HP desktop computer and an operating system vista Home premium I tried unsuccessfully to copy a dvd/data disc using windows media player 11 and Windows media center... Nothing works. I thought I have to first transfer the files from the dvd to my hard drive and then burn a copy. Please give me instructions on how to do it.
    Thank you, whoever you are helping me with that.
    Freddie

    I have a HP desktop computer and an operating system vista Home premium I tried unsuccessfully to copy a dvd/data disc using windows media player 11 and Windows media center... Nothing works. I thought I have to first transfer the files from the dvd to my hard drive and then burn a copy. Please give me instructions on how to do it.
    Thank you, whoever you are helping me with that.
    Freddie

    ==================================
    Here's an easy way to create a copy of your DVD.

    The following freeware can create an ISO Image
    your DVD and then burn it to a blank dvd.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Download ImgBurn:
    http://www.Digital-Digest.com/software/download.php?sid=470&SSID=0&did=1

    How to create an image file of a disc with ImgBurn
    http://Forum.ImgBurn.com/index.php?showtopic=6379

    How to write an image file to a disc with ImgBurn
    http://Forum.ImgBurn.com/index.php?showtopic=61

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Calculate the use of operating rooms

    I received this question in an e-mail.

    I will post it here, as well as my own answer-, so that other people with the same problem can find and learn, and that responses can be given (here there are smart people who might have alternative solutions of large .)

    Here's the post with the question:

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

    Hi Kim,

    I'm stuck in a SQL query.

    I want to calculate the use of operating rooms. follwing is my data structure

    create the table room_usage
    (in_time DATE,
    out_time DATE,
    mr_no VARCHAR2 (15).
    room_no, NUMBER (3));

    insert into room_usage
    values
    (to_date('11-Feb-15 8:33:00 AM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 10:17:00 AM', 'dd-mon-RR hh:mi:SS am'),
    '00052740',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 10:56:00 AM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 12:36:00', 'dd-mon-RR hh:mi:SS am'),
    '00111780',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 12:56:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 2:46:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00111777',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 3:02:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 6:12:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00052713',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 6:51:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 7:57:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00052760',
    733);
    insert into room_usage
    values
    (to_date('12-Feb-15 8:51:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('12-Feb-15 9:57:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00082760',
    733);

    Select IN_TIME, OUT_TIME, (OUT_TIME - IN_TIME) * 24 * 60 stay, MR_NO, ROOM_NO
    of room_usage
    When trunc (IN_TIME) between February 11, 15 'and 12 February 15'
    order of in_time


    in_time out_time stay_min mr_no room_no

    11 February 15 08:33 11 February 15 10:17 104 00052740 733
    11 February 15 10:56 11 February 15 12:36 100 00111780 733
    11 February 15 12:56 11 February 15 14:46 110 00111777 733
    11 February 15 15:02 11 February 15 18:12 190 00052713 733
    11 February 15 18:51 11 February 15 19:57 00052760 733
    12 February 15 20:51 12 February 15 21:57 00082760 733

    But I also want to get time slots to USE NOT. This is the result I want

    in_time out_time stay_min mr_no room_no

    11 February 15 12:01:00 AM February 11, 15 08:32 511 no use of 733
    11 February 15 08:33 11 February 15 10:17 104 00052740 733
    11 February 15 10:18 11 February 15 10:55 37 no use of 733
    11 February 15 10:56 11 February 15 12:36 100 00111780 733
    11 February 15 12:37 February 11, 15 12:55 18 no use of 733
    11 February 15 12:56 11 February 15 14:46 110 00111777 733
    11 February 15 14:47 11 February 15 15:01 14 no use of 733
    11 February 15 15:02 11 February 15 18:12 190 00052713 733
    11 February 15 18:13 February 11, 15 18:50 37 no use of 733
    11 February 15 18:51 11 February 15 19:57 00052760 733
    11 February 15 19:58 11 February 15 23:59 241 no use of 733

    How can I get that.

    A problem like this is easy to solve with the model clause:

    Select in_time, out_time, round ((out_time-in_time) * 24 * 60) stay_min, mr_no, room_no
    of room_usage
    model
    partition (room_no, trunc (in_time) d)
    dimension (row_number() on rn (partition room_no, trunc (in_time) order of in_time))
    measures (in_time, out_time, mr_no)
    rules iterate (1000) until (presentv (in_time [iteration_number + 1], 1, 2) = 2)
    (in_time [iteration_number + 0.5] = presentv (out_time [iteration_number], [iteration_number] out_time, trunc (in_time [iteration_number + 1])) + interval minute '1'
    , out_time [iteration_number + 0.5] = presentv (in_time [iteration_number + 1], in_time [iteration_number + 1], trunc (out_time [iteration_number] + 1))-'1' minute of interval
    , mr_no [iteration_number + 0.5] = 'no use '.
    )
    order of in_time

  • ODBC Server Bug BI - arithmetic operation resulted in an overflow

    I'm writing some really simple access to the Oracle BI Server ODBC driver .NET code and it doesn't work at all.  I have connected properly, however it seems that everything I try to do related to obtaining the information of database spits out upward an error 'arithmetic operation resulted in an overflow.

    Here is the code:

    Dim ConnectString As String
    Dim FactoryType As String
    Sun factory System.Data.Common.DbProviderFactory
    Var connection as System.Data.Common.DbConnection = Nothing
    Var donneestables As System.Data.DataTable = Nothing
    Dim err As String = «»
    Dim nl As String = Chr (13) + Chr (10)

    Try
    '-------------------------------------
    'Connect to the database via ODBC
    '-------------------------------------
    ConnectString = "DSN = BSODBC_7; UID = TheUser10; "pwd = *".

    FactoryType = "System.Data.Odbc".
    Plant = System.Data.Common.DbProviderFactories.GetFactory (FactoryType)

    Connection = Factory.CreateConnection
    Connection.ConnectionString = ConnectString
    Connection.Open)

    '--------------------------------------------------
    "Ask for a list of the tables in the database
    ' * Tried both unrestricted and without
    '
    "ERROR on this line:
    ""Arithmetic operation resulted in an overflow.""
    '--------------------------------------------------
    Donneestables = Connection.GetSchema ("Tables")

    '--------------------------------------------------
    'Display the list of tables on the screen in a grid.
    "If it was successful.
    '--------------------------------------------------
    OnScreenGrid.AutoGenerateColumns = True
    OnScreenGrid.DataSource = donneestables

    Catch ex As Exception
    '-------------------------------------
    "Report this error.
    '-------------------------------------
    ERR = e.g. Message
    Otherwise (e.g.) InnerException is nothing) then
    Otherwise (e.g.) InnerException.Message is nothing) then
    ERR = err + nl + nl + ex. InnerException.Message
    End If
    End If
    MsgBox (err, MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Error")

    Finally

    '-------------------------------------
    'Clean up and close the DB connection '.
    '-------------------------------------
    Otherwise (connection is nothing) then
    Connection.Close
    Connection.Dispose)
    Connection = Nothing
    End If

    End Try


    Any thoughts?  Is this a known bug?  Is there a solution?

    Thank you, it seems that the error occurs in several places when NULLs exist in the data.  This seems to be a known bug.  Nice.

  • How to display the records from a query in the non-base data field

    Hello

    I have a problem:
    I have a query with a lot of tables and column 6 (select a, b, c, d, e, f x, y, z, t, s, g where the conditions) and I use 3 parameters.
    I create 3 settings: datai,: dataf and: partner and a button with a trigger when the button is pressed.
    Then a create a block manually with six field non-database a1, b1, c1, d1, e1, f1.
    Now, I want to display all the records in my query in a1, b1, c1, d1, e1, f1 where a1 = a, b1 = b, etc. and all the records (if I have 20 record, it will display 20 records in the non-base data field) when I press the button.

    How I did it:
    I create a cursor with the query, and then
    start the open cursor
    loop
    Fetch cursor in: a1,: b1,: c1: d1: e1,: f1;
    end loop;
    close the cursor;
    end;

    It displays a single record in a1, b1, c1 only, and it must display 100 records and date for all fields.

    Can someone help me with this problem?
    Thank you.

    Published by: 928437 on October 1, 2012 02:55

    Creating a view and the query in a database block are a great solution.

    To use the block non-base of data:
    You are missing the most important Next_Record; command.

     Begin
    Go_block('X'); -- block X is the non-database block
    Clear_Block(No_Validate);
    open cursor X1;
    loop
    If :System.Record_status != 'NEW' then
    Next_Record;
    End if;
    fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
    Exit when X1%NOTFOUND;
    end loop;
    close X1;
    end;

  • ESXi 4.0 on Dell 1850 this host doesn't support VT you have configured the virtual machine to use an operating system 64-bit client.

    Hello

    , I have in 3 data centers Dell 1850, identical hardware configurations.  I installed Esxi 4.0 to the ISO from site Web de VMware dell custom help. He is successfully installed on all servers, without error at all. I've updated them all to the last generation, using VMware vSphere Client. I have a problem with one of the server when I want to use 64-bit machines, he realizes: this host does not support VT you have configured the virtual machine to use an operating system 64-bit client.  However, this host is not able to run 64-bit virtual machines or virtual computer has 64-bit support disabled. For more information, see http://www.vmware.com/info?id=152. I don't understand why I got this, servers are identical, versions of BIOS, firmware, and all updates are the same. There is also a warning in the configuration tab, on the State of health link.

    Thanks in advance for any helpful suggestion.

    Yes according to the description of CPU, it seems that they do not support intel VT:

    http://Ark.Intel.com/product.aspx?ID=28016&processor=&spec-codes=SL7DX, SL7HH, SL7PF, SL7TD, SL8KQ

    Please give points for any helpful answer.

Maybe you are looking for