Subject | Dynamic Stored Procedure |
---|---|
Author | Moegamat Alexander |
Post date | 2008-03-05T14:10:52Z |
Hi
Is there a way to streamline this code in that I can "modify the
procedure" to reflect the data that is coming into the procedure.
I have a situation that the SALESTYPE can be of value 1 to 9 and I was
hoping not to repeat the if condition
and the bit of code
select :docsufix+GEN_ID(DOCTYPE1, 1)
from DUAL
into
newdocid;
reflect the doctype value coming in
The lame way would be
if (:SALESTYPE_in = 1) then
begin
if (:custtype_in = 'C' and :cust_in = 'C') then
begin
newdocid = invoice_in;
..
..
end
else
begin
select :docsufix+GEN_ID(DOCTYPE1, 1)
from DUAL
into
newdocid;
end
end
if (:SALESTYPE_in = 2) then
begin
if (:custtype_in = 'C' and :cust_in = 'C') then
begin
newdocid = invoice_in;
..
..
end
else
begin
select :docsufix+GEN_ID(DOCTYPE2, 1)
from DUAL
into
newdocid;
end
end
etc
Many thanx
M
Is there a way to streamline this code in that I can "modify the
procedure" to reflect the data that is coming into the procedure.
I have a situation that the SALESTYPE can be of value 1 to 9 and I was
hoping not to repeat the if condition
and the bit of code
select :docsufix+GEN_ID(DOCTYPE1, 1)
from DUAL
into
newdocid;
reflect the doctype value coming in
The lame way would be
if (:SALESTYPE_in = 1) then
begin
if (:custtype_in = 'C' and :cust_in = 'C') then
begin
newdocid = invoice_in;
..
..
end
else
begin
select :docsufix+GEN_ID(DOCTYPE1, 1)
from DUAL
into
newdocid;
end
end
if (:SALESTYPE_in = 2) then
begin
if (:custtype_in = 'C' and :cust_in = 'C') then
begin
newdocid = invoice_in;
..
..
end
else
begin
select :docsufix+GEN_ID(DOCTYPE2, 1)
from DUAL
into
newdocid;
end
end
etc
Many thanx
M