View Full Version : Trigger Problem, Forms 9i
Johnasc
03-19-2004, 02:46 PM
Hi all,
We are running Oracle forms at my University and we have a lot of
configuration problems which vary from machine to machine. I cannot get the
trigger below tro run (the form loads, the trigger does nothing and no error
is displayed). I would appreciate it if someone could tell me if the problem
lies with my trigger code or elsewhere:
The aim is to populate a listbox at runtime with the result set of a query:
DECLARE
record_group_name VARCHAR2(20) := 'Project_Numbers';
record_group_id RecordGroup;
error_code NUMBER;
BEGIN
-- Check that the record group hasn't already been created
record_group_id := Find_Group(record_group_name);
-- If the record group has not already been created
IF Id_Null(record_group_id) THEN
-- Create the record group
record_group_id :=
Create_Group_From_Query(record_group_name,
'SELECT DISTINCT projectNo FROM
Project');
END IF;
-- Populate the record group with records from the database
error_code := Populate_Group(record_group_id);
-- If the query succeeded
IF error_code <> 0 THEN
-- Clear the list of its current items, if any
CLEAR_LIST('PROJECTNO');
-- Close any open queries before populating the list
ABORT_QUERY();
-- Populate the list with the record group
POPULATE_LIST('PROJECTNO', record_group_id);
END IF;
END;
Thanks in advance,
Johnasc
Rolf Unger
03-20-2004, 03:28 AM
"Johnasc" <news@news.net> wrote in message news:<bKK6c.542$_r2.9@newsfep3-gui.server.ntli.net>... Hi all, We are running Oracle forms at my University and we have a lot of configuration problems which vary from machine to machine. I cannot get the trigger below tro run (the form loads, the trigger does nothing and no error is displayed). I would appreciate it if someone could tell me if the problem lies with my trigger code or elsewhere: The aim is to populate a listbox at runtime with the result set of a query: [ ... ] -- Populate the record group with records from the database error_code := Populate_Group(record_group_id); -- If the query succeeded IF error_code <> 0 THEN -- Clear the list of its current items, if any CLEAR_LIST('PROJECTNO'); -- Close any open queries before populating the list ABORT_QUERY(); -- Populate the list with the record group POPULATE_LIST('PROJECTNO', record_group_id); END IF; END; Thanks in advance, Johnasc
My docu (Forms 5) says:
..-----------------------------------------------------------
: POPULATE_GROUP_WITH_QUERY built-in
:
: Populates a record group with the given query. The record group is
: cleared and rows that are fetched replace any existing rows in the
: record group.
:
: If the SELECT statement fails, Form Builder returns an ORACLE error
: number. If the query is successful, this built-in returns 0 (zero).
:
'-----------------------------------------------------------
So your code needs to be the other way round
-- If the query succeeded
IF error_code = 0
THEN
-- Populate the list ..
...
ELSE
... some error handling code
END IF;
I'm pretty sure, they haven't changed the return code behaviour of
Populate_Group() for 6i and 9i ;-)
Hint: Try to trace your Execution-Flow in the triggers
Either with a debugger (maybe tough in a 3 Tier application)
or add some Messages to the code:
Message('Executing "if error_code = 0" part');
-- and a second time to force the message poping up
Message('Executing "if error_code = 0" part');
HTH, Rolf
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.