【问题标题】:how to compare and check if string is entered in number field in sql如何比较和检查是否在sql的数字字段中输入了字符串
【发布时间】:2018-09-04 12:48:05
【问题描述】:

我在 oracle apex 中进行页面验证。我只是对如何检查用户是否在数字字段中输入字符串感到困惑。 我是这样做的:

if :P2_SAL > 85000  then
return 'Salary must be less THAN 85K';
else if :P2_SAL <> NUMBER then
return 'please enter salary in digits';
ELSE RETURN NULL;
end if;

【问题讨论】:

    标签: plsql oracle-apex


    【解决方案1】:

    正则表达式在这里可能会有所帮助,例如

    if not regexp_like(:P2_SAL, '^\d+$') then
       return 'Please enter salary in digits';
    end if;
    

    【讨论】:

      【解决方案2】:

      如果您使用 Oracle APEX 5,则有一个标准验证来检查值是否为数字:

      【讨论】:

      • 是的,我知道,但我并没有为每个项目都这样做。我正在使用函数返回错误文本选项为整个页面做这件事。
      • 你不需要。通过将您的字段定义为数字项,验证是固有的。
      猜你喜欢
      • 2015-12-17
      • 2011-07-22
      • 2015-12-03
      • 1970-01-01
      • 2021-03-08
      • 2014-03-15
      • 1970-01-01
      相关资源
      最近更新 更多