Home » Developer & Programmer » Forms » database trigger (oracle 9i , Windows)
database trigger [message #402172] Thu, 07 May 2009 23:59 Go to next message
majid tahir
Messages: 39
Registered: July 2007
Location: Pakistan
Member
I want to create a trigger that automatically exit the forms after six months. I have create a trigger but its not working accordingly.
Re: database trigger [message #402173 is a reply to message #402172] Fri, 08 May 2009 00:02 Go to previous messageGo to next message
BlackSwan
Messages: 25042
Registered: January 2009
Location: SoCal
Senior Member
majid tahir wrote on Thu, 07 May 2009 21:59
I want to create a trigger that automatically exit the forms after six months. I have create a trigger but its not working accordingly.


Your answer is just a few clicks beyond the URL below.
http://tahiti.oracle.com
Let us know when you have found your answer.
Re: database trigger [message #402175 is a reply to message #402173] Fri, 08 May 2009 00:08 Go to previous messageGo to next message
majid tahir
Messages: 39
Registered: July 2007
Location: Pakistan
Member
there is nothing in the link
Re: database trigger [message #402176 is a reply to message #402175] Fri, 08 May 2009 00:12 Go to previous messageGo to next message
BlackSwan
Messages: 25042
Registered: January 2009
Location: SoCal
Senior Member
majid tahir wrote on Thu, 07 May 2009 22:08
there is nothing in the link

If you consider the whole Oracle Documentation Set as nothing, then perhaps you should question your ability to master Oracle.
Re: database trigger [message #402180 is a reply to message #402176] Fri, 08 May 2009 00:20 Go to previous messageGo to next message
majid tahir
Messages: 39
Registered: July 2007
Location: Pakistan
Member
If i have to read the whole documentation and then find my answer then why are you here for???? This portal provides assistant to save time. You people are here for providing fast response. It is requested to you to assist in the right manner.
Re: database trigger [message #402182 is a reply to message #402172] Fri, 08 May 2009 00:29 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
majid tahir wrote on Fri, 08 May 2009 06:59
I want to create a trigger that automatically exit the forms after six months.
Six months?!? Do you really expect this computer to run that long? It will reboot sooner or later, but (I guess) sooner than 6 months.

Quote:
I have create a trigger but its not working accordingly.
How does your trigger look like? Perhaps it just requires a little bit of assistance?

Anyway: I think that a database trigger is a wrong tool to do that; Forms' timer might be a better choice.
Re: database trigger [message #402186 is a reply to message #402182] Fri, 08 May 2009 00:35 Go to previous messageGo to next message
majid tahir
Messages: 39
Registered: July 2007
Location: Pakistan
Member
My trigger and table is attached.

============================================================================
create table check_passcode
(pass_id varchar2(10),
pass_date date,
pass_flag varchar2(10));
========================================NEW=================================
declare
v_pass_id Varchar2(10);
v_pass_date date;
v_pass_flag varchar2(10);

begin
select pass_date,pass_flag into v_pass_date,v_pass_flag from check_passcode
where pass_id=1;

if v_pass_flag='N' then
exit_form;

else

if v_pass_date>= sysdate then
MESSAGE ('SORRRYYYYYYYYYYYYYYYY');
exit_form;
update check_passcode
set pass_flag='N';

else if v_pass_date+10< sysdate then
message('SORRRRYYYYYYYYYYYYYY');
exit_form;
update check_passcode
set pass_flag='N';
end if;
end if;
end if;

exception
when no_data_found then
insert into check_passcode (pass_id,pass_date,pass_flag)
values('1',sysdate,'y');
end;
Re: database trigger [message #402189 is a reply to message #402186] Fri, 08 May 2009 00:53 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, so this is a trigger (an unreadable one. Would you mind to format it and enclose into the [code] tags next time you post a piece of code, please?). Which one (i.e. what is its name)? Your initial post talks about a database trigger, but - as far as I can tell - this is a Forms trigger. So, which one are you really interested in?

Also, saying that "it doesn't work" isn't very helpful. What does that mean? Is there any error? If so, which one?
Re: database trigger [message #402196 is a reply to message #402189] Fri, 08 May 2009 01:10 Go to previous messageGo to next message
majid tahir
Messages: 39
Registered: July 2007
Location: Pakistan
Member
Yes its a form level trigger. I am using it on when_new_form_instance. It is not working according to the requirement. I want that when the user change the system date the form should exit.
============================================================================
create table check_passcode
(pass_id  varchar2(10),
pass_date date,
pass_flag varchar2(10));
========================================NEW=================================
declare
v_pass_id  Varchar2(10);
v_pass_date  date;
v_pass_flag   varchar2(10);

begin
select pass_date,pass_flag into v_pass_date,v_pass_flag from check_passcode
where pass_id=1;

if v_pass_flag='N'  then
exit_form;

else

if v_pass_date>= sysdate then
	MESSAGE ('SORRRYYYYYYYYYYYYYYYY');
exit_form;
update check_passcode
set pass_flag='N';

else if v_pass_date+10< sysdate then
	message('SORRRRYYYYYYYYYYYYYY');
exit_form;
update check_passcode
set pass_flag='N';
end if;
end if;
end if;

exception
when no_data_found then
insert into check_passcode (pass_id,pass_date,pass_flag)
values('1',sysdate,'y');
end;
Re: database trigger [message #402210 is a reply to message #402196] Fri, 08 May 2009 01:50 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Hm, this trigger might exit the form upon its start-up, but it can't tell whether user has changed system date during this form's "lifetime". I still think that you should research use of a timer.


Thank you for using [code] tags; however, you should learn how to properly format the code so that it is properly indented. It helps a lot; if you are uncertain of how to do that, please, check the OraFAQ Forum Guide (especially its "How to format your post" section).
Re: database trigger [message #402224 is a reply to message #402210] Fri, 08 May 2009 02:24 Go to previous messageGo to next message
majid tahir
Messages: 39
Registered: July 2007
Location: Pakistan
Member
I will try to work on the timer. but I need a trigger that expires the application after certain period of time.
Re: database trigger [message #402859 is a reply to message #402224] Tue, 12 May 2009 19:04 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Search this forum for 'kill session', 'kill form', and 'close form'.

David
Previous Topic: Running form 10g (automatically Close I Explorer)
Next Topic: oracle server issue
Goto Forum:
  


Current Time: Wed Dec 07 06:35:42 CST 2016

Total time taken to generate the page: 0.11976 seconds