Problem in Accessinf form from Menu [message #299178] |
Sun, 10 February 2008 06:35  |
asadkhan_2
Messages: 36 Registered: January 2008
|
Member |
|
|
When i access form from my menu the error is
FRM-21011 PL/SQL unhandled exception ORA 06502
i know this error but i cant understand that where the problem is the code to call a form is
declare
v_group number;
v_fsn varchar2(25);
v_flag boolean:=false;
cursor cr_check is
select t.form_short_name from qcl06_groups_forms g,qcl007_forms t
where g.form_id=t.form_id
and g.group_id=v_group;
begin
select group_id into v_group from qcl03_user_group_name t
where user_id=:global.user_id;
open cr_check;
loop
fetch cr_check into v_fsn;
exit when cr_check%notfound;
if v_fsn='groupforms'
then
v_flag:=true;
Call_Form ('groupforms.fmx', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY);
end if;
end loop;
close cr_check;
if v_flag=false
then
Message('Access Is Denied');
Message('Access Is Denied');
end if;
end;
|
|
|
Re: Problem in Accessinf form from Menu [message #299189 is a reply to message #299178] |
Sun, 10 February 2008 09:25   |
 |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Please, read the OraFAQ Forum Guide to learn how to properly format your code. The way you've put it, it is almost unreadable.
As of your question: is cursor loop really necessary? Couldn't it be written like this:declare
v_group qc103_user_group_name.group_id%type;
v_fsn qc1007_forms.form_short_name%type;
v_flag boolean := false;
begin
select group_id
into v_group
from qcl03_user_group_name t
where user_id = :global.user_id;
select t.form_short_name
into v_fsn
from qcl06_groups_forms g, qcl007_forms t
where g.form_id = t.form_id
and g.group_id = v_group;
if v_fsn = 'groupforms'
then
v_flag := true;
Call_Form ('groupforms.fmx', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY);
end if;
if v_flag = false
then
message('Access Is Denied');
raise form_trigger_failure;
end if;
end;
Although you've said you know what this error means. I guess it will do no harm if we show it once again:Oracle | ORA-06502 PL/SQL: numeric or value error string
Cause: An arithmetic, numeric, string, conversion, or constraint error occurred. For example, this error occurs if an attempt is made to assign the value NULL to a variable declared NOT NULL, or if an attempt is made to assign an integer larger than 99 to a variable declared NUMBER(2).
Action: Change the data, how it is manipulated, or how it is declared so that values do not violate constraints.
|
As you are the only one who knows data used in this code, I believe it is you who can answer the question. As you've seen, I've changed variables' declaration - I didn't use fixed datatypes, but referenced them to table columns' datatypes in order to avoid the error you got. For example, perhaps 'form_short_name' was longer than 25 characters and threw an error.
|
|
|
|