以前也碰到ORA-28132: Merge into syntax does not support security policies 这个错误,原因是相关的表上定义了一些VPD的policy (可以查user_policies), 解决方法要么去掉这些policy,要么将Merge改成普通的insert/update语句。
但是今天发现同样的语句在11.2.0.2是不报错,但是在11.2.0.1上报错。查了下,原来在11.2.0.2这个问题被Oracle解决了!
http://docs.oracle.com/cd/E11882_01/server.112/e10592/statements_9016.htm
Note:
In previous releases of Oracle Database, when you created an Oracle Virtual Private Database policy on an application that included the MERGE
INTO
statement, the MERGE
INTO
statement would be prevented with an ORA-28132: Merge into syntax does not support security policies
error, due to the presence of the Virtual Private Database policy. Beginning with Oracle Database 11g Release 2 (11.2.0.2), you can create policies on applications that include MERGE
INTO
operations. To do so, in theDBMS_RLS
.ADD_POLICY
statement_types
parameter, include the INSERT
, UPDATE
, and DELETE
statements, or just omit the statement_types
parameter altogether. Refer to Oracle Database Security Guide for more information on enforcing policies on specific SQL statement types.