Subject Re: [firebird-support] Confusing behavior of UDF in stored procedure
Author Helen Borrie
At 05:23 PM 19/06/2007, Matijn wrote:

> > can you change your procedure to this:
> >
> > > CREATE PROCEDURE CreateStringId(val VARCHAR(32765))
> > > RETURNS (id CHAR(16))
> > > AS BEGIN
> > > SELECT varchar_to_guid(:val) FROM RDB$DATABASE INTO :ID;
> > > SUSPEND;
> > > END^
> >
> > I have never used the syntax you have used here - not sure it's legal.
>Yes, it's legal, functions (albeit system or user defined ones) don't
>have to use the SELECT ... FROM RDB$DATABASE.

It's not clear what you mean by this comment, Martijn. SELECT...INTO
<variable> has to be a singleton.

FWIW, I think the reported problem has to do with the fact that the
stored procedure doesn't declare the variable as CHARACTER SET
OCTETS, so it is right-padding id with blanks instead of NULs (ascii
32 instead of ascii zero)..