Another way is creating a volatile table and refering to that table within the rest of the code.
CREATE VOLATILE TABLE VAR AS ( SELECT '2011/01/01' AS STARTDATE , '2011/01/31' AS ENDDATE ) WITH DATA PRIMARY INDEX (STARTDATE, ENDDATE) ON COMMIT PRESERVE ROWS;
SELECT * FROM MY_DB.MY_TABLE WHERE MY_DATE BETWEEN VAR.STARTDATE AND VAR.ENDDATE;
The advantage of this is you can refer to those variables from any bit of code within the session, however you need to be careful you aren't using multiple bits of code in multiple windows that have common variable names (such as startdate and enddate) but with different values.
The same does NOT work with Common Table Expressions.