问题描述
你好,
我是一个新手开发APEX 19。2上的应用程序。我有一张带田野的表START_DATE数据类型TIMESTAMP WITH LOCAL TIME ZONE。
我也有一个带有此字段的表单,为此我指定了Identification Type作为日期选择器,以及Format Mask DD-MON-YYYY HH24:MI:SS。
With the default validation on this field which checks that the value is of timestamp format, it all works very well; I can input date and time using the date picker and the form submits fine。
我现在正在尝试添加一个额外的验证,以确保START_DATE is a future timestamp。 So for this validation, I set the Validation Type作为PL/SQL表达式,并为表达式设置以下内容:
: p17 _ 开始 _ 日期> 当前 _ 时间戳
为了完整起见,我设置了Error Message作为 “# LABEL # 必须在未来” 和Associated Item as P17_START_DATE (which is how the form item appears)。 All other settings for the validation are left as default。
If I then try to submit the form, I get an error message saying "Error processing validation。"
我做错了什么?
我是一个新手开发APEX 19。2上的应用程序。我有一张带田野的表START_DATE数据类型TIMESTAMP WITH LOCAL TIME ZONE。
我也有一个带有此字段的表单,为此我指定了Identification Type作为日期选择器,以及Format Mask DD-MON-YYYY HH24:MI:SS。
With the default validation on this field which checks that the value is of timestamp format, it all works very well; I can input date and time using the date picker and the form submits fine。
我现在正在尝试添加一个额外的验证,以确保START_DATE is a future timestamp。 So for this validation, I set the Validation Type作为PL/SQL表达式,并为表达式设置以下内容:
: p17 _ 开始 _ 日期> 当前 _ 时间戳
为了完整起见,我设置了Error Message作为 “# LABEL # 必须在未来” 和Associated Item as P17_START_DATE (which is how the form item appears)。 All other settings for the validation are left as default。
If I then try to submit the form, I get an error message saying "Error processing validation。"
我做错了什么?
专家解答
问题是格式掩码。
您在APEX中的项目基本上都是字符串,即,浏览器并没有真正的数据类型的想法。
因此 (没有格式掩码),当您从APEX中的选择器中选择日期时,您正在将格式化的字符串放入您的项目中,其中的格式是 * 已知 * 的APEX。
当你的验证触发时,虽然它看起来像:
: p17 _ 开始 _ 日期> 当前 _ 时间戳
数据库在幕后执行此操作以使数据类型正确对齐:
至 _ 时间戳 (: p17 _ 开始 _ 日期)> 当前 _ 时间戳
当您不使用格式掩码时,这将起作用。但是,当 * you * 添加自己的格式掩码时,上面的调用可能会失败,因为您的调用可能与apex/database所期望的不一致。
所以只要改变你的验证来明确控制格式,即
时间戳 (: p17开始日期,'dd-MON-YYYY HH24:MI:SS')> 当前时间戳
你应该可以走了
您在APEX中的项目基本上都是字符串,即,浏览器并没有真正的数据类型的想法。
因此 (没有格式掩码),当您从APEX中的选择器中选择日期时,您正在将格式化的字符串放入您的项目中,其中的格式是 * 已知 * 的APEX。
当你的验证触发时,虽然它看起来像:
: p17 _ 开始 _ 日期> 当前 _ 时间戳
数据库在幕后执行此操作以使数据类型正确对齐:
至 _ 时间戳 (: p17 _ 开始 _ 日期)> 当前 _ 时间戳
当您不使用格式掩码时,这将起作用。但是,当 * you * 添加自己的格式掩码时,上面的调用可能会失败,因为您的调用可能与apex/database所期望的不一致。
所以只要改变你的验证来明确控制格式,即
时间戳 (: p17开始日期,'dd-MON-YYYY HH24:MI:SS')> 当前时间戳
你应该可以走了
文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




