Select returns users locked or a default value for null rows
Just select the union of the query and the 'none' constant if the original query does not return any row:

with s as (
select case when ((sysdate - timestamp)*24 &lt; 1 and returncode &lt;&gt; 0) then 
(username  || '@' || userhost|| ' ON ' || to_char(timestamp,'DD-MON-YYYY HH24:MI:SS')|| ' FAILED AT ' || action_name || ' BECAUSE ' || returncode || decode(returncode,'28000',':Maximum Login Attempt','1004',':Wrong Connection','1005',':NULL Password','1017',':Wrong Password','1045',':Insufficient Priviledge','0',':Login Accepted',':Unkown Code')) 
else 'none' 
end as "locked users" from sys.dba_audit_session where (sysdate - timestamp)*24 &lt; 1 and returncode &lt;&gt; 0 order by timestamp
)
select 'none' as "locked_users" from dual where not exists (select * from s)
union all
select * from s;