Subject Export data to CSV file from stored procedure?

Hi there,

As subject, is it possible to export a query result set to an external csv file from a Firebird stored procedure? I know this can be done with IBExpert but we are looking for a pure firebird sql solution. We are using Firebrd 2.5.

Any pointers on how to do this will be much appreciated.