2 Replies Latest reply on Oct 20, 2014 7:26 PM by Sanjaya Kumar Pradhan

    Identify string contains 'only zeros' and ' zeros and other digits'

    Jodus

      Hi ,

      How seperately identify a string with  only zeros and,  string with zeros and other digits  , by not using > 0 condition, may be by using regexp or other ways.

      A codition needs to add in the where clause  to find out  the string value which has  non zero value in the table field.

       

      In the table values stored as string  -   ('0000000000', '0001000200')    and from this example  the query should return - 0001000200

       

      Thanks to all

        • 1. Re: Identify string contains 'only zeros' and ' zeros and other digits'

          Wrong forum!

           

          As the title says this forum is ONLY for sql developer questions and NOT for SQL or PL/SQL questions.

           

          Please mark this ANSWERED and repost in the SQL and PL/SQL forum:

          SQL & PL/SQL

           

          When you repost you should provide your full database name and version and also the PROBLEM you are really trying to solve.

          How seperately identify a string with  only zeros and,  string with zeros and other digits  , by not using > 0 condition, may be by using regexp or other ways.

          A codition needs to add in the where clause  to find out  the string value which has  non zero value in the table field.

           

          In the table values stored as string  -   ('0000000000', '0001000200')    and from this example  the query should return - 0001000200

          In particular you need to explain WHY you insist that a '> 0' can't be used. Experts in the forum generally try to provide the BEST answer for the actual problem and not some gimmick answer based on some made-up requirement like "don't do it this way".

           

          If you have a valid reason for not being able to use a '> 0' solution you need to state it. Otherwise you risk getting flamed or getting a technically correct solution like: use '= 0'. Hey it doesn't use '> 0' so it meets your 'requirement'.

          • 2. Re: Identify string contains 'only zeros' and ' zeros and other digits'
            Sanjaya Kumar Pradhan

            Hi,

            As earlier mentioned this is not the right forum for this query.Still i would like to answer your query here. You can try the following query..

            select text from test_zero where  REGEXP_LIKE(text, '^[0]+$');

             

            please mark as answered if the solution is correct, it will help others.

             

            Thanks,

            Sanjaya