Subject | Re: [firebird-support] SUBSTRING returning BLOB in FB2.5 |
---|---|
Author | gordon@gniessen.com |
Post date | 2011-05-23T15:16:14Z |
Quoting gordon@...:
1.5 and 2.5. I seemed to be getting an issue in 1.5 with the cast,
but I must have had a syntax error in the cut and paste. I found that
casting the substring results works.
CASE WHEN (LC.NEW_VALUE_BLOB IS NULL) THEN LC.NEW_VALUE ELSE
CAST(SUBSTRING(LC.NEW_VALUE_BLOB FROM 1 FOR 40)||'...' as VARCHAR(40))
END AS NEW_VALUE,
Thanks
Gordon
> I have a query that uses a case statement to return either a varcharJust to clarify, I was looking for a syntax that will work for both FB
> field or a substring of a BLOB, depending on if the blob is null. And
> in FB 1.5 this returned a varchar. But when testing on an upgraded
> version using FB 2.5 I am getting a BLOB field type for the column.
> Is there anyway to avoid this?
>
> SELECT
> CASE WHEN (LC.OLD_VALUE_BLOB IS NULL) THEN LC.OLD_VALUE ELSE
> SUBSTRING(LC.OLD_VALUE_BLOB FROM 1 FOR 40)||'...' END AS OLD_VALUE,
> CASE WHEN (LC.NEW_VALUE_BLOB IS NULL) THEN LC.NEW_VALUE ELSE
> SUBSTRING(LC.NEW_VALUE_BLOB FROM 1 FOR 40)||'...' END AS NEW_VALUE,
> FROM LOG_COLUMN LC;
>
>
> Thanks
> Gordon
>
1.5 and 2.5. I seemed to be getting an issue in 1.5 with the cast,
but I must have had a syntax error in the cut and paste. I found that
casting the substring results works.
CASE WHEN (LC.NEW_VALUE_BLOB IS NULL) THEN LC.NEW_VALUE ELSE
CAST(SUBSTRING(LC.NEW_VALUE_BLOB FROM 1 FOR 40)||'...' as VARCHAR(40))
END AS NEW_VALUE,
Thanks
Gordon