【发布时间】:2016-08-04 15:19:39
【问题描述】:
我有一个关于 Oracle Apex 上的字段验证的简单问题。我正在尝试在 'Work Package Name' 文本字段上验证是 'WP' 后跟两位数字或 'AM' 后跟两位数字 e.g WP00 & AM01 将被接受,WP000 & AN01 将不被接受。
我不确定选择哪个验证选项,因此我决定使用 PL/SQL 返回一个布尔值。我的代码似乎不正确(见下文)。
如果我在 TOAD 中创建它,我会声明字段名称,但我假设通过使用 :P7_WP_NAME 这是做同样的工作。
IF :P7_WP_NAME = WP(2,0)
ELSE IF :P7_WP_NAME = AM(2,0)
THEN RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
我目前收到的错误如下。我尝试重新编写代码,但不断收到不同的错误:
ORA-06550: line 2, column 1: PLS-00103: Encountered the symbol "ELSE" when expecting one of the following: . ( * % & - + / at mod remainder rem then <an exponent (**)> and or || multiset ORA-06550: line 7, column 18: PLS-00103: Encountered the symbol ";" when expecting one of the following: if The symbol "if" was substituted for ";" to continue. ORA-06550: line 7, column 54: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception
如果您能告诉我这是否是最好的验证选项以及我哪里出错了,我将不胜感激。
【问题讨论】:
标签: oracle validation plsql oracle-apex