79736371

Date: 2025-08-15 11:19:12
Score: 1
Natty:
Report link

Actually I have found the solution - and that is to edit the WHERE clause within the second SELECT statement to allow the variable MaxPriorYear to have a leading colon. Heaven knows why I need this but it seems to be working.

DECLARE 
    MaxPriorYear NUMBER;
    MaxPriorMonth NUMBER;

BEGIN
      MaxPriorYear :=
      (SELECT MAX(FISCAL_YEAR)
       FROM TBL_MAIN);

      MaxPriorMonth :=
      (SELECT MAX(ACCOUNTING_PERIOD) 
       FROM TBL_MAIN 
       WHERE FISCAL_YEAR = :MaxPriorYear);
      
      RETURN MaxPriorMonth;
END;
Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Tommo