when validate-item [message #419526] |
Sun, 23 August 2009 23:38 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lancee
Messages: 11 Registered: August 2009 Location: Philippines
|
Junior Member |
![lirovan_7%40yahoo.com](/forum/theme/orafaq/images/yahoo.png)
|
|
Hello!
I'm a novice to pl/sql.
can someone help me how to code this:
The user will input either ST/NST, after inputting one of the following, if it will attemp to leave at that item a window will prompt and ask:
If user inputs 'ST':
Is this really undergone ST?
where the window has yes, no and cancel button to choose from.
Is this really undergone NST?
where the window has yes, no and cancel button to choose from.
Given the item is Null, it will prompt
Please input either ST/NST.
____________________________________________________________
My code:
declare
begin
select cpl_dtl from coil_history
if cpl_dtl='st'
then
message('Is this really undergone ST?')
else
message('Is this really undergone NST?')
EXCEPTION
WHEN OTHERS THEN MESSAGE ('Please enter either st/nst')
end;
_____________________________________________________________
Hoping someone can help me.
Thanks!
[Updated on: Sun, 23 August 2009 23:46] Report message to a moderator
|
|
|
|
|
|
Re: when validate-item [message #419964 is a reply to message #419935] |
Wed, 26 August 2009 05:27 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
sharjeelshafqat wrote on Wed, 26 August 2009 10:27 | declare
v_1 varchar2(200);
begin
select cpl_dtl into v_1 from coil_history
if v_1='st' then
message('Is this really undergone ST?')
elsif v_1='nst' then
message('Is this really undergone NST?')
end if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
message('No Value Found');
WHEN TOO_MANY_ROWS THEN
null;
WHEN OTHERS THEN
null;
end;
_______________________________
Thanks
Sr. Oracle Programmer
Sharjeel
|
If you're going to post solutions to problems it would help if you:
a) read the forum guide - especially the bit about formating your posts.
b) paid attention to the requirements - as TonyJaa already pointed out the OP needs to use alerts not messages.
Also - don't use exception when others then null! It's a really bad coding practice.
Anyway this issue is being dealt with in the OPs other thread.
|
|
|
Re: when validate-item [message #420255 is a reply to message #419526] |
Thu, 27 August 2009 20:17 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lancee
Messages: 11 Registered: August 2009 Location: Philippines
|
Junior Member |
![lirovan_7%40yahoo.com](/forum/theme/orafaq/images/yahoo.png)
|
|
I have tried the solution being posted and change the message to alert_pkg.msg. It compiled successfully after I put a ';' at the of select statement, but there is no effect when I enter ST or NST.
DECLARE
v_1 varchar2(200);
BEGIN
SELECT cpl_dtl into v_1 from coil_history;
if v_1='ST' then
Alert_pkg.msg('Is this really undergone ST?');
elsif v_1='NST' then
Alert_pkg.msg('Is this really undergone NST?');
end if;
EXCEPTION
--WHEN NO_DATA_FOUND THEN
--message('No Value Found');
--WHEN TOO_MANY_ROWS THEN
--null;
WHEN OTHERS THEN
null;
END;
Even though, the program does not work, I 'm very thankful for the code, cause somehow I understand the code but could not pinpoint what seems to be wrong. It does not prompt any message at all.
[Updated on: Thu, 27 August 2009 21:32] Report message to a moderator
|
|
|
|
|
|
|
|
Re: when validate-item [message #420292 is a reply to message #419526] |
Fri, 28 August 2009 03:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
lancee
Messages: 11 Registered: August 2009 Location: Philippines
|
Junior Member |
![lirovan_7%40yahoo.com](/forum/theme/orafaq/images/yahoo.png)
|
|
This is the fmb file and the when-validate-item trigger that I just revise.
I get a prompt message when I input either one of them but my problem now, is that I could not save the value I input ST/NST at the cpl_dtl.
Thanks in Advance!
[Updated on: Fri, 28 August 2009 03:57] Report message to a moderator
|
|
|
|
|
|