Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle Forms 9 Problem

Oracle Forms 9 Problem

From: Sykiemikey <sykiemikey_at_hotmail.com>
Date: 26 Apr 2006 14:01:30 -0700
Message-ID: <1146085290.817078.146520@i40g2000cwc.googlegroups.com>


I am learning forms with Oracle 9i and have run into a problem.

The following code runs just fine in a Save Button with a WHEN -BUTTON-PRESSED trigger that inserts a record from a stacked single record block (does not allow updates or deletes from it).

DECLARE

        edit_alert alert;
        show boolean := false;
        message varchar2(150) := 'You Must Fill the Following Fields:';

        choice number;
BEGIN
        IF :add_region.region_id IS NULL THEN
                show := true;
                message := message || CHR(10) || '----- Region Id';
        END IF;


        IF show = true THEN
                edit_alert := Find_Alert('EDIT');
                set_alert_property(edit_alert, ALERT_MESSAGE_TEXT,
message);
                choice := show_alert(edit_alert);
        ELSE
                insert_record;
                commit;
                clear_block;
                go_block('regions');
        END IF;

END; But when I try to use the following trigger on a Save button which is almost identical on a table canvas with a multi-line block that allows queries, updates and deletes...it basically skips the IF....IS NULL section because the show never turns true and the alert never fires so it automatically trys to update the record, but fails because of the null value. It works perfect if the item is not null and gets inserted.

 I figure that it has something to do with :regions.region_id within a multi-line block and the if statement not knowing the current record. I have searched and searched for a solution with no luck. Can anyone help?

DECLARE

        edit_alert alert;
        show boolean := false;
        message varchar2(150) := 'You Must Fill the Following Fields:';

        choice number;
BEGIN
        IF :regions.region_id IS NULL THEN
                show := true;
                message := message || CHR(10) || '----- Region Id';
        END IF;


        IF show = true THEN
                edit_alert := Find_Alert('EDIT');
                set_alert_property(edit_alert, ALERT_MESSAGE_TEXT,
message);
                choice := show_alert(edit_alert);
        ELSE
                update_record;
                commit;
        END IF;

END; I appreciate any time and help....

Michael Received on Wed Apr 26 2006 - 16:01:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US