En mulighed er at bruge en WITH
klausul for at tildele dine parametre til en dummy-tabel.
WITH tmp_parms AS (
SELECT ? as fr_dt, ? as to_dt, ? as p_comp_code,
? as fr_cat, ? as to_cat, ? as p_sub_code
FROM dual
)
SELECT C.COMP_CODE,C.MATCODE, ... etc
FROM tmp_parms tp,
(
SELECT A.COMP_CODE,A.MATCODE, ... etc
Eller hvis du foretrækker endnu en integreret visning:
SELECT C.COMP_CODE,C.MATCODE, ... etc
FROM (
SELECT ? as fr_dt, ? as to_dt, ? as p_comp_code,
? as fr_cat, ? as to_cat, ? as p_sub_code
FROM dual
) tp,
(
SELECT A.COMP_CODE,A.MATCODE, ... etc
Og erstat derefter alle eksisterende bindevariabler med referencer til den tilsvarende kolonne fra den midlertidige parms-tabel, dvs. skift dette:
b.grn_date<=:TO_DT)
til dette:
b.grn_date<=tp.to_dt)