acarlo

String literals as part of SQL query

Discussion created by acarlo on Nov 20, 2012
Latest reply on Nov 20, 2012 by michaelh

Just getting started with PI and PI JDBC. Trying to retrieve tags that end in a specific string literal "XX_YY______ZZ" where the location and number of underscores is required.

 

syntax:

 

stmt = con.prepareStatement("SELECT tag, userint1 FROM pisnapshot WHERE tag like '%XX_YY_____ZZ'");

 

When executed this returns values like

 

foo_XX_YY______ZZ

 

foo_XX_YY_AA___ZZ

 

foo_XX_YY_BB___ZZ

 

foo_XX_YY_CC___ZZ

 

In the dataset above, ONLY the first record is the desired output. I've tried playing with Support PI Wildcards = False without success.

 

Any suggestions?

 


TIA

Outcomes