在SQL或PHP中按摩数据?

I have a macro-enabled Excel spreadsheet. When I click a button, it executes a macro that uses cURL to call a PHP script on a web server, which makes some queries against an Oracle database. The PHP script formats the data into a JSON string, which the Excel macro then picks up in the cURL response. It then uses that data to update the Worksheet.

The reason I'm not using ODBC from Excel is that I can't be guaranteed that the user will have Oracle ODBC installed on their PC. However, the web server obviously does.

Here's the issue. Some of the data from the database must be modified based on certain values of other columns before it gets updated on the Excel sheet. I can do most of this in the SQL statement itself using CASE statements. However, I could also just get the straight data from the database, and do the modifications in PHP. Further, I could even just return the straight data from the PHP to the Excel, and do the modifications in Excel VBA.

I will only have to do most of this massaging for the current version of the data. The customer has told me that future versions of the data will be more pure and won't require these hackish modifications. Unfortunately, the app will have to keep working for this current version of the data, so the hackish code will always be there.