Validation error on numeric field
1002449Apr 11 2013 — edited Apr 11 2013Hi, I am very new to Oracle Database and have only recently started learning SQL, PL/SQL and Apex.
I have created a very simple stock control application with a report that lists the quantity of parts in locations with a button on each row that allows the user to "Take Out" a quantity of that part from the location. When you click this button a new form is displayed (showing as read-only fields) the information of the selected part loaded from the database including the "Current Quantity" and a new number field "Take Out Quantity" which is the only field the user can edit.
I have added some simple validation to prevent the user from entering a "Take Out Quantity" that is greater than the "Current Quantity" (which would in the real world be impossible as you cannot have a negative quantity of an item). My code is as follows:
if :P11_TOQUANTITY > :P11_CURRQTY then
return false;
else
return true;
end if;
however I get some very strange results in that it appears to only validate against the first digit of the current quantity. e.g.
Current Quantity = 54
New Quantity = 6 Returns an error
but
Current Quantity = 54
New Quantity = 5 is ok
In fact I can enter any number <= 5 but cannot enter number greater than 5 but I should be able to enter any number <= 54
Can any one suggest what I might be doing wrong?
Thanks
Richard