12-01-2016 10:43 AM
Hi SAS users,
Need help with solving this macro in PROC SQL.
CONNECT TO ORACLE(PATH=XXXX USER=YYYY. ORAPW=ZZZ);
execute (delete from A.&MyTable
where substr(RUN_DT,1,7) = &ANA_RUN_DT (RUN_DT is a charcter field in table)
) by oracle;
disconnect from oracle;
ANA_RUN_DT is 2016-11
ERROR: ORACLE execute error: ORA-01722: invalid number.
I tried putting "&ANA_RUN_DT" and '&ANA_RUN_DT' , but it did not work.
12-01-2016 01:19 PM
I suspect that ORACLE wants you to use single quotes, but SAS will not expand the macro variable reference inside of single quotes.
Try this instead.