var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: LIKE operator with CONCAT
DB2 version 220.127.116.11 in Win XP.
I'm trying to use the LIKE operator and the CONCAT operator in the same sentence. Although it works fine when concatenating two strings, it fails when concatenating a VARCHAR column and a string.
Something like this:
I get the DBA2191E error
MOVIE.TITLE LIKE MOVIE.TITLE2 || 'My beautyful string'
Have any idea?
Thank you in advance.
..:: Carlos ::..
see if the content of this thread is of any help
Visit the new-look
, register to gain access to the excellent content.
well, test this:
with temp1 as (
MOVIE.TITLE LIKE MOVIE.TITLE2 || 'My beautyful string' newField
on temp.id = movie.id
MOVIE.TITLE LIKE temp1.newField
LIKE operators normally use underscores and percent signs on the right hand side. I'm not sure where these are in your query. However you might be looking for something like
where posstr(MOVIE.TITLE, MOVIE.TITLE2 || 'My beautyful string') > 0
Thank you all,
It seems that I cannot make working the solution provided by jacampbell, and the one by achiola is too complicated.
The problem with this kind of queries is that they are dynamically generated, according to some users entry.
What I think I will do is to solve this part of the querie in Java, by using the "startsWith" method.
..:: Carlos ::..
to char and %
try this in the statement you have
...char(MOVIE.TITLE2) || char('My beautyful string')
if you are using the LIKE operand you should also include the %.
...char(MOVIE.TITLE2) || char('My beautyful string%')
Try and let me know...