Help on Macro

Database
Ckp
N/A

Help on Macro

I want to create a macro that could accept filter on any column defined by user.

I cannot do this by view as one of the inner query is taking about 7 minutes to execute, so the result takes around 10-12 minutes. I tried to pass user defined store and transaction Id filters and it worked in 40 sec. But the problem is that I cant create multiple macros for each column. So is there a way I can convert the below two queries in a single macro/something else. ?

SEL * FROM rtlsale WHERE trans_dt='2011-01-01' AND((1=0) OR (store_num=123));

SEL * FROM rtlsale WHERE trans_dt='2011-01-01' AND((1=0) OR (trans_id=123456 and store_num=123));

REPLACE MACRO mac (param VARCHAR(1000)) AS

(SEL * FROM rtlsale WHERE trans_dt='2011-01-01'

AND((1=0) OR (:param)););

Tags (1)