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

查看:1230
本文介绍了如何判断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天全站免登陆