Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354589 - Binding LongArrayHolder in SQL NOT IN Clause causes packet errors
Summary: Binding LongArrayHolder in SQL NOT IN Clause causes packet errors
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 04:39 EDT by Oli Schmid CLA
Modified: 2021-08-19 11:13 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oli Schmid CLA 2011-08-12 04:39:43 EDT
When using a LongArrayHolder as bind in SQL.select the SQL service is generating corrupt SQL.

Reproducible: Always

Steps to Reproduce:
Use the following sample code somewhere on a server side service.

LongArrayHolder uids = new LongArrayHolder();

	SQL.selectInto(
		"SELECT 1 FROM DUAL " +
	  "UNION " +
	  "SELECT 2 FROM DUAL " +
	  "INTO :uids "
	  , new NVPair("uids", uids)
	);
	
	SQL.select(
		"SELECT 'works' FROM DUAL " +
		"WHERE 1 NOT IN (:uids) " +
	  , new NVPair("uids", uids)
	);

When having only one or no value in the LongArrayHolder the SQL call works well.

	LongArrayHolder uids = new LongArrayHolder();
	
	SQL.selectInto(
		"SELECT 1 FROM DUAL " +
	  "INTO :uids "
	  , new NVPair("uids", uids)
	);
	
	SQL.select(
		"SELECT 'works' FROM DUAL " +
		"WHERE 1 NOT IN (:uids) " +
	  , new NVPair("uids", uids)
	);
	
Two working workarounds are the use of folloing statments:

	SQL.select(
		"SELECT 'works' FROM DUAL " +
		"WHERE 1 NOT IN :uids " +
	  , new NVPair("uids", uids)
	);
	
or

	SQL.select(
		"SELECT 'works' FROM DUAL " +
		"WHERE 1 <> :uids " +
	  , new NVPair("uids", uids)
	);	

In terms of SQL the two workarounds are syntactically wrong.
Comment 1 Matthias Zimmermann CLA 2017-06-06 05:51:45 EDT
Closed. The bug is over 5 years old and does no longer seem relevant/important enough. In case you do not agree with closing it, reopen the bug and present your case (again), thanks.