Home » Developer & Programmer » Reports & Discoverer » Validation Subquery
Validation Subquery [message #89731] Mon, 12 July 2004 07:51 Go to next message
Steve
Messages: 190
Registered: September 1999
Senior Member
Hi all -

I am running Reports 6i and I would like to know if its possible to write a subquery in a validation function?  I have a parameter that I want to validate against a column in the DB (using literals will require too much upkeep) but I get a message saying a subquery can't be used in this context when I put the PL/SQL in the validate trigger.  Here is my code:
function P_UNIONValidTrigger return boolean is
begin
  if :p_union IN
   (select segment1 from pay_people_groups) THEN
    return (TRUE);
  else
    return (FALSE);
  end if;
end;

Pretty simple, but subquery not allowed?  If not, how can I accomplish this?  Thanks in advance!

Regards,

Steve
Re: Validation Subquery [message #89743 is a reply to message #89731] Wed, 14 July 2004 23:35 Go to previous message
Himanshu
Messages: 457
Registered: December 2001
Senior Member
Hi,
Why don't you chnage it as follows:

function P_UNIONValidTrigger return boolean is
L_num Number(10):=0;
begin
Begin
select count(1) into from pay_people_groups
where segment1 =:p_union;
exception
when other then L_num:=0;
end;
if L_num>0 Then
return (TRUE);
else
return (FALSE);
end if;
end;

HTH
Regards
Himanshu
Previous Topic: Group Item
Next Topic: Is it worth going from release 6i to 9i
Goto Forum:
  


Current Time: Fri Nov 22 08:59:12 CST 2024