Please find the below code for your reference and modify it.
select (case when order_status =’COMPLETED’ then
‘<a title=”Click here to generate the report” class=”t-Button t-Button–simple t-Button–small t-Button–hot t-Button–stretch” href=”‘||
apex_page.get_url(
p_page => 12,
p_clear_cache => 12,
p_items => ‘P12_ORDER_ID,P12_STATUS’,
p_values => ORDER_ID||’,’||STATUS)||'”>GENERATE REPORT</a>’
else
NULL
end) “REPORT”
from order
‘<a title=”Click here to generate the report” class=”t-Button t-Button–simple t-Button–small t-Button–hot t-Button–stretch” href=”‘||
apex_page.get_url(
p_page => 12,
p_clear_cache => 12,
p_items => ‘P12_ORDER_ID,P12_STATUS’,
p_values => ORDER_ID||’,’||STATUS)||'”>GENERATE REPORT</a>’
else
NULL
end) “REPORT”
from order