Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'Like' function in update

0 views
Skip to first unread message

* Tong *

unread,
Apr 29, 2001, 5:53:00 PM4/29/01
to
Hi,

Why the following code is not working:

UPDATE ta SET ta.val =
(SELECT val FROM tb
WHERE ta.id like (tb.id || '%' ))

SQL0132N A LIKE predicate or POSSTR scalar function is not valid because the
first operand is not a string expression or the second operand is not a
string. SQLSTATE=42824

If I change the tb.id in the "||" expression to a string, the above
code will work.

You guys have a explanation to defense it this time? :-) Any work
around? Thanks.

--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: http://xpt.sourceforge.net/
http://members.xoom.com/suntong001/
- All free contribution & collection

Serge Rielau

unread,
Apr 29, 2001, 8:26:59 PM4/29/01
to * Tong *
Hi Tong,

LIKE currently doesn't digest non constant expressions.

A work around might be:

LENGTH(ta.id) >= LENGTH(tb.id) AND tb.id = SUBSTR(ta.id, 1, LENGTH(tb.id))

Cheers
Serge

Serge Rielau

unread,
Apr 29, 2001, 8:27:34 PM4/29/01
to
Hi Tong,

LIKE currently doesn't digest non constant expressions.

A work around might be:

LENGTH(ta.id) >= LENGTH(tb.id) AND tb.id = SUBSTR(ta.id, 1, LENGTH(tb.id))

Cheers
Serge

* Tong *

unread,
Apr 29, 2001, 9:10:34 PM4/29/01
to
Serge Rielau <sri...@ca.ibm.com> writes:

> Hi Tong,


>
> A work around might be:

Thanks. Serge

0 new messages