|Subject||Re: [firebird-support] Test VARCAHR for numeric|
|Author||Walter R. Ojeda Valiente|
On Thu, Apr 23, 2015 at 8:00 PM, Walter R. Ojeda Valiente <sistemas2000profesional@...> wrote:You can use SIMILAR TO, something like it:SELECTMyColumn1,MyColumn2,,MyColumn3FROMMyTableWHEREMyColumn1 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:Greetings.Walter.On Thu, Apr 23, 2015 at 2:34 PM, sboydlns@... [firebird-support] <email@example.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.