Again, if you can read Spanish then the following article has more examples:

https://firebird21.wordpress.com/2015/04/23/validando-que-el-contenido-de-un-char-o-varchar-sea-numerico/

Greetings.

Walter.


On Thu, Apr 23, 2015 at 8:03 PM, Walter R. Ojeda Valiente <
sistemas2000profesio...@gmail.com> wrote:

> Sorry, typo in the SELECT, just one comma after MyColumn2.
>
> Greetings.
>
> Walter.
>
>
> On Thu, Apr 23, 2015 at 8:00 PM, Walter R. Ojeda Valiente <
> sistemas2000profesio...@gmail.com> wrote:
>
>> You can use SIMILAR TO, something like it:
>>
>> SELECT
>>    MyColumn1,
>>    MyColumn2,,
>>    MyColumn3
>> FROM
>>    MyTable
>> WHERE
>>    MyColumn1 SIMILAR TO '[[:DIGIT:]]*'
>>
>> Where just the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 are valid.
>>
>> If you need the decimal point too, try something like it, where the
>> decimail point is required:
>>
>> SIMILAR TO '[[:DIGIT:]]*.[[:DIGIT:]]*'
>>
>> And if you can have integers and floats (decimal point can be, but not
>> required), you can try:
>>
>> SIMILAR TO '[[:DIGIT:]]*.?[[:DIGIT:]]*'
>>
>> And, finally, if you can read Spanish, take a look at:
>>
>> https://firebird21.wordpress.com/2014/04/27/usando-similar-to/
>>
>> https://firebird21.wordpress.com/2014/11/25/validando-un-e-mail/
>>
>> Greetings.
>>
>> Walter.
>>
>>
>> On Thu, Apr 23, 2015 at 2:34 PM, sboyd...@gmail.com [firebird-support] <
>> firebird-support@yahoogroups.com> wrote:
>>
>>>
>>>
>>> Is there any way, within a stored procedure, to test a VARCHAR to see if
>>> it contains a valid number? I have a parameter that can contain different
>>> types of value and it would be nice to be able to know if CAST(param as
>>> BIGINT) is going to fail before an exception is thrown.
>>>
>>>
>>>
>>>  
>>>
>>
>>
>
  • ... sboyd...@gmail.com [firebird-support]
    • ... 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
      • ... 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
        • ... 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
      • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
        • ... 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
          • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
            • ... 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]
              • ... sboyd...@gmail.com [firebird-support]

Reply via email to