I\'d like to generate codes for many tables in the database, and stopped to refactor my solution when I was ready to write my third implementation of \"get code for table X\
NEW is type RECORD, so you can't assign to that AFAIK.
NEW
RECORD
To set the value of a column, assign to NEW.column, for example:
NEW.column
NEW.tenant_code := (SELECT some_calculation);
Maybe your design is too complicated; PL/SQL is a very limited language - try to make your code as simple as possible