Why stored procedure cannot be used with select, where & having Why stored procedure cannot be used with select, where & having oracle oracle

Why stored procedure cannot be used with select, where & having


Biggest reasons most likely is that procedures can return any number of result sets and change data. It can have no results, or it can be 100 different results sets with 0 to n rows. It can also depend on your input parameters. Stored procedure can also affect the underlying data, so what would happen if you would use a stored procedure that changes data in the same table you're using it in the where clause? The results sets don't even necessary have names for the columns, so you couldn't refer them in any way.

So, since for procedures would be really complex to implement anything like that, why should it be possible to use them in where etc? You haven't provided any valid reason why they should.

The reason functions exist, is that you can use them for where clauses etc.