Home » Developer & Programmer » Reports & Discoverer » trigger procedure call (Report 9i)
trigger procedure call [message #455658] Wed, 12 May 2010 07:35 Go to next message
lokeshsurana
Messages: 212
Registered: April 2010
Location: India
Senior Member
in After Parameter form
function AfterPForm return boolean is
begin
  v1:=:v_emp_id;
  emp_valid(v1);
  flag:=v1;
  
  if flag=0 then
     insert into temp values(v1);
     commit;
     return (TRUE);
  else
     return (false);
  end if;
  	
end;

emp_valid procedure is as:
PROCEDURE emp_valid (empid in out number)IS
  cursor c1 is
    select dept from temp;
  flag number:=0;
begin
  for i in c1 loop
    if i.dept= :v_emp_id then
       flag:=1;
    else
       flag:=0;
    end if; 
  end loop;

  empid:=flag;
END;

but this trigger call is not getting validate.....
it will not inserting values in table as
getting error on validate trigger

[EDITED by LF: applied [code] tags]

[Updated on: Wed, 12 May 2010 07:42] by Moderator

Report message to a moderator

Re: trigger procedure call [message #455661 is a reply to message #455658] Wed, 12 May 2010 07:44 Go to previous messageGo to next message
Littlefoot
Messages: 21580
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You didn't declare all variables you should in the "After parameter form" trigger.

Why "IN OUT" procedure? Why not a simple function?
Re: trigger procedure call [message #455666 is a reply to message #455661] Wed, 12 May 2010 07:55 Go to previous messageGo to next message
lokeshsurana
Messages: 212
Registered: April 2010
Location: India
Senior Member
I want to call procedure in trigger that i just want....

whatever calculation loop part i want write in procedure

and that procedure want to call in trigger function for validation just like if ...else
Re: trigger procedure call [message #455667 is a reply to message #455661] Wed, 12 May 2010 07:56 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Your procedure makes no sense.
You appear to comparing an employee_id to a department, which'll never match.
The loop will give you false negatives unless the matching record is the last one retrieved by the query.
Re: trigger procedure call [message #455668 is a reply to message #455667] Wed, 12 May 2010 08:00 Go to previous messageGo to next message
lokeshsurana
Messages: 212
Registered: April 2010
Location: India
Senior Member
i want only one time user can see the report of departments....

as user once enter in 10 number department then next time it not able to enter in department number 10....
Re: trigger procedure call [message #455670 is a reply to message #455668] Wed, 12 May 2010 08:05 Go to previous messageGo to next message
lokeshsurana
Messages: 212
Registered: April 2010
Location: India
Senior Member
My trigger function body is as:::

function AfterPForm return boolean is
flag number;
v1 number;
v2 number;
begin
test1(:v_emp_id,flag);
if flag=0 then
return (TRUE);
else
return (false);
end if;
end;

and my procedure body is as.....

PROCEDURE test1(empno in number,f out number) IS
cursor c1 is
select dept from temp;
BEGIN
for i in c1
loop
if i.dept=empno then
f:=1;
else
insert into temp values(empno);
commit;
f:=0;
end if;
end loop;
END;

and temp table having only one column as dept.

is real which i implement

getting error as:
REP-0771:After Form Trigger Faild

i am not able to what actual problem with trigger....bcoz logiacl it is correct...
Re: trigger procedure call [message #455672 is a reply to message #455670] Wed, 12 May 2010 08:10 Go to previous messageGo to next message
lokeshsurana
Messages: 212
Registered: April 2010
Location: India
Senior Member
@littlefoot
you get my problem...and what i am implementing...
Re: trigger procedure call [message #455690 is a reply to message #455672] Wed, 12 May 2010 09:35 Go to previous message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
You know how to use code tags, please do so.

Logically it is incorrect.
You are still comparing dept to emp_id which'll never match (unless one of those columns is misnamed, in which case rename it).
Your insert will run multiple times since it's in a loop.
Asumming you have more than one user you're going to need to store sufficient data to determine who ran what.

Post a desc of temp and tell us what the primary key is.
Previous Topic: uses of extra design pages within the Paper Layout
Next Topic: create table
Goto Forum:
  


Current Time: Sun Aug 09 04:27:47 CDT 2020