This is a discussion on LOCATE function bug? within the DB2 forums, part of the Database Server Software category; --> Hello. v8.2.1 Try this (and any 3-d argument): --- select locate('','string',5) from sysibm.sysdummy1; --- Is it a feature or ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| 4.spam@mail.ru wrote: > Hello. > > v8.2.1 > Try this (and any 3-d argument): > --- > select locate('','string',5) from sysibm.sysdummy1; > --- > Is it a feature or a bug? $ db2 "values locate('','string',5)" 1 ----------- 5 1 record(s) selected. This is exactly what I would expect: at position 5 is the first occurrence where an empty string starts. -- Knut Stolze DB2 z/OS Utilities Development IBM Germany |
| |||
| And how about 3-d argument > length(source_string) ? For example, posstr(substr('string', 10), '') returns error, but locate('','string',10) returns 10... > $ db2 "values locate('','string',5)" > > 1 > ----------- > 5 > > 1 record(s) selected. > > This is exactly what I would expect: at position 5 is the first occurrence > where an empty string starts. > |
| ||||
| 4.spam@mail.ru wrote: > And how about 3-d argument > length(source_string) ? > For example, > posstr(substr('string', 10), '') > returns error, but > locate('','string',10) > returns 10... That's inconsistent, indeed... -- Knut Stolze DB2 z/OS Utilities Development IBM Germany |
| Thread Tools | |
| Display Modes | |
|
|