Subject Using variables in ESQL select statement
We have tables and fields in a database which we need to create audit logs for (any changes to fields require the audit table to be written to).

However, we do not want to create specific trigger statements for each table. Rather we want to get a list of the fields in the table from the db schema and then query the fields OLD and NEW parameters before writing the updated (or insert or delete).

We can get the field names, however we can't prepend NEW. and OLD. to the field names and then test. We only want to write changed fields to the audit log, not every field. We also don't want to have to change specific statements each time a change is made to the DB structure (hence getting the field names from the schema each time).

Any idea how we can achieve this?