db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleksandr Alesinskyy (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-1949) locate function returns invalid value when first parameter is empty string
Date Wed, 28 Mar 2007 11:24:32 GMT

    [ https://issues.apache.org/jira/browse/DERBY-1949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484820
] 

Oleksandr Alesinskyy commented on DERBY-1949:
---------------------------------------------

Yes, I definitely had misread the documentation. While it is not perfect I have to admit that
by really careful reading it is possible to understand what is what. The misleading is usage
of "search string" term. Usually, it designates a string which is searched inside of other
string and in current documentation it is used in opposite sense.

Concerning behavior - as soon as argument meaning is clear, behavior is perfect and need not
be changed.

IJ Version 10.2
ij> connect 'd:/work/lms';
ij> values locate(
'1','');
1
-----------
0

1 Zeile ausgewõhlt
ij> values locate('!','"';
FEHLER 42X01: Syntaxfehler: Encountered "<EOF>" at line 1, column 21.
ij> values locate('!','"');
1
-----------
0

1 Zeile ausgewõhlt
ij> values locate('','');
1
-----------
1

1 Zeile ausgewõhlt
ij> values locate('','',2);
1
-----------
2

1 Zeile ausgewõhlt

ij> values locate('','',2);
1
-----------
2

1 Zeile ausgewõhlt
ij> values locate('1','');
1
-----------
0

1 Zeile ausgewõhlt
ij> values locate('1','',2);
1
-----------
0

1 Zeile ausgewõhlt

Concerning parameters order - it is the same as by DB2 and differs from SyBase and Oracle
does not support LOCATE at all (INSTR is used instead). In my opinion, it is better to keep
the current order.

Proposed documentation change is better then current documentation but still not sompletely
clear.

I guess, something like to 
"First CharacterExpression is a string to search for.
Sexond CharacterExpression is a string to search in.
...
if first argument is an empty string then value of third argument is returned (or 1 if it
is not specified) even if the 2nd argument is an empty string.
If any of arguments has null value then result is null."


Regards,
Oleksandr



> locate function returns invalid value when first parameter is empty string
> --------------------------------------------------------------------------
>
>                 Key: DERBY-1949
>                 URL: https://issues.apache.org/jira/browse/DERBY-1949
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.1.3.1, 10.2.1.6
>         Environment: N/A
>            Reporter: Oleksandr Alesinskyy
>         Assigned To: Bryan Pendleton
>         Attachments: docs.diff, rrefsqlj61998.html
>
>
> locate function returns false invalid when first parameter is empty string,
> e.g. 
> values(locate('','A')
> results in 1, which is obviously wrong

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message