In this particular case, there's no reason why you should call the sql function for every record in your input stream. Calling a sql function repeatedly would kill your performance.
Define a global variable $fiscal_period_code. Give it a value in a script:
$fiscal_period_code = sql('<Datastore>', 'select fiscal_period_code from...');
And map the BUDGET_TYPE column to $fiscal_period_code.