Posted: Mon Oct 16, 2006 9:51 pm Post subject: esql - Overlay
Novice
Joined: 03 Jan 2005 Posts: 19 Location: Melbourne, Australia
Hi,
Please have a look at the following esql code:
declare V1 char '0123456789';
declare pad_V1 char '00000';
set V1 = overlay(pad_V1 placing V1 from 1 for 5);
from this I expected the result to be V1 = '01234', however the result is V1 = '0123456789'. If this is not a bug of some sorts, then can someone please explain the purpose of the "...for 5" clause since in this case it does not seem to have any effect?
(If I change the initial value of V1 to e.g. '012' then it correctly results in V1 = '00012') _________________ Regards
Andre
IBM Certified System Administrator -- WMQ V5.3
IBM Certified Solution Designer -- WBIMB V5
I think Overlay is working as it is supposed to...
This is from the esql.pdf
Quote:
For example:
OVERLAY (’ABCDEFGHIJ’ PLACING ’1234’ FROM 4 FOR 3)
returns the string ’ABC1234GHIJ’
If you notice the FROM was from position 4(D in source) FOR 3(F in source)...in other words only three alphabets DEF were replaced...BUT replaced by four numbers....i.e FOR 3 stands for the length in the source...
I hope you got the concept.
I think you require a substring and not an overlay.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum