View or function '' is not updatable because the modification affects multiple base tables

前端 未结 1 1508
名媛妹妹
名媛妹妹 2021-01-18 11:46

I\'m attempting to create a sql script that should check to see if a row exists. If one doesn\'t exist, I want to create one and if one does exist, I want to update it.

相关标签:
1条回答
  • 2021-01-18 12:33

    g4b_stockcountsummary is a view. Views can be updatable, but only under certain conditions. These are listed in the documentation and they start:

    Updatable Views

    You can modify the data of an underlying base table through a view, as long as the following conditions are true:

    • Any modifications, including UPDATE, INSERT, and DELETE statements, must reference columns from only one base table.

    Hence, you cannot do what you want. You either need to fix the view or update each base table independently.

    I should point out that lad2025 is correct. You can use an instead of trigger on the view to support the update. The documentation is referring to the base update on the view.

    0 讨论(0)
提交回复
热议问题