I have two tables A and B, for example
A
The <number> 1 </number> is cat
The <number> 2 </number> is dog
The <number> 3 </number> is horse
The <number> 4 </number> is chicken
The <number> 5 </number> is hippo
'''
B
<id>2</id>
<id>4</id>
<id>1</id>
I want to cross check the values from B (numbers only) with all values from table A and have the result:
is dog
is chicken
is cat
I do this in "where" query's section like this (just an example):
where (REGEXP_INSTR ((DBMS_LOB.SUBSTR(regexp_substr(A, '<number>(.**?)(\s)'))) , (DBMS_LOB.SUBSTR((select regexp_substr(B, '<id>(.*?)</id>.*',1,1,null,1) from B
FETCH NEXT 1 ROWS ONLY ))))>0;
My problem is with "FETCH NEXT 1 ROWS ONLY" returns only one row and without that I receive the error "ORA-01427: single-row subquery returns more than one row" (logic). How can I compare all numbers from B with all rows from A and receive the 3 results?
Thank you very much
UPDATE 19/10
Below more accurate info.
select col1
from
(select regexp_substr(B.E, '<InternalId>(.**?)(\s)') as col1, (select regexp_substr(table_D.data1, '<InternalId>(.*?)</InternalId>.*',1,1,null,1) from table_F D) as col2
from table_C B
where table_B.E like 'xxxxx')
where REGEXP_INSTR ((DBMS_LOB.SUBSTR(col1)) , (DBMS_LOB.SUBSTR(col2)))>0;
table_D.data1 is like that:
<?xml version="1.0"?>
<FVDeliveryAdvice>
<Header>
<InternalId>2</InternalId>
<Datatype>200</Datatype>
</Header>
<Item>
<Subitem>
</Subitem>
</Item>
</FVDeliveryAdvice>
and
B.E like that
----- PL/SQL Error Message -----
<InternalId>2</InternalId>ORA-20104: ALR not found: '0007000-00801000001'
<Status>
<Header
<InternalId>2</InternalId>
<Datatype>200</Datatype>
</Header>
<StatusInfo>
</StatusInfo>
</Status>
----- PL/SQL Error Stack -----
ORA-20104: ALR not found:'0007000-00801000001'
----- PL/SQL Call Stack -----
object line object
handle number name
00007FF9AF947390 1 anonymous block
result
ORA-01427: single-row subquery returns more than one row
Result I want:
<InternalId>2</InternalId>ORA-20104: ALR not found: '0007000-00801000001'
but for all rows
The rows from all tables as too many thousands