I have had problems passing a space/blank in a value. When special characters (like &) and blank are passed, I think they are internally converted because the URL is invalid otherwise. What I've sometimes seen is a blank comes thru as %20 and then my = ' ' test fails. Can you try changing '1 Year' to '1_Year' just as a test to see if blank is the problem? (See here but there may be better ways to do this now: https://forums.oracle.com/thread/2297213.)
Also this reference speaks of a problem passing a comma and about debugging: https://forums.oracle.com/thread/2304332
There a suggestion about this type of problem here at askTom -- but because it's a comprehensive solution, it seems like a lot of effort: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:10444643777538
If the blank is the problem, can you remove it and just pass '1Year' or '1' and put the space back when you need it?
The code does not seem right to me
apex_util.prepare_url('f?p=&APP_ID.:000:'||:APP_SESSION||':::000:P000_STATUS,P000_DATE:'||ccodes.code,'1 Year' ) as url
Should be amended like this;
apex_util.prepare_url('f?p=&APP_ID.:000:' || :APP_SESSION || ':::000:P000_STATUS,P000_DATE:' || ccodes.code || ',1 Year' ) as url