A. B
A. B

Reputation: 717

Can a function in mysql return a resultset? If not, what are the possible alternative solutions?

I have a view from which I have to select data between 2 given dates (start date and end date). The problem is that views in mysql can't accept arguments (as far as I know), and I need to return the result to the calling application. In Can I create view with parameter in MySQL? a work around for this by initializing session variable.

My question is: Is it possible to have a function that composes the query from the given arguments and then return the resultset?

Upvotes: 0

Views: 4293

Answers (1)

Stelian Matei
Stelian Matei

Reputation: 11623

You can add a WHERE condition on your SELECT FROM custom_view, just like you with do with regular tables.

Upvotes: 1

Related Questions