Subject Re: [firebird-support] Re: UDF in EXECUTE STATEMENT
Author Martijn Tonies
> > > I've this simple store procedure:
> > >
> > > ....
> > > FOR EXECUTE STATEMENT
> > > 'SELECT
> > > STRLEN(ANA00CDFS)
> > > FROM
> > > ANA00'
> > > INTO
> > > :ANA00CDFS
> > > DO BEGIN
> > > ...
> > >
> > > Firebird (1.5.2 on a debian sarge) goes in error with:
> > >
> > > Variable type (position 0) in EXECUTE STATEMENT 'SELECT
> > > STRLEN(ANA00CDFS) ' INTO does not match return.
> >
> > Sounds like :ANA00CDFS isn't of the same type as what the UDF
> > returns.
> >
> > Martijn Tonies
>
> You are right!!!!. Really the original statement is
>
> '...SELECT SUBSTR(ANA00CDFS, 0, 9).....' INTO :ANA00CDFS
>
> if I declare ANA00CDFS as VARCHAR (any size), the store procedure goes
> in error, if I declare ANA00CDFS as CHAR (any size) is ok. Strange.

Probably because the UDF is declared as CHAR.

You can cast the result to VARCHAR if you like.

Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com