error trapping help [message #162486] |
Fri, 10 March 2006 09:10 |
tanskiee
Messages: 3 Registered: March 2006 Location: Manila
|
Junior Member |
|
|
guys can you help me where should i put an message box or alert box, if the input is wrong or no found entry..
i cant figure it out..
last question can you tell me how to put an alert box
tsk tsk.. tnx advance
declare
x number;
begin
select count (*) into x from student_t where student_t.student_id= :xstudent_id;
if x > 0 then
select student_t.first_name,student_t.last_name,student_t.course
into :xfirst_name, :xlast_name, :xcourse from student_t where student_id= :xstudent_id;
end if;
end;
|
|
|
Re: error trapping help [message #162495 is a reply to message #162486] |
Fri, 10 March 2006 10:04 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
I'd say: drop the if. You are querying the same table twice.
DECLARE
v_return PLS_INTEGER;
BEGIN
SELECT s.first_name
, s.last_name
, s.course
INTO :yourblock.xfirst_name
, :yourblock.xlast_name
, :yourblock.xcourse
FROM student_t
WHERE student_id= :xstudent_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_return := SHOW_ALERT(youralert);
END;
Create an alert youralert with one button explaining to the end user that the student was not found.
MHE
|
|
|