Subject Re: [firebird-support] Confusing behavior of UDF in stored procedure
Author Martijn Tonies
> > > 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.

Right, what I meant, is that things like this are legal syntax:

myid = gen_id(mygenerator, 1);

myresult = someudf(...);

and that you don't have to use:

select someudf(...) from rdb$database into :myresult;
or
select gen_id(mygenerator, 1) from rdb$database into :myid;


Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com