Subject Re: [firebird-support] Proper Case Function for Firebird 2.5.4 and above
Author Mark Rotteveel
On 2019-07-15 13:49, 'stwizard' stwizard@... [firebird-support]
wrote:
> We are currently on Firebird 2.5.4 and hope to move to Firebird 3.0 by
> the
> end of this year once I determine what all needs to take place in
> preparation to do so.

Why are you still using 2.5.4? The latest 2.5 is 2.5.9. You're missing 4
years of bugfixes and other improvements.

> One of the things we did when moving from Firebird 1.5 to 2.5 was to
> remove
> the dependencies on external UDF's from FreeAdhocUDF since Firebird at
> that
> point contained an internal replacement for most of those that we used.
>
> I have one UDF left to replace F_PROPERCASE(). It appears Firebird 2.5
> nor
> Firebird 3.0 have a replacement internal UDF for this one unless I
> missed
> it.
>
> So we tried to come up with a way of doing this with a few stored
> procedures
> that my associate wrote. They are included below.

Firebird 3 supports stored functions and they are a better solution for
this specific problem than stored procedures.

[..]

> Here are the two stored procedures:
>
[..]
>
> So what was the error?
>
> When extracting the metadata on the production database:
> Procedure SPLITTER: Invalid factor in expression (POSITION)
> Script: Line:11 Pos:20

I don't recognize that as a Firebird error. However, I notice that
you're using the colon parameter prefix in places where they aren't
necessary.

For example:

iNext = position(:in_splitter, in_str, iLast);

can be

iNext = position(in_splitter, in_str, iLast);

and this applies almost everywhere you're prefixing parameters/variables
with `:`. Possibly your tool is using a parser that doesn't expect the
prefix in this position. The only proper place to use those prefixes is
in PSQL DML statements.

Mark