Subject Re: [firebird-support] Convert varchar argument to an integer array
Author Helen Borrie
At 03:02 AM 31/08/2007, you wrote:
>I have a function which have a varchar argument. Inside this functions
>I need to convert this argument (formatted by "(1,2,3)") to an integer
>array for use the IN operator.
>How can I make this on firebird?

You had best explain how you want to use it. Firebird does not
support writing "functions" in SQL. You *can* write external
functions (also known as user-defined functions, or UDFs) in C, C++,
Pascal or some other C-compatible language. However, a Firebird
ARRAY type is not compatible either with a C vector nor the list that
forms the argument for the IN() operator.

The usual way to achieve what you want is by writing a selectable
stored procedure that takes a varchar input and returns the desired
set. The output set is defined by the RETURNS() clause of the
procedure's declaration.

Your SSP could simply accept your input string and concatenate it
into the desired sentence, before running a FOR EXECUTE STATEMENT
('your sentence'...INTO..<declared output variables> DO SUSPEND
construct. Consult the v.1.5 release notes for detailed syntax of

Heads-up: Use v.2.01 or 1.5.4 for this, not 2.0.2. V.2.0.2 is
probably going to be withdrawn later today, due to a bug it
introduces, that is truncating varchars in EXECUTE STATEMENT. :-(
(See )