Home » Developer & Programmer » Forms » Creating alert (Oracle 10.2.0.1.0,forms 10g)
Creating alert [message #588593] Wed, 26 June 2013 14:45 Go to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,

I want to raise a alert after the records retrieved from a query. i.e, if the query fetches 0 records then the alert show be displayed. Is is possible? If yes please tell me the trigger to be used to raise such kind of alert.

Thanks In Advance.


Regards,

Jay. Smile

[Updated on: Wed, 26 June 2013 14:46]

Report message to a moderator

Re: Creating alert [message #588594 is a reply to message #588593] Wed, 26 June 2013 14:49 Go to previous messageGo to next message
Littlefoot
Messages: 19345
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Which "query" are you talking about? Is it a SELECT statement you used somewhere in a form, or is it the "execute query" form feature?
Re: Creating alert [message #588595 is a reply to message #588594] Wed, 26 June 2013 14:51 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Mr Little Foot,

Its execute query from feature.
Thanks in advance.

Regards,

Jayanth.

[Updated on: Wed, 26 June 2013 14:52]

Report message to a moderator

Re: Creating alert [message #588596 is a reply to message #588595] Wed, 26 June 2013 14:55 Go to previous messageGo to next message
Littlefoot
Messages: 19345
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Forms here so I can't test it, but here's an idea: use POST-QUERY trigger and see whether such a code works:
if sql%notfound then  --> that would mean that "execute query" returned nothing
  <alert goes here>
end if;
Re: Creating alert [message #588619 is a reply to message #588596] Thu, 27 June 2013 02:03 Go to previous message
Littlefoot
Messages: 19345
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Now I have Forms so I tried it and ... well, I was wrong. I didn't manage to utilize SQL%NOTFOUND and POST-QUERY doesn't even fire in such cases.

I created a form based on Scott's DEPT table which contains departments 10, 20, 30, 40. Performing query for DEPTNO = 50 returns nothing, i.e. Forms returns "FRM-40301: Query caused no records to be retrieved. Re-enter."

Option that does work includes ON-MESSAGE (block level) trigger. The simplest alert-style solution includes two consecutive MESSAGE calls:
if message_code = 40301 then
   message('This is my own message: Query did not return any records');
   message('This is my own message: Query did not return any records');
end if;

The result is:

./fa/10928/0/
  • Attachment: frm_40301.JPG
    (Size: 21.14KB, Downloaded 126 times)
Previous Topic: How to find table names for the fields in a Horizonatl Form of ASCP [merged 2 by jd]
Next Topic: FRM-40654 on some rows only ???
Goto Forum:
  


Current Time: Thu Jul 31 17:21:33 CDT 2014

Total time taken to generate the page: 0.08715 seconds