You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Oracle APEX表单验证需求咨询:三类字段校验实现方案

Got it! Let's walk through exactly how to set up each of these three validations using Oracle APEX's built-in Create Validation feature on your edit page. I’ve done this countless times, so let’s break it down step by step for each requirement:

1. 字段非空验证

  • Open your edit page in Page Designer. In the left-hand Rendering panel, select the field you need to validate (e.g., P1_FULL_NAME).
  • Right-click the field and choose Create Validation, or use the top menu: Create > Validation.
  • In the creation wizard:
    • Set Validation Type to Item is NOT NULL
    • Pick your target field under Validation Target
    • Enter a clear error message like "此字段不能为空,请输入内容"
    • Adjust Validation Execution to match when you want the check to run (most often, select When Button Pressed and choose your submit button like CREATE/SAVE)
    • Save the config, then test by submitting an empty value—you should see your error message pop up.

2. 数值范围验证(1-1000之间)

  • Back in Page Designer, select your numeric field (e.g., P1_QUANTITY) and create a new validation.
  • Set Validation Type to Item/Column in Expression 1 is between Expression 2 and Expression 3
  • Fill in the expressions:
    • Expression 1: :P1_QUANTITY (remember the colon is how APEX references page items)
    • Expression 2: 1
    • Expression 3: 1000
  • Set your error message to "输入的数值必须在1到1000之间,请重新输入"
  • Confirm the execution timing, save, then test with values like 0 or 1001—the validation should trigger immediately.

3. 出生日期不得晚于2018年6月5日(dd/mm/yyyy格式)

Since your date field uses dd/mm/yyyy format, we’ll need a PL/SQL expression to properly compare dates:

  • Select your date field (e.g., P1_BIRTH_DATE) and create a new validation.
  • Set Validation Type to PL/SQL Expression
  • Paste this expression into the field:
    TO_DATE(:P1_BIRTH_DATE, 'DD/MM/YYYY') <= TO_DATE('05/06/2018', 'DD/MM/YYYY')
    
    This converts the user’s input string to a DATE type, then compares it to our target date (June 5, 2018, formatted as dd/mm/yyyy).
  • Set your error message to "出生日期不得晚于2018年6月5日,请重新选择日期"
  • Choose the correct execution timing, save, then test with a date like 06/06/2018—you’ll see the error as expected.

内容的提问来源于stack exchange,提问作者Fido Dido

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 03:28:29