Subject | Re: Queries in UDFs |
---|---|
Author | lutterot |
Post date | 2007-11-19T01:35:27Z |
Hi and thanks for the reply!
how you want to use it.
I need something along these lines:
CREATE TABLE substitution (x integer, y integer);
CREATE PROCEDURE substitute (x integer)
RETURNS (y integer)
AS BEGIN
SELECT y FROM substitution WHERE x=:x INTO :y;
SUSPEND;
END;
Because the procedure uses a substitution table, the way the numbers
are substituted can be changed easily in the DB. That's what I need.
And I was wondering if there is an easy way to use it similar to this:
CREATE TABLE somenumbers (n integer);
INSERT INTO somenumbers VALUES (substitute(1));
Cheers,
Christof
> >I know that such a functionality could be achieved by writing a storedsingle output field. It's not a function, though it really depends
> >procedure. But it is not possible to use stored procedures that return
> >scalars in the same manner as functions, right?
>
> Well, it is possible. You can write an executable SP that returns a
how you want to use it.
>use a correlated subquery expression in your dynamic query.
> But the normal way to return a scalar field in a set is simply to
>share some of their favourite tricks with you. :-)
> Provide an example of what you want to achieve so that people can
I need something along these lines:
CREATE TABLE substitution (x integer, y integer);
CREATE PROCEDURE substitute (x integer)
RETURNS (y integer)
AS BEGIN
SELECT y FROM substitution WHERE x=:x INTO :y;
SUSPEND;
END;
Because the procedure uses a substitution table, the way the numbers
are substituted can be changed easily in the DB. That's what I need.
And I was wondering if there is an easy way to use it similar to this:
CREATE TABLE somenumbers (n integer);
INSERT INTO somenumbers VALUES (substitute(1));
Cheers,
Christof