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

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

Oracle Forms 9 Problem

From: Sykiemikey <sykiemikey_at_hotmail.com>
Date: 26 Apr 2006 13:55:18 -0700
Message-ID: <1146084918.234080.179510@u72g2000cwu.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 - 15:55:18 CDT

Original text of this message

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