Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case when statement implementation #593

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Ivan-nikitko
Copy link
Contributor

SQLBulder API example


   SelectBuilder builder = new SelectBuilder(column("OrderID"), column("Quantity"),
                caseWhen()
                        .when(column("Quantity").gt(value(30)).and(column("Quantity").lt(value(100))))
                        .then(value("The quantity from 30 to 100"))
                        .when(column("Quantity").eq(value(30)))
                        .then(value("The quantity is 30"))
                        .elseResult(value("The quantity is under 30"))
                        .as("QuantityText"))
                .from(table("OrderDetails"));

Expression API example

Expression caseWhenNoDefault = caseWhen(
                List.of((betweenExp("estimatedPrice", 0, 9)),
                        (betweenExp("estimatedPrice", 10, 20))),
                List.of((wrapScalarValue("firstThenResult")),
                        (wrapScalarValue("secondThenResult")))),
                wrapScalarValue("defaultResult"));

@stariy95 stariy95 self-assigned this Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants