We are using PB17 and SQLAnywhere 17
We have a generalized routine whereby we can pass a SQL query which takes one argument.
The problem is that some queries need to reference the same argument more than once.
As we understand it - if you use the ? argument placeholder more than once - the system assumes as separate argument associated with each occurrance of the argument - hence the follwing fails
SELECT metadatavalue from propmetadata where metadatatypecd = 'SHORTSYNOPSIS' AND propassetid in (SELECT propassetid from propasset where propno = (left(?, 8) + 'S00') AND langcd = SUBSTRING(?, 16, 3) AND langusecd = SUBSTRING(?, 20, 3))
where the following single parameter reference works
SELECT metadatavalue from propmetadata where metadatatypecd = 'SHORTSYNOPSIS' AND propassetid in (SELECT propassetid from propasset where propno = (left(?, 8) + 'S00')
We tried the following (noted as working in other database implementations) - which also doesnt work.
SELECT metadatavalue from propmetadata where metadatatypecd = 'SHORTSYNOPSIS' AND propassetid in (SELECT propassetid from propasset where propno = (left(?1, 8) + 'S00') AND langcd = SUBSTRING(?1, 16, 3) AND langusecd = SUBSTRING(?1, 20, 3))
Is there any way to do this in a straightforward manner??
Thanks
Glenn Barber