0

嘿,我正在尝试将 2 个 Oracle SQL 查询合并为一个。这些查询将在 Pega 中使用。到目前为止,这是我想出的:

WITH 
  Query1 as (DELETE FROM PC WHERE PXNAME = '84461' AND PXCLASS = 'DocQuery'),
  Query2 as (DELETE FROM WORK WHERE PXNAME = '84461' AND PXWORKCLASS = 'DocQuery') 
SELECT * FROM Query1, Query2 WHERE Query1.RecordID = Query2.RecordID;

原来的2个查询是:

Query 1: DELETE FROM PC WHERE PXNAME = {.RecordID in} AND PXCLASS = {.RecordClass in}
Query 2: DELETE FROM WORK WHERE PXNAME = {.RecordID in} AND PXWORKCLASS = {.RecordClass in}

所以当我运行它给我这个错误:

ORA-00928: 缺少 SELECT 关键字

  1. 00000 - “缺少 SELECT 关键字”

*原因:

*行动:

行错误:2 列:14

需要 SQL 大师 :)

4

1 回答 1

0

也许您可以尝试在删除后在第一个表上创建触发器并在其中的第二个表上写入删除。

于 2020-06-11T14:34:04.680 回答