the column of numeric string filtering

I have this problem.
Consider having a table named table1 with an id of the column named Column1 of varchar2.
This column contains the giuds and the number (es '12345' and 'ed6tyJh56')
I want to filter all the lines containing the string of number.
I did:
Select * from table1 where LENGTH (TRIM (TRANSLATE (column1, ' + -. 0123456789', ' '))) is null.

OK so far.

My problem is that I am not able to filter the table that contains a predicate as column1 > 100

I tried to write:

Select / * + no_query_translation * / column1)
Select / * + no_merge * / column1 from table1 where LENGTH (TRIM (TRANSLATE (column1, ' + -. 0123456789', ' '))) a null value
) a
where a.column1 > 100

but nothing. I get the message "invalid character '!
I believe the problem can be solved with a function but who work for a single line, I ' m courious to know if
There is a trick or something to force the order of filters somting.
In particular, to force the filter (a.column1 > 100) on display online.

Anyone know?

.. or be achieved the first inline view

SQL> create table table1
  2  (column1 varchar2(100)
  3  );

Table created.

SQL> insert into table1 values ('12345');

1 row created.

SQL> insert into table1 values ('ed6tyJh56');

1 row created.

SQL>
SQL> select * from table1 where LENGTH(TRIM(TRANSLATE(column1, ' +-.0123456789',' '))) is null
  2  /

COLUMN1
--------------------------------------------------------------------------------
12345

SQL>
SQL> select column1 from (
  2  select rownum, column1 from table1 where LENGTH(TRIM(TRANSLATE(column1, ' +-.0123456789',' ')))
 is null
  3  ) a
  4  where a.column1 > 100
  5
SQL> /

COLUMN1
--------------------------------------------------------------------------------
12345

SQL> 

Published by: Alex Nuijten on September 8, 2009 13:46

Tags: Database

