UPSERT into table with dynamic table name

前端 未结 3 731
北荒
北荒 2020-12-11 14:27

Any better method to UPSERT into a table, provided :

  • Data upsert at ~1 row/second
  • Table Name is DYNAMIC, generated using ObjectID parameter passed to
3条回答
  •  悲哀的现实
    2020-12-11 14:50

    Firstly, you don't have a WHERE in your UPDATE so it will update every row of the table.

    Secondly, have you used a mixed case table name. If you do a

    CREATE TABLE "testOne" (ID NUMBER);
    

    then the table name will be stored as testOne. But when you do an UPDATE testOne is will be treated as UPDATE TESTONE and you'll get a "no such table" error.

    Avoid using mixed case table names. If you absolutely must, then you'll need to quote them in the dynamic SQL statement

提交回复
热议问题