Subject | Re: [firebird-support] Substring and negative numbers |
---|---|
Author | Helen Borrie |
Post date | 2016-09-05T19:58:58Z |
Hello Jeremy,
Tuesday, September 6, 2016, 3:55:52 AM, you wrote:
error message in text.
error messages anyway...
in vecusts. Any that have NULL or an empty string or a length shorter
than 3 characters in the addr_5 column are going to fail one way or
another in the expression. You need to cover those situations.
Also, the parser or your query tool might want another set of brackets
around the value expression, viz.
SELECT left(c.addr_5, (CHAR_LENGTH(c.addr_5)-3)) as trimmed
FROM vecusts c
Helen
Tuesday, September 6, 2016, 3:55:52 AM, you wrote:
> This simple query:The list can't take attachments or embeds so you need to copy the
> SELECT left(c.addr_5, CHAR_LENGTH(c.addr_5)-3) as trimmed
> FROM vecusts c
>
> Produces this error
error message in text.
>So you are using some GUI tool. Some of them re-interpret Firebird's
> Pressing OK I then get correct values in the trimmed column.
error messages anyway...
> Can anyone assist or tell me what I am doing wrong?Remember that your SELECT statement is going to read all of the rows
in vecusts. Any that have NULL or an empty string or a length shorter
than 3 characters in the addr_5 column are going to fail one way or
another in the expression. You need to cover those situations.
Also, the parser or your query tool might want another set of brackets
around the value expression, viz.
SELECT left(c.addr_5, (CHAR_LENGTH(c.addr_5)-3)) as trimmed
FROM vecusts c
Helen