Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » SQL select with 2 Lists as Parameters
SQL select with 2 Lists as Parameters [message #1821451] Thu, 13 February 2020 09:47 Go to next message
Luis Nothvogel is currently offline Luis NothvogelFriend
Messages: 56
Registered: October 2019
Member
Hello,

Today i noticed a weird behaviour. I have a select.into which i give several paramerters, including 2 Lists of different sizes. When i execute it, it only selects into for the exact amount of the smallest list.

Example:

List A (31, 33, 35)
List B (3)

SELECT STUFF FROM STUFF WHERE somethingAId IN (:{a}) AND somethingBId IN (:{b})


Now when i start the Select.Into Query it will only Select for the ID 3 in List B and 31 ID in List A but will ignore the rest of List A.
The Workaround for me was that ill add elements to the smaller List to match the size of the larger List.

Do you have any Ideas how to solve this without my Workaround?

Thank you all,
Luis
Re: SQL select with 2 Lists as Parameters [message #1821467 is a reply to message #1821451] Thu, 13 February 2020 12:57 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Hi Louis,

I found this old thread here. The response from Jeremie shows some examples how to use SQL statements with the "IN" operator (e.g. Statement 4):

https://www.eclipse.org/forums/index.php?t=msg&th=1076250&goto=1728723&#msg_1728723

Hope that helps,
André


Eclipse Scout Homepage | Documentation | GitHub
Re: SQL select with 2 Lists as Parameters [message #1821682 is a reply to message #1821467] Tue, 18 February 2020 15:32 Go to previous messageGo to next message
Luis Nothvogel is currently offline Luis NothvogelFriend
Messages: 56
Registered: October 2019
Member
Thank you for your answer.
The last part of the post you linked might be a hint:

Quote:
Input Binds:
(...) :{name} is a batch value. For every value in the array the statement is executed once.


But in my case I have 2 lists of different sizes, which are filled dynamically.
Sadly, i still havent found an answer to this.
Re: SQL select with 2 Lists as Parameters [message #1821724 is a reply to message #1821682] Wed, 19 February 2020 07:49 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Your syntax is wrong, as you can see in Jeremie's example for Statement 4 and 5. You don't have to write the IN operator in your statement and you must not use the curly braces syntax.

Instead of:
... WHERE somethingAId IN (:{a}) AND somethingBId IN (:{b})

Use:
... WHERE somethingAId = :a AND somethingBId = :b

The StatementProcessor transforms this into a statement with an IN operator.


Eclipse Scout Homepage | Documentation | GitHub
Re: SQL select with 2 Lists as Parameters [message #1821802 is a reply to message #1821682] Thu, 20 February 2020 11:16 Go to previous messageGo to next message
Luis Nothvogel is currently offline Luis NothvogelFriend
Messages: 56
Registered: October 2019
Member
Thank you very much. That did the trick.
Sorry for being the stupid idiot that didnt read the full post and just skimmed through.

Re: SQL select with 2 Lists as Parameters [message #1821951 is a reply to message #1821802] Mon, 24 February 2020 12:17 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
No worries ;-) I'm glad I could help,
André


Eclipse Scout Homepage | Documentation | GitHub
Previous Topic:Session timeout issues
Next Topic:Eclipse Scout 10 JS Project Generation
Goto Forum:
  


Current Time: Thu Apr 25 09:39:16 GMT 2024

Powered by FUDForum. Page generated in 0.02464 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top