Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> PL/SQL Question
I am attempting to create a PL/SQL procedure and I am trying to see if there is a way of accomplishing what I am trying to do without having to write a very long IF THEN ELSE statement.
TABLE A has the following fields ...
code_1 VARCHAR2(1) code_2 VARCHAR2(1)
...
code_7 VARCHAR2(1) amt_1 NUMBER(7,2) amt_2 NUMBER(7,2)
...
amt_7 NUMBER(7,2) TABLE B has the fields like ... cl_fee NUMBER(7,2) gi_fee NUMBER(7,2) fl_fee NUMBER(7,2)
...
zz_fee NUMBER(7,2)
In the code_x fields there can be a value between '1' and '9'. For each record, it can be completely different. Depending on the value in each code_x field, I need to update the fee fields in Table B with the corresponding amount from the amount_x fields in Table A.
For example,
Table A
code_1 = 4 amt_1 = 120.00 code_2 = 1 amt_2 = 175.00 code_3 = 2 amt_3 = 100.00
If '4' corresponds to fl_fee, and '1' corresponds to cl_fee and '2' corresponds to zz_fee then I need to update TABLE B such that
cl_fee = 175.00 fl_fee = 120.00 zz_fee = 100.00
With 7 buckets that can have 9 possible values, I am thinking that I would need 63 different IF conditions to cover all possibilities. Does anyone know if a more efficient way of accomplishing this than to write all those IFs?
TIA David Received on Mon Sep 18 2000 - 12:42:41 CDT
![]() |
![]() |