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

IllegalStateException: One or more parameters are not set on reusing named parameter multiple times #9

Closed
mp911de opened this issue Mar 15, 2021 · 1 comment · Fixed by #12
Assignees

Comments

@mp911de
Copy link

mp911de commented Mar 15, 2021

It seems that using a named parameter multiple times isn't working properly.

Consider the following statement:

SELECT id, name, manual FROM legoset WHERE name = :P0_name or name = :P0_name

Trying to run the statement with:

Mono.from(connectionFactory.create())
		.flatMapMany(it -> {

	return it.createStatement("SELECT id, name, manual FROM legoset WHERE name = :P0_name or name = :P0_name")
		.bind("P0_name", "unknown")
		.execute();
	}).flatMap(it -> it.map((row, rowMetadata) -> row.get(0))).blockLast();

fails with:

java.lang.IllegalStateException: One or more parameters are not set

	at oracle.r2dbc.impl.OracleStatementImpl.requireAllParametersSet(OracleStatementImpl.java:790)
	at oracle.r2dbc.impl.OracleStatementImpl.add(OracleStatementImpl.java:341)
	at oracle.r2dbc.impl.OracleStatementImpl.execute(OracleStatementImpl.java:458)

Running the statement as SELECT id, name, manual FROM legoset WHERE name = :P0_name works fine.

@Michael-A-McMahon
Copy link
Member

@mp911de: Thanks for finding this.
I'll see about fixing this, such that setting a bind value by name will set a value for all parameters that match the specified name; The current implementation just sets a value for the first occurrence of a parameter with a matching name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants