Subject | Re: [Firebird-Architect] RFC: Please unify stored procedure |
---|---|
Author | Ivan Prenosil |
Post date | 2004-12-22T13:20:42Z |
From: "Jim Starkey" <jas@...>
that does not return records (i.e. I do not use Suspend).
E.g. application calls selectable SP when it starts, and this SP
is customized for each customer. One uses this variant
CREATE PROCEDURE STARTPROC
RETURNS (PARAM Varchar(20), VAL Integer) AS
BEGIN
PARAM = 'CNT'; VAL = (Select Count(*) From UsersTab); SUSPEND;
PARAM = 'LAST'; VAL = GEN_ID(G,0); SUSPEND;
PARAM = 'PRIV'; VAL = 1; SUSPEND;
END
Other may use this (preserving calling type and parameters):
CREATE PROCEDURE STARTPROC
RETURNS (PARAM Varchar(20), VAL Integer) AS
BEGIN
EXIT;
END
This is where automagical distingushing between Selectable/Executable
procedures fails.
It would be possible to write into documentation that SUSPEND is mandatory
in selectable SP, e.g.
CREATE PROCEDURE STARTPROC ...
BEGIN
EXIT; SUSPEND;
END
but the whole point of this thread is that nobody wants to read any
documentation (neither those who write SPs, nor those who use them), so ...
Ivan
> >In any case we don't declare that procedure mustThe slight ambiguity is that I may want Selectable procedure
> >have resultset. By the way - what is resultset ? Is empty set is valid resultset
> >
> Perhaps I've missed something important, but the only reason for a
> procedure to contain a "suspend" is to return a record, and a procedure
> that doesn't contain a "suspend" can't return records, so it isn't the
> least ambiguous.
that does not return records (i.e. I do not use Suspend).
E.g. application calls selectable SP when it starts, and this SP
is customized for each customer. One uses this variant
CREATE PROCEDURE STARTPROC
RETURNS (PARAM Varchar(20), VAL Integer) AS
BEGIN
PARAM = 'CNT'; VAL = (Select Count(*) From UsersTab); SUSPEND;
PARAM = 'LAST'; VAL = GEN_ID(G,0); SUSPEND;
PARAM = 'PRIV'; VAL = 1; SUSPEND;
END
Other may use this (preserving calling type and parameters):
CREATE PROCEDURE STARTPROC
RETURNS (PARAM Varchar(20), VAL Integer) AS
BEGIN
EXIT;
END
This is where automagical distingushing between Selectable/Executable
procedures fails.
It would be possible to write into documentation that SUSPEND is mandatory
in selectable SP, e.g.
CREATE PROCEDURE STARTPROC ...
BEGIN
EXIT; SUSPEND;
END
but the whole point of this thread is that nobody wants to read any
documentation (neither those who write SPs, nor those who use them), so ...
Ivan