Unix Technical Forum

LOCATE function bug?

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 ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 11:27 AM
4.spam@mail.ru
 
Posts: n/a
Default LOCATE function bug?

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?

Sincerely,
Mark B.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 11:27 AM
Knut Stolze
 
Posts: n/a
Default Re: LOCATE function bug?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 11:27 AM
4.spam@mail.ru
 
Posts: n/a
Default Re: LOCATE function bug?

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.
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 11:28 AM
Knut Stolze
 
Posts: n/a
Default Re: LOCATE function bug?

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:37 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com