Subject | Re: [firebird-support] Test VARCAHR for numeric |
---|---|
Author | Mark Rotteveel |
Post date | 2015-04-24T06:53:33Z |
On Thu, 23 Apr 2015 20:00:32 -0400, "'Walter R. Ojeda Valiente'
sistemas2000profesional@... [firebird-support]"
<firebird-support@yahoogroups.com> wrote:
of digits in a number (eg 10 in an INTEGER, 19 or 20 in a BIGINT), but even
then there is no guarantee (eg 2,147,483,648 doesn't fit in an INTEGER,
while 2,147,483,647 does). The only sure way is too actually attempt the
conversion and handle the exception.
sistemas2000profesional@... [firebird-support]"
<firebird-support@yahoogroups.com> wrote:
> You can use SIMILAR TO, something like it:I'd also check for minus signs, and take into account the maximum number
>
> 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.
of digits in a number (eg 10 in an INTEGER, 19 or 20 in a BIGINT), but even
then there is no guarantee (eg 2,147,483,648 doesn't fit in an INTEGER,
while 2,147,483,647 does). The only sure way is too actually attempt the
conversion and handle the exception.
> If you need the decimal point too, try something like it, where theDon't forget the exponent notation (eg 5.203E-5)
> 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:Mark
>
> https://firebird21.wordpress.com/2014/04/27/usando-similar-to/
>
> https://firebird21.wordpress.com/2014/11/25/validando-un-e-mail/