DEV Community

Judy
Judy

Posted on

1 1 1 1 1

Determine whether to filter again based on the situation in the filtered result set #92

A table in the DB2 database is as follows:

Image description
Now we need to preliminarily filter out records with IDs equal to the specified parameters, and further process them based on whether the ABBREV field in the result set contains "A". If it contains "A", we will further filter out records that only contain "A" and return them; When 'A' is not included, return the preliminary filtering result directly.

For example, when the parameter is equal to 1, it should return:

Image description

When the parameter is equal to 2, return:

Image description

When the parameter is equal to 3, return:

Image description

SPL code:

Image description

A1: Use JDBC to query the database and preliminarily filter out records with IDs equal to the specified parameter.

A2: Further filter records with ABBREV equal to "A". If the result is an empty set, return A1; If the result is not an empty set, return the result of further filtering.

Open source SPL source address

Free Download

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay