Q:

Fetching fields with specific criteria - Oracle

I am trying to extract particular data from 2 tables based on specific criteria. But the result is not as expected. Can someone please help?
Criteria:
Need to fetch id pairs whose type is A alone.
Tables:
Table A
ID1                 ID2
579643307310619501   644543316683180704
296151129721950503   328945291791563504

Table B
ID                 TYPE
579643307310619501   A
579643307310619501   B
579643307310619501   C
644543316683180704   A
296151129721950503   A
328945291791563504   A

Expected Result:
ID1                 ID2
296151129721950503  328945291791563504

(Since only this pair is of type A alone, individually)
Note: The IDs, ID1 and ID2 both must be present in ID field of Table B.
What I've tried:
SELECT  id1, id2 
FROM  A
JOIN  B ON A.id1 = B.id
WHERE A.id1 IN (SELECT id FROM B)
  AND A.id2 IN  (SELECT id FROM B)
  AND B.type='A'
GROUP BY id1, id2
HAVING count(*)=1;

A:

In the approach below, I use a CTE to first identify all ID values having exclusively the 'A' type.  Then I join TableA to this CTE, twice, to filter off any records either of whose ID1 or ID2 values are not in the exclusively 'A' type list.
WITH cte (ID) AS (
    SELECT ID
    FROM TableB
    GROUP BY ID
    HAVING SUM(CASE WHEN TYPE <> 'A' THEN 1 ELSE 0 END) = 0
)

SELECT a.ID1, a.ID2
FROM TableA a
INNER JOIN cte t1
    ON a.ID1 = t1.ID
INNER JOIN cte t2
    ON a.ID2 = t2.ID;

Find below a working demo (for SQL Server - I can't get Oracle to work anywhere).
Demo

