0

I have to run a script for a company. I just get the same error every time.

The query:

DELETE FROM WMO
WHERE (clientnr = ****** AND number_message = *****) 

The error:

ORA-01752: cannot delete from view without exactly one key-preserved table

What did I wrong?

Thnx!

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • [ORA-01752](https://docs.oracle.com/cd/B10501_01/server.920/a96525/e1500.htm#1003914): **Cause**: The deleted table either had no key preserved tables, had more than one key-preserved table, or the key-preserved table was an unmerged view or a table from a read-only view. **Action**: Redefine the view or delete it from the underlying base tables. – astentx Jan 27 '22 at 11:16

1 Answers1

1

Database views are in general projection of one or more tables. It is a SELECT statement over one or more tables to be specific. For database engine it is impossible to decide what it should delete and from which table unless the view is constructed from single table.

The best solution is to run DELETE command against tables that are used to construct the view.

Additional information:

ORA-01752: cannot delete from view without exactly one key-preserved table

dropoutcoder
  • 2,627
  • 2
  • 14
  • 32
  • Thanks for answering my questions. Is there a query to find out which tables are hidden behind the table I'm seeing? – Marthyn Jan 27 '22 at 10:56
  • I think you will find answer to that question in other SO post. [Get VIEW ddl using query](https://stackoverflow.com/questions/23515801/get-view-ddl-using-query) – dropoutcoder Jan 27 '22 at 20:52