在 Oracle 中如何判断一个值是否不是数字? [英] How can you tell if a value is not numeric in Oracle?

查看:28
本文介绍了在 Oracle 中如何判断一个值是否不是数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的值无效,我有以下代码返回错误消息.如果给定的值不是数字,我想给出相同的错误消息.

I have the following code that returns an error message if my value is invalid. I would like to give the same error message if the value given is not numeric.

IF(option_id = 0021) THEN 
      IF((value<10000) or (value>7200000) or /* Numeric Check */)THEN
          ip_msg(6214,option_name);  -- Error Message
          return;
      END IF;
END IF;      

在 SQL Server 中,我只是使用了 ISNUMERIC().我想在 Oracle 中做类似的事情.比如,

In SQL Server, I simply used ISNUMERIC(). I would like to do something similar in Oracle. Such as,

IF((!ISNUMERIC(value)) or (value<10000) or (value>7200000))
    THEN ...

推荐答案

REGEXP_LIKE(column, '^[[:digit:]]+$')

如果列只包含数字字符则返回 TRUE

returns TRUE if column holds only numeric characters

这篇关于在 Oracle 中如何判断一个值是否不是数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