Finally I have found a way to get values inside fields without actually modifying the underlying database.
Here is a sample code that I am using.
WHEN expiresdate_new < NOW() THEN 'Expired'
WHEN status_current = 'Active' AND expiresdate_new < NOW() + INTERVAL '21 days' THEN 'Expiring Soon'
END AS updated_status
This query checks the date of a field and based on various conditions updates another field value. Theoriginal query is very big and complex I am just sharing a simplified version so that it is easy to understand.
Hope this will help someone.
Once again @gabriel thanks for your timely help.