触发器,程序的流程不会停止

时间:2013-10-02 22:55:14

标签: sql oracle

我在Oracle Forms上制作了一个简单的程序。下面的代码是按下提交按钮时的触发器。

这是:

BEGIN
CREATE_RECORD;

IF :USERS.USERNAME IS NULL THEN
    MESSAGE('Please enter Username');
    GO_ITEM('USERNAME');

ELSIF :USERS.PASSWORD IS NULL THEN
    MESSAGE('Please enter Password');
    GO_ITEM('PASSWORD');

ELSIF :USERS.PASSWORD2 IS NULL THEN
    MESSAGE('Please confirm your Password');
    GO_ITEM('PASSWORD2');

ELSIF :USERS.PASSWORD != :USERS.PASSWORD2 THEN
    MESSAGE('Password did not match');
    GO_ITEM('PASSWORD2');

ELSIF :USERS.NAME IS NULL THEN
    MESSAGE('Please enter your Name');
    GO_ITEM('NAME');

ELSIF :USERS.POSITION IS NULL THEN
    MESSAGE('Please enter your Position');
    GO_ITEM('POSITION');

END IF;

IF :USERS.ACCESS_LEVEL = 'admin' THEN

    IF :USERS.ADMIN_PASS = 'eweb1' THEN

        alert:= show_alert('USER_CREATED');

            IF alert = alert_button1 THEN
            MESSAGE('OK');
            END IF;

    ELSE
                MESSAGE('Administrator Password did not match');
                GO_ITEM('ADMIN_PASS');
    END IF;

    ELSE
        alert:= show_alert('USER_CREATED');

            IF alert = alert_button1 THEN
                /* foo */
            END IF;

END IF;

END;

当表单遇到错误时,例如当第二个密码(password2)不匹配时以及当它显示“密码不匹配”的消息时,它仍会流动并读取以下语句而不是停止并等待按钮被再次按下我希望我能解决这个问题。 TNX

1 个答案:

答案 0 :(得分:1)

您可以告诉MESSAGE在继续之前等待操作员确认消息:

MESSAGE('Please enter Username', ACKNOWLEDGE);