Now, lock_if_possible has side effects. If we understand this to be imperative, then we have no possibility of turning this into a declarative query because we are interested in the side effects. So you cannot say that this is equivalent to the SQL of
SELECT *, lock_if_possible(id)
FROM student
WHERE age < 25
The reason is that while the imperative version represents *one* valid interpretation of the declarative, there are other interpretations of the declarative that are not at all equivalent. The hoops we have to jump through to make this work in an imperative way in SQL are sometimes rather amusing.
Kind Regards,
Jason
--
Best Wishes,
Chris Travers
Efficito: Hosted Accounting and ERP. Robust and Flexible. No vendor lock-in.