Passing Macro Paramaters to a With Clause

Database

Passing Macro Paramaters to a With Clause

I am having trouble with a macro.  I cannot pass paramaters to a WITH statement.  Below is an example.  When I pass a paramater I get an error:

"EXECUTE FAILED [3939] There is a mismatch between the number of paramaters specified and the number of paramaters required"

Is it possible to do this?

REPLACE MACRO MACRO_Test(P_Date Date)

AS

(

WITH qrySub (AccountNumber) AS

(SELECT AccountNumber FROM Tbl_Accounts WHERE Tbl_Accounts.CreatedDate < :P_Date)

SELECT * FROM qrySub

UNION ALL

SELECT * FROM qrySub;

);

1 REPLY
Enthusiast

Re: Passing Macro Paramaters to a With Clause

I login to  bteq thru linux.

I am in 14.10 and it works fine for me.  I executed 

exec macro_test('1992-01-21');

Cheers,