myVar = .NULL. ? NVL(PADL(ALLTRIM(STR(myVar)),5,'0'),'00000') ---> Function argument invalid errorWhen I rewrote it to
? PADL(NVL(myVar,0),5,'0')it worked as expected. Strangely enough, though,
? NVL(PADL(myVar,5,'0'),'00000')also worked since PADL() appears more forgiving than STR()
myVar = .NULL. ? STR(myVar) ---> error ? PADL(myVar,5,'0') ---> .NULL.The actual code I was testing would not have run across this issue since myVar was really myField. I couldn't plug a NULL into the table because the field did not accept nulls. However, a query using an OUTER JOIN could have resulted in nulls and it seemed easier to just use a variable than recrete the whole scenerio. It wasn't easier.......but I did learn something!