Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to compare DB rows with line values

SebaVastaAug 29 2024 — edited Aug 29 2024

I have simplified our requirement like this:

Our Forms application has this in one of the forms this hardcoded line:

SELECT 'cow, cat, bird, snake' fl FROM dual; -- fl = fields line

We have a new ref table with the following rows:

SELECT *
FROM
(
select 'cat' ft from dual -- ft = field table
union
select 'cow' from dual
union
select 'dog' from dual
union
select 'snake' from dual
) t1;

What we want to know is whether all hard-coded values in the Form is available in the DB or not.

How to do this using SQL?

In the above example they are not equal. Line has bird which is not in DB, and DB has dog which is not in the line.

It has to be exactly equal.

How do join the above 2 SQLs to output say 0 if there is an exact match and say -1 if they don't match?

PS: The ordering in the line and fields will be different and no value will repeat in both places. DB is 11g R2

This post has been answered by Paulzip on Aug 29 2024
Jump to Answer
Comments
Post Details
Added on Aug 29 2024
5 comments
166 views