Friday, May 15, 2009

Multiple Validations



for each button


Up Date Button2


Up Date Button1
#########################


************** CREATE ************
declare
icount number;
inum number;
begin
select count (SVR_EQUIPMENT.serial_number) into icount from SVR_EQUIPMENT
where serial_number = :p2_serial_number;
if
icount >0 then return 'Duplicate Number';
elsif
:p2_serial_number is null then return 'Serial Number cannot be Null';
end if;
inum:= to_number(:p2_serial_number);
exception
when others then return 'Must be numeric';
end;

************** UPDATE ************
declare
icount number;
inum number;
begin
select count (SVR_EQUIPMENT.serial_number) into icount from SVR_EQUIPMENT
where serial_number = :p2_serial_number
and equipment_id <> :p2_equipment_id;
if
icount >0 then return 'Duplicate Number';
elsif
:p2_serial_number is null then return 'Serial Number cannot be Null';
end if;
inum:= to_number(:p2_serial_number);
exception
when others then return 'Must be numeric';
end;
#######################

Before Modified

Informative

No comments:

Post a Comment