DEV Community

Judy
Judy

Posted on

Search for records containing a specified string group in multi fields #eg90

A table in an Oracle database has multiple string fields.

Image description

Now we need to input a parameter that contains multiple strings separated by spaces. We need to find the records in the table that contain all these strings in the fields, or those records where the set of fields is a superset of the parameter. For example, when the parameter argA="street John Doe", the calculation result is as follows:

Image description

SPL code:
Image description

A1: Query the database through JDBC.

A2: Split the parameter into a string set by spaces.

Open source SPL source address

Free Download

A3: Filter out records where the difference between the parameter and the field set is an empty set, which is equivalent to finding records where the set of fields is a superset of the parameter.

Top comments (0)