check problem [message #84685] |
Fri, 16 April 2004 23:27 |
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 |
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 |
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;
|
|
|