Similar Questions

  • convert the column to a string name

    pls help me.

    I need to know how can I convert the column to a string name because I can not insert the column name into my table.


    for matrix (SELECT nom_de_colonne
    OF all_col_comments@myDBLink
    WHERE UPPER (trim (table_name)) = "ROLEMATRIX")
    loop
    INSERT INTO myTABLE (myColumn)
    VALUES (matrix.column_name);
    end loop;


    my error:
    ORA-00984: column not allowed here

    which line you are confronted with error, because I've also tested this, his work on my side!

  • How to change the order of the column OR the addition of a space ' ' in front of a filtering value

    I'm using Oracle Dashboard OBIEE 11. I have a bar chart that contains three columns 'less than 1 day', '1 to 2 days' and 'more than 2 days. It is produced by the following code.

    CASE WHEN TIMESTAMPDIFF (SQL_TSI_DAY, "breakdown of DSR" "." ") Was held Date', 'DSR failure". ("" Resolved to Date ") < 1 THEN 'less than 1 day' WHEN TIMESTAMPDIFF (SQL_TSI_DAY,"Failure of DSR". "Occurred Date", "breakdown of DSR" "." " Resolved Date") > = 1 AND TIMESTAMPDIFF (SQL_TSI_DAY," breakdown of DSR"". "") Was held Date', 'DSR failure". ("" Resolved to Date ") < = 2 THEN 1 to 2 days WHEN TIMESTAMPDIFF (SQL_TSI_DAY," breakdown of DSR"". "") Was held Date', 'DSR failure". ("" Resolved to Date ") > 2 THEN 'more than 2 days' END

    NOTE the space "" which is just before "less than a day" which is in bold in the above code. Well, then the reason why I did is if the bar graph CONTROL is proving to be "less than one day" first, then "1-2 days" comes in second, and then 'more than 2 days' comes in last.

    NOW, I created an action link that goes to a details page that is filtered by the big piece of code above. The PROBLEM is that filtering somehow removes the space in front of "less than 1 day" and does not recognize this filter. Oh woe me.

    Okay, so the two solutions I can think is:

    1 remove the space in front of 'less than a day', BUT then the bar chart is ordered by 1 to 2 days, 'less than 1 day' and 'more than 2 days. Yuck. How to reorganize the bar chart?

    OR

    2. let the link action recognize that there is a SPACE in front of "less than a day." How to do the link action acknowledge that DESPITE me already put in 'less than 1 day'... < review space forward > GAHHHHH T_T

    ~ Kevin Sun

    Hey Kevin,

    In this kind of situation, I usually take the option of 2 columns: same BOX WHEN once put in numerical values (in your case can be 1, 2, 3 or something like that), and once put in labels (without spaces or any other thing in front, just real label).

    The first with numerical values is hidden and serves to force the second sorting.

    In this case, your link action passes the correct value and everything will work. And in the case where a while, you need to change all your labels or something else you can do without thinking about what character to put in front of your labels to fix your sorting.

  • How to check the column contain alphanumeric or numeric value

    Dear Guru,

    I have a table Data_Table with content below
    Name varchar2 (30)
    content varchar2 (100)

    Content column can contain alphanumeric and digital data with separated by commas.
    I want to check if the column gave completely digital or alphanumeric.

    example of
    (a) 1223,2313,312,12313 (since it is purely digital data with commas so you can say that these are purely numeric data)
    (b) ABC, ABC_VAL, XYZ (since it's purely alphanumeric data with separated by commas)
    If one) is of digital type
    case b) is alpha-numeric

    Any body can help me to know if the content is digital or non-digital

    thanking in advance
    Sanjeev

    Hello

    Here's one way:

    SELECT     txt
    ,     CASE
             WHEN  REGEXP_LIKE ( REPLACE (txt, ',')
                         , '^[[:digit:]]+$'
                         )               THEN  'All digits'
             WHEN  REGEXP_LIKE ( REPLACE (txt, ',')
                         , '^[[:alnum:]_]+$'
                         )               THEN 'All alphanumeric or _'
         END     AS txt_type
    FROM     table_x
    ;
    

    I used

    REPLACE (txt, ',')
    

    instead of just txt so that a string consisting of all commas (such as ",") would not be counted as either all figures or all alphanumeric characters.

  • Display the name of the tag as the column name and the value in the tag as a row of data from the input string.

    Hi Forum members,

    I am looking for a query display the name of the tag as the column name and the value in the tag as a row of data.

    I have to print the values within the tag to a file by choosing the value of the flags. the sequence of the tags will vary each time, as the tag name will change dynamically.

    So here is the example of input data and the expected output. The string in the text column must be separated as the column names and values.

    Input data
    Select 1 as seqno,' < > 0210A 50 4f < / 4f > < 5f20 > TEST CARD 16 < / 5f20 > < 5f2a > < / 5f2a > < 82 > 1 c 00 < / 82 > ' double text


    Output:

    Seqno 4f 5f20 5f2a 82
    0210A 50 16 1 00 TEST CARD 1

    Please help me by providing your entries on this.

    We use the version of Oracle 11.2.

    Note: This is not the XML string

    Thank you

    Shree

    with

    data in the form of

    (select 1 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2a><82>00 1' text of all the double union)

    Select 2 as seqno,'XYZ<4F>0210 A 50<5f20>TEST CARD 16<5f2a><82>00 1' text of all the double union

    Select 3 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2A><82>1 00XYZ ' text of all the double union

    Select option 4 as seqno,'<4F>0210 A 50<5F20>TEST CARD 16<5f2A><82>1 00XYZ' double text

    )

    Select d.seqno, x.*

    d the data,

    XMLTable ('/ root')

    by the way xmltransform (xmltype ('': replace (replace (text,'<><>'),)))

    XmlType (q'~http://www.w3.org/1999/XSL/Transform "version ="1.0"> ")

                                                     

                                                       

                                                         

                                                       

                                                     

                                                     

                                                       

                                                         

                                                       

                                                     

    ~'

    )

    )

    path of columns '4f' varchar2 (10) "tag4f."

    path of "5f20' varchar2 (30)"tag5f20. "

    path of '5f2a' varchar2 (10) "tag5f2a."

    path of varchar2 (10) "82" "tag82.

    ) x


    SEQNO 4f 5f20 5f2a 82
    1 0210A 50 16 TEST CARD - 1 00
    2 0210A 50 16 TEST CARD - 1 00
    3 0210A 50 16 TEST CARD - 1 00
    4 0210A 50 16 TEST CARD - 1 00

    with

    data in the form of

    (select 1 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2a><82>00 1' text of all the double union)

    Select 2 as seqno,'XYZ<4F>0210 A 50<5f20>TEST CARD 16<5f2a><82>00 1' text of all the double union

    Select 3 as seqno,'<4f>0210 A 50<5f20>TEST CARD 16<5F2A><82>1 00XYZ ' text of all the double union

    Select option 4 as seqno,'<4F>0210 A 50<5F20>TEST CARD 16<5f2A><82>1 00XYZ' double text

    ),

    Chopper (seqno, Key, value, String) as

    (select seqno,

    regexp_substr (text,'<(.+?)>', 1, 1, null, 1),

    regexp_substr (Text,'>(.*?))

    regexp_substr (text,'<.+?>. *? ) (.*) $', 1, 1, null, 1). » <>'

    from the data

    Union of all the

    Select seqno,

    regexp_substr (String,'<(.+?)>', 1, 1, null, 1),

    regexp_substr (String,'>(.*?))

    regexp_substr (String,'<.+?>. *? ) (.*) $', 1, 1, null, 1)

    Chopper

    where regexp_substr (string,'<(.*?)>', 1, 1, null, 1) is not null

    )

    Select '4f', seqno, '5f2a', '82', '5f20.

    of (seqno, lower (key) select key, value)

    Chopper

    )

    Pivot (max (value) for key in ('4f' as '4f', '5f20' as '5f20', '5f2a' as '5f2a', "82" as "82"))

    Concerning

    Etbin

  • get the length of each string in a column

    Hi all

    Is there a way to get the length of each string in a column:

    for example:

    If the table contains lines like below:

    Select 'test test1 test31' col1 of double

    Union of all the

    Select 'sectest1 sectest234' double col1

    The output should be as below:

    col1

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

    4 5 6

    8 10

    That is to say get the count of each separated from the chain of space in a column. Is this possible using regexpr_substr?

    Thanks in advance.

    Roy.

    Try the below

    SELECT LISTAGG(val1,' ') IN ONE GROUP)

    New_val ORDER BY lvl)

    Of

    (SELECT LENGTH (REGEXP_SUBSTR (col1,'[^] +', 1, LEVEL)) val1,)

    RN,

    LEVEL lvl

    Of

    (SELECT col1,

    ROWNUM rn

    Of

    (SELECT 'test test1 test31' col1 OF double)

    UNION ALL

    SELECT 'sectest1 sectest234' double col1

    )

    )

    CONNECT BY LEVEL<= regexp_count(col1,'="">

    AND PRIOR rn = rn

    AND PRIOR DBMS_RANDOM. VALUE IS NOT NULL

    )

    GROUP BY rn;

    OUTPUT:-

    =======

    col1

    ----

    4 5 6

    8 10

    Thank you

    Ann

  • How to choose the value of a string are numeric together and words of letters (for example, TEST)

    Hi all

    How to choose the value of a string are letters (for example, TEST) and all numeric...

    for example
    TEST 123456
    TEST 34567
    123456 ABCD
    1234 TEST
    TESTING 12345
    TEST 1@234$
    YOUR T 123456

    I want the results of the query as below.
    TEST 123456
    TEST 34567

    And I tried to use regexp_like in this case but without success. See the code below.
    SELECT * FROM TABLE WHERE regexp_like (Description, ' [TEST] % & [[: digit:]] + $');

    How can I do this, please answer.

    Thank you

    WF

    If you want to return only the rows that contain the string 'TEST', followed by zero or more space characters, followed by one or more digits?

    How about this:

    SELECT *.

    FROM my_table

    WHERE REGEXP_LIKE(description,'^TEST\s*\d+$')

  • Problem with error ORA-06502: PL/SQL: numeric string or the error value

    Hello

    I use a loop for the coil just out of data using 'dbms_output.put_line' and I get this error after a few records. I've been using and it happens at a different interval. He would have to do with the length of the question, I am trying to spool? Thank you.

    ORA-06502: PL/SQL: numeric string or the error value

    SD wrote:
    Hello

    I use a loop for the coil just out of data using 'dbms_output.put_line' and I get this error after a few records. I've been using and it happens at a different interval. He would have to do with the length of the question, I am trying to spool? Thank you.

    ORA-06502: PL/SQL: numeric string or the error value

    Yes, it's a mistake to dependent data.

    Manage: SD
    Status level: Beginner
    Join date: November 21, 2001
    Messages total: 289
    Total Questions: 189 (183 pending)

    Why wasting you time here when you get rarely answers your questions?

  • What is the empty string, the value null in the column, or...?

    I use Oracle 11.2, a table tb_class as follows:

    TB_CLASS (number (3) id, varchar2 (32) nm, seqNum number (3));

    1, 212
    2, "under", 12
    3, 'qq', 12

    Select * from TB_CLASS where id = 1 and n = null;... .no selected line
    Select nvl (nm) in the TB_CLASS where id = 1; ... 1 selected line

    Any know what's in the column of row id = 1 nm? I thought that it is an empty string, but why it returns no rows in the first query?

    Thank you!

    (1) in Oracle there is no difference between NULL and an empty string.

    (2) NULL is never equal to what whatsoever (including another NULL). NULL is never spotty what whatsoever (including another NULL). You must use the IS NULL and IS NOT NULL operators to search for NULL values

    SELECT *
      FROM tb_class
     WHERE nm IS NULL
    

    or

    SELECT *
      FROM tb_class
     WHERE nm IS NOT NULL
    

    Of course, it is also possible that you declare that the NM column contains one or more spaces or it contains one or more non-printable characters and not a NULL value. That's why we asked you what dump (nm) returns

    Justin

  • Add numeric value in the column in the Table

    Hello
    My problem:
    I have a VO with a numeric attribute (Sal). This VO is present in a table in a JSF Page.
    I need to add a numerical value to the value of the column.

    I have try it with #{row.bindings.Sal.attributeValue * 2} or #{rank. SAL + 2} or #{rank. Sal.inputValue + 2} but I get an error.

    Can someone help me?

    Thank you

    11.1.3 JDev

    Hello

    one option would be to use a transitional attribute in the VO to calculate math or to fill in the field column of a managed bean. You can point the field for the column to a property of the managed bean (say sumSal). In this getSumSal() method you

    1. use ELContext and ValueExpression ExpressionFactory to resolve the reference #{line} (you can cast oracle.jbo.domain.Row
    2. call the row.get ("attribute_name") to access the value of the field
    3 compute and return the value to display in the table

    Note that using a transitional attribute may be easier to achieve and easier to reuse in other uses of the VO. However, you will have options

    Frank

  • Displaying a string instead of the "null" value in the columns of answers

    Hi, is it possible to display a string (e.g. "no data") in responses instead a NULL value in a column of a table or a PivotTable? I read everything by using the formula in the column section in the answers, but I do not understand what expression should be used... could you help me?

    Is this kind of possible substitution only in the web interface of answers, or still in BI Admin meta - data? I would be very interested to recognize from analysis UDML in metadata,
    Thanks in advance!

    You must do this in the business model and the Mapping layer

    Go to the properties of the column

    1. in general tab, you have "use existing columns of logic as a source.
    Select this check box. Click the period (...)
    In the formula for the column, you can add the condition of ifnull
    In this col formula editor, you can choose the logical columns.

    2. on the Data Type tab, you have the maps and logical sources
    Here too you can achieve.
    In this col formula editor, you can choose physical columns.

    Kind regards
    Rambeau

  • the column filtering to condition

    Hi, I want to be able to select a few columns based on a key. for example, if my key is "FA" then I want my columns of FA to those returned and PG not even if PG columns are also reported. Here's the idea:
    table1
    id  key  val
    FA  1  5th Ave
    FA  2  NY
    FA  25  UserFA
    PG  7  9th road
    PG  11 MIA
    PG  12 I don't need this column display
    PG  25 UserPG
    ... and the following query:
    select max(decode(key,'25',val)) as name
    , CASE when id = 'FA' THEN max(decode(key,'1',val)) END as  address 
    , CASE when id = 'FA' THEN max(decode(key,'2',val)) END as  city 
    , CASE when id = 'PG' THEN max(decode(key,'7',val)) END as  address 
    , CASE when id = 'PG' THEN max(decode(key,'11',val)) END as  city 
    from table1
    where id = <x> 
    group by id;
    So I expect an output as follows if I put id = "f":
    name   address   city
    UserFa  5th Ave  NY
    as you can guess this survey one
    ORA-00918: column ambiguously defined
    because I 'as address' and 'the city' twice, renaming each one differently probably not an option because the output of this past somewhere else who is looking for these keys. So my question is... How can I re - write this to be able to select only the columns for FA if id = FA and columns for PG if id is PG? instead of select all and causing all this conflict? I have about 20 to 30 ID, I display only 2... so keep that in mind when you change this, because even in remaming the selct identifier selects all columns, including those that are different from the selected Id.

    Please let me know if it needs to be clarified,

    Thank you

    A select statement must give one set of columns for all rows, so you can not dynamically choose columns based on the key, but you can leave some null based on the key.
    I think your questioning of the base is narrow--just combine all expressions address into a single statement, all the expressions of the city into a single statement etc. :

    select max(decode(key,'25',val)) as name
    , CASE when id = 'FA' THEN max(decode(key,'1',val))
           when id = 'PG' THEN max(decode(key,'7',val)) END as  address
    , CASE when id = 'FA' THEN max(decode(key,'2',val))
           when id = 'PG' THEN max(decode(key,'11',val)) END as  city
    from table1
    where id = 
    group by id;
    

    Kind regards
    David

  • Add the string at the end of the column name

    Hi all

    I wonder whether it is possible or not. I created a similar table to another table to help-


    create table table_name in select * from table_name1;
    Now, I want to differentiate the name of the column of the previous table column names. I want to add E at the end of all column names. Is it possible using sql Command in sql or Toad workshop without doing it manually as I have more than 100 columns in this table?



    Thanks in advance.



    Kind regards



    Pascal M

    Hello

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL> create table test_1(col1 number, col2 varchar2(30));
    
    Table created
    
    SQL> create table test_2 as select * from test_1;
    
    Table created
    
    SQL> desc test_2;
    Name Type         Nullable Default Comments
    ---- ------------ -------- ------- --------
    COL1 NUMBER       Y
    COL2 VARCHAR2(30) Y                         
    
    SQL>
    SQL> DECLARE
      2     v_table_name USER_TAB_COLUMNS.TABLE_NAME%TYPE := 'TEST_2';
      3     c_column_suffix CONSTANT VARCHAR2(1) := 'E';
      4  BEGIN
      5     FOR REG IN (SELECT UTC.COLUMN_NAME
      6                   FROM USER_TAB_COLUMNS UTC
      7                  WHERE utc.TABLE_NAME = v_table_name) LOOP
      8        EXECUTE IMMEDIATE 'ALTER TABLE ' || v_table_name || ' RENAME COLUMN ' ||
      9                          reg.column_name || ' TO ' ||
     10                          substr(reg.column_name,
     11                                 1,
     12                                 29) || c_column_suffix;
     13     END LOOP;
     14  END;
     15  /
    
    PL/SQL procedure successfully completed
    
    SQL> desc test_2;
    Name  Type         Nullable Default Comments
    ----- ------------ -------- ------- --------
    COL1E NUMBER       Y
    COL2E VARCHAR2(30) Y                         
    
    SQL>
    

    Kind regards

  • How to add a value to a column of a string of pop up

    I am really inexperienced with spreadsheets, but asked me to help create a timesheet for a rotational system.

    I know that the time could be manually entered and calculated in duration but as there are only four options, let's say A, B, C travel and OFF, it would save a lot of time if there is a pop-up menu along side each name and under every day so that when a change is selected, the corresponding hours would be added in the total column.

    I actually created the spreadsheet with context menus as follows:

    08:00 - 15:00

    15:00 - 22:00

    Off

    08:00 - 18:00

    The reason why the 08:00 - 18:00 is in the end, it is a special change that only supervisors do.

    In any case, is there a way that these string values can be converted to hours to a total of column? I tried, very awkwardly, and I can't really follow the logic of the formulas of the numbers so I would be very grateful if someone could help me.

    I've included a selective screenshot in case my description is not very clear; Thank you.

    Hello Alf,

    The key to this is to use a lookup table for the transit time of list (as in your Menus pop up) and the number of normal hours for this position.

    Note this column of the table must match exactly to your Menus pop up (I added spaces on both sides of the hyphen).

    Then another table (hours) to account for the infeed Table and convert shifts in hours.

    Formula in B2 of table of the hours (and fill right and fill down)

    = INDEX (Lookup::$B,MATCH(Input::B2,Lookup::$A,0))

    My cheat for the combination of the INDEX sheet and MATCH:

    = INDEX (column, I want a value returned by,)

    MATCH (the value of my choice,

    Column, I want to search against.

    Enter ""0")).

    Finally, the formula in the column "hours worked" (right part of the input table)

    I2 = SUM (Hours::2:2)

    And fill down.

    Kind regards

    Ian.

    Edit: You can move (copy / paste) the table and the table to another worksheet hours to 'hide '. Ian.

  • A loop until the end of the column

    Hello!

    I have a string type 2D table that I want to loop through. The output of the table is feeding an "analysis of the string" vi and then converted into a timestamp. The problem is that the column of my table 2D is a different size. This means that some columns have a few empty cells towards the end of the column. When the cells are feed to the 'string analysis', and it occurs. I want it first is research in the table and delete all of the empty cells or find a way to the loop to the bottom of the column and stop when empty cells begin. The table is not fixed, then it is impossible to use a constant here. Can someone help me on this one?

    Greetings

    Kristoffer

    Here is my interpretation of the solution of Alexander.

    Right-click on the inner circle for loop to add the conditional terminal.

Maybe you are looking for