PostgreSQL trigger to generate codes for multiple tables dynamically

后端 未结 2 598
青春惊慌失措
青春惊慌失措 2021-01-03 11:18

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\

2条回答
  •  情话喂你
    2021-01-03 12:09

    NEW is type RECORD, so you can't assign to that AFAIK.

    To set the value of a column, assign to NEW.column, for example:

    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

提交回复
热议问题