0

Hey all I am trying to combine 2 Oracle SQL queries into one. These queries are to be used in Pega. So far this is what I have come up with:

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;

The original 2 queries are:

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}

And so when I run it gives me this error:

ORA-00928: missing SELECT keyword

  1. 00000 - "missing SELECT keyword"

*Cause:

*Action:

Error at Line: 2 Column: 14

SQL Guru needed :)

StealthRT
  • 10,108
  • 40
  • 183
  • 342

1 Answers1

0

Perhaps you can try creating trigger on 1st table after delete and write delete on second table inside it.

Atif
  • 2,011
  • 9
  • 23