Home » Developer & Programmer » Forms » pick single value from range (merged 2) (Forms 6i)
pick single value from range (merged 2) [message #548010] |
Mon, 19 March 2012 09:06 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
i have to pick single value from the given range based on value entered by user, for example if user enter the length 2499 it should be considered as 2000 if he enters 2000 its 2000 or he enters 2501 it will return 2500 , i have written a huge if condition for this purpose in my program which looks very cumbersome,is there a simple to do this other than this method.
the code is as below.
[CODE]
IF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =2000
THEN M_RCVD_LENGTH := 2000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 2001 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 2499 THEN
M_RCVD_LENGTH := 2000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 2500
THEN M_RCVD_LENGTH := 2500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 2501 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 2999 THEN
M_RCVD_LENGTH := 2500;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =3000
THEN M_RCVD_LENGTH := 3000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 3001 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 3499 THEN
M_RCVD_LENGTH := 3000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 3500
THEN M_RCVD_LENGTH := 3500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 3501 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 3999 THEN
M_RCVD_LENGTH := 3500;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =4000
THEN M_RCVD_LENGTH := 4000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 4001 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 4499 THEN
M_RCVD_LENGTH := 4000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 4500
THEN M_RCVD_LENGTH := 4500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 4501 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 4999 THEN
M_RCVD_LENGTH := 4500;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =5000
THEN M_RCVD_LENGTH := 5000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 5001 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 5499 THEN
M_RCVD_LENGTH := 5000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 5500
THEN M_RCVD_LENGTH := 5500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 5501 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 5999 THEN
M_RCVD_LENGTH := 5500;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =6000
THEN M_RCVD_LENGTH := 6000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 6001 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6499 THEN
M_RCVD_LENGTH := 6000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6500
THEN M_RCVD_LENGTH := 6500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 6501 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6999 THEN
M_RCVD_LENGTH := 6500;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =7000
THEN M_RCVD_LENGTH := 7000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 7001 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 7499 THEN
M_RCVD_LENGTH := 7000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 7500
THEN M_RCVD_LENGTH := 7500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) >= 7501 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 7999 THEN
M_RCVD_LENGTH := 7500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 7500 THEN
DISP_ALERT('Setup for Material Cuts is so far not done...');
END IF;
[\CODE]
|
|
|
|
|
Re: pick single value from range [message #548016 is a reply to message #548014] |
Mon, 19 March 2012 09:26 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
thanks michel but user will be entering single value at one time for example there are two fields in form, one given length and actual length,if he enters the given lenght as any data, it will return one value as out parameter in another field.
he will enter 2499 in csdo_length (given_length) , new field csdo_new_length(actual_length) must be automatically populated as 2000.
|
|
|
|
easy function [message #548804 is a reply to message #548010] |
Mon, 26 March 2012 06:32 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
i have a function which returns the value based on value given and there is a range based on which i am returning this value and i need to write this entire code for this purpose , is there a easy way to limit this coding.
[CODE]
FUNCTION L_GET_S_LEN (P_GIVEN_LEN NUMBER) RETURN NUMBER IS
M_RCVD_LENGTH OT_CUTTING_SHEET_DETAIL_OC.CSDO_STORE_RECD_LENGTH%TYPE;
BEGIN
IF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =2000
THEN M_RCVD_LENGTH := 2000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 2001 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 2499 THEN
M_RCVD_LENGTH := 2000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 2500
THEN M_RCVD_LENGTH := 2500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 2501 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 2999 THEN
M_RCVD_LENGTH := 2500;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =3000
THEN M_RCVD_LENGTH := 3000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 3001 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 3499 THEN
M_RCVD_LENGTH := 3000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 3500
THEN M_RCVD_LENGTH := 3500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 3501 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 3999 THEN
M_RCVD_LENGTH := 3500;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =4000
THEN M_RCVD_LENGTH := 4000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 4001 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 4499 THEN
M_RCVD_LENGTH := 4000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 4500
THEN M_RCVD_LENGTH := 4500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 4501 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 4999 THEN
M_RCVD_LENGTH := 4500;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =5000
THEN M_RCVD_LENGTH := 5000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 5001 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 5499 THEN
M_RCVD_LENGTH := 5000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 5500
THEN M_RCVD_LENGTH := 5500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) >= 5501 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 5999 THEN
M_RCVD_LENGTH := 5500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6000
THEN M_RCVD_LENGTH := 6000;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6000 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6099 THEN
M_RCVD_LENGTH := 6000;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6100
THEN M_RCVD_LENGTH := 6100;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6100 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6199 THEN
M_RCVD_LENGTH := 6100;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =6200
THEN M_RCVD_LENGTH := 6200;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6200 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6299 THEN
M_RCVD_LENGTH := 6200;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6300
THEN M_RCVD_LENGTH := 6300;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6300 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6399 THEN
M_RCVD_LENGTH := 6300;
ELSIF ( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) =6400
THEN M_RCVD_LENGTH := 6400;
ELSIF
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6400 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6499 THEN
M_RCVD_LENGTH := 6400;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6500
THEN M_RCVD_LENGTH := 6500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6500 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6599 THEN
M_RCVD_LENGTH := 6500;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6600
THEN M_RCVD_LENGTH := 6600;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6600 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6699 THEN
M_RCVD_LENGTH := 6600;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6700
THEN M_RCVD_LENGTH := 6700;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6700 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6799 THEN
M_RCVD_LENGTH := 6700;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) = 6800
THEN M_RCVD_LENGTH := 6800;
ELSIF (:CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) > 6800 AND
( :CSDO_STORE_RECD_LENGTH - SUBSTR(:CSDO_STORE_RECD_LENGTH,(LENGTH(:CSDO_STORE_RECD_LENGTH)-1),LENGTH(:CSDO_STORE_RECD_LENGTH))) <= 6899 THEN
M_RCVD_LENGTH := 6800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 6900
THEN M_RCVD_LENGTH := 6900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 6900 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 6999 THEN
M_RCVD_LENGTH := 6900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7000
THEN M_RCVD_LENGTH := 7000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7000 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7099 THEN
M_RCVD_LENGTH := 7000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7100
THEN M_RCVD_LENGTH := 7100;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7100 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7199 THEN
M_RCVD_LENGTH := 7100;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =7200
THEN M_RCVD_LENGTH := 7200;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7200 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7299 THEN
M_RCVD_LENGTH := 7200;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7300
THEN M_RCVD_LENGTH := 7300;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7300 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7399 THEN
M_RCVD_LENGTH := 7300;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =7400
THEN M_RCVD_LENGTH := 7400;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7400 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7499 THEN
M_RCVD_LENGTH := 7400;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7500
THEN M_RCVD_LENGTH := 7500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7500 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7599 THEN
M_RCVD_LENGTH := 7500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7600
THEN M_RCVD_LENGTH := 7600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7600 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7699 THEN
M_RCVD_LENGTH := 7600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7700
THEN M_RCVD_LENGTH := 7700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7700 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7799 THEN
M_RCVD_LENGTH := 7700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7800
THEN M_RCVD_LENGTH := 7800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7800 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7899 THEN
M_RCVD_LENGTH := 7800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 7900
THEN M_RCVD_LENGTH := 7900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 7900 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 7999 THEN
M_RCVD_LENGTH := 7900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8000
THEN M_RCVD_LENGTH := 8000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8000 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8099 THEN
M_RCVD_LENGTH := 8000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8100
THEN M_RCVD_LENGTH := 8100;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8100 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8199 THEN
M_RCVD_LENGTH := 8100;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =8200
THEN M_RCVD_LENGTH := 8200;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8200 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8299 THEN
M_RCVD_LENGTH := 8200;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8300
THEN M_RCVD_LENGTH := 8300;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8300 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8399 THEN
M_RCVD_LENGTH := 8300;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =8400
THEN M_RCVD_LENGTH := 8400;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8400 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8499 THEN
M_RCVD_LENGTH := 8400;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8500
THEN M_RCVD_LENGTH := 8500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8500 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8599 THEN
M_RCVD_LENGTH := 8500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8600
THEN M_RCVD_LENGTH := 8600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8600 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8699 THEN
M_RCVD_LENGTH := 8600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8700
THEN M_RCVD_LENGTH := 8700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8700 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8799 THEN
M_RCVD_LENGTH := 8700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8800
THEN M_RCVD_LENGTH := 8800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8800 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8899 THEN
M_RCVD_LENGTH := 8800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 8900
THEN M_RCVD_LENGTH := 8900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 8900 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 8999 THEN
M_RCVD_LENGTH := 8900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9000
THEN M_RCVD_LENGTH := 9000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9000 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9099 THEN
M_RCVD_LENGTH := 9000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9100
THEN M_RCVD_LENGTH := 9100;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9100 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9199 THEN
M_RCVD_LENGTH := 9100;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =9200
THEN M_RCVD_LENGTH := 9200;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9200 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9299 THEN
M_RCVD_LENGTH := 9200;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9300
THEN M_RCVD_LENGTH := 9300;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9300 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9399 THEN
M_RCVD_LENGTH := 9300;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =9400
THEN M_RCVD_LENGTH := 9400;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9400 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9499 THEN
M_RCVD_LENGTH := 9400;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9500
THEN M_RCVD_LENGTH := 9500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9500 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9599 THEN
M_RCVD_LENGTH := 9500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9600
THEN M_RCVD_LENGTH := 9600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9600 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9699 THEN
M_RCVD_LENGTH := 9600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9700
THEN M_RCVD_LENGTH := 9700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9700 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9799 THEN
M_RCVD_LENGTH := 9700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9800
THEN M_RCVD_LENGTH := 9800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9800 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9899 THEN
M_RCVD_LENGTH := 9800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 9900
THEN M_RCVD_LENGTH := 9900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 9900 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 9999 THEN
M_RCVD_LENGTH := 9900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10000
THEN M_RCVD_LENGTH := 10000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10000 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10099 THEN
M_RCVD_LENGTH := 10000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10100
THEN M_RCVD_LENGTH := 10100;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10100 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10199 THEN
M_RCVD_LENGTH := 10100;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =10200
THEN M_RCVD_LENGTH := 10200;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10200 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10299 THEN
M_RCVD_LENGTH := 10200;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10300
THEN M_RCVD_LENGTH := 10300;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10300 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10399 THEN
M_RCVD_LENGTH := 10300;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =10400
THEN M_RCVD_LENGTH := 10400;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10400 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10499 THEN
M_RCVD_LENGTH := 10400;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10500
THEN M_RCVD_LENGTH := 10500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10500 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10599 THEN
M_RCVD_LENGTH := 10500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10600
THEN M_RCVD_LENGTH := 10600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10600 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10699 THEN
M_RCVD_LENGTH := 10600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10700
THEN M_RCVD_LENGTH := 10700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10700 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10799 THEN
M_RCVD_LENGTH := 10700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10800
THEN M_RCVD_LENGTH := 10800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10800 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10899 THEN
M_RCVD_LENGTH := 10800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 10900
THEN M_RCVD_LENGTH := 10900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 10900 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 10999 THEN
M_RCVD_LENGTH := 10900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11000
THEN M_RCVD_LENGTH := 11000;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11000 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11099 THEN
M_RCVD_LENGTH := 11000;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11100
THEN M_RCVD_LENGTH := 11100;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11100 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11199 THEN
M_RCVD_LENGTH := 11100;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =11200
THEN M_RCVD_LENGTH := 11200;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11200 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11299 THEN
M_RCVD_LENGTH := 11200;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11300
THEN M_RCVD_LENGTH := 11300;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11300 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11399 THEN
M_RCVD_LENGTH := 11300;
ELSIF ( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) =11400
THEN M_RCVD_LENGTH := 11400;
ELSIF
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11400 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11499 THEN
M_RCVD_LENGTH := 11400;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11500
THEN M_RCVD_LENGTH := 11500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11500 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11599 THEN
M_RCVD_LENGTH := 11500;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11600
THEN M_RCVD_LENGTH := 11600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11600 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11699 THEN
M_RCVD_LENGTH := 11600;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11700
THEN M_RCVD_LENGTH := 11700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11700 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11799 THEN
M_RCVD_LENGTH := 11700;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11800
THEN M_RCVD_LENGTH := 11800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11800 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11899 THEN
M_RCVD_LENGTH := 11800;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 11900
THEN M_RCVD_LENGTH := 11900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) > 11900 AND
( P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) <= 11999 THEN
M_RCVD_LENGTH := 11900;
ELSIF (P_GIVEN_LEN - SUBSTR(P_GIVEN_LEN,(LENGTH(P_GIVEN_LEN)-1),LENGTH(P_GIVEN_LEN))) = 12000
THEN M_RCVD_LENGTH := 12000;
END IF;
RETURN(M_RCVD_LENGTH);
END;
[CODE\]
|
|
|
Re: easy function [message #548826 is a reply to message #548804] |
Mon, 26 March 2012 08:57 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8944 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Your code looks absurd, you are treating numbers and ranges of number individually. Surely all you need to do is round off the value to within 500? A function that implements this one SELECT should do for any value:
orcl> select round(&n/500)*500 from dual;
Enter value for n: 2000
old 1: select round(&n/500)*500 from dual
new 1: select round(2000/500)*500 from dual
ROUND(2000/500)*500
-------------------
2000
orcl> /
Enter value for n: 2300
old 1: select round(&n/500)*500 from dual
new 1: select round(2300/500)*500 from dual
ROUND(2300/500)*500
-------------------
2500
orcl> /
Enter value for n: 2999
old 1: select round(&n/500)*500 from dual
new 1: select round(2999/500)*500 from dual
ROUND(2999/500)*500
-------------------
3000
orcl>
|
|
|
Re: easy function [message #548877 is a reply to message #548826] |
Mon, 26 March 2012 16:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Michel showed you how to do this a week ago.
Do not create a new topic for the same question (I've now merged the two).
If you don't understand how to apply what we show you, ask.
Do not ignore what we tell you, that's just rude.
And learn to use code tags properly, it's not difficult.
|
|
|
Re: easy function [message #548898 is a reply to message #548877] |
Tue, 27 March 2012 00:39 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
Thanks cookiemonster, i am really sorry for not replying back , yeah michel did reply but i need an example of implementing that sql inside my form .
|
|
|
|
Goto Forum:
Current Time: Fri Sep 06 17:15:05 CDT 2024
|