Home » Developer & Programmer » Forms » check problem
check problem [message #84685] Fri, 16 April 2004 23:27 Go to next message
lotus
Messages: 10
Registered: March 2004
Junior Member
hi

i have a customer table with the ic_no as the primary key. i've create a customer form of the table. i've also create a check button to check whether the specific customer's ic_no exists in the database or not. the coding i've used is

BEGIN
 IF :customer.ic_no = :customer.IC_NO THEN
      MESSAGE('CUSTOMER OLEDI EXIST');
  ELSE
    MESSAGE('NO RECORD');
 END IF;
 END;

 

the field name in the databse is ic_no and the field name at the form is also ic_no. but when i run whatever number i've put the message shows 'Customer oledi exist'. i know its checkin to itself. but i donno how it can check from the database.

i'm using oracle 8i & forms 6
Re: check problem [message #84689 is a reply to message #84685] Sat, 17 April 2004 10:44 Go to previous messageGo to next message
M. Ibrahim Memon
Messages: 2
Registered: April 2004
Junior Member
Hello,

You are right, you have to amend your code as follow:

Declare
vcustomer_count NUMBER := 0;
Begin
select count(rowid) into vcustomer_count
from <customer_table>
where ic_no = :customer.IC_NO;

if vcustomer_count > 0 then
MESSAGE('CUSTOMER OLEDI EXIST');
else
MESSAGE('NO RECORD');
end if;
End;

Hope this will solve your problem :) :)
Re: check problem [message #84733 is a reply to message #84685] Wed, 21 April 2004 09:29 Go to previous message
ram kumar
Messages: 113
Registered: August 2002
Senior Member
declare
a number;

BEGIN
select count(1) into a from tablename where ic_no=:customer.IC_NO ;
if a>0 then
MESSAGE('CUSTOMER OLEDI EXIST');
ELSE
MESSAGE('NO RECORD');
END IF;
END;
Previous Topic: FRM-40737 ILLEGAL RESTRICTED PROCEDUTRE COMMIT IN PRE-INSERT TRIGGER
Next Topic: how to use bean area control in forms 9i
Goto Forum:
  


Current Time: Mon May 20 17:01:13 CDT 2024