Subject | Re : [firebird-support] Stored Procedure executing another stored procedure (wrapper sp) |
---|---|
Author | kokou Fostin |
Post date | 2012-05-03T21:11:15Z |
I give you an example of procedure code source
SET TERM ^ ;
CREATE OR ALTER PROCEDURE SP (INParam1 Type1, INParam2 Type2, .....)
RETURNS
(
OUTField1 Type1,
OUTField2 Type2,
...
)
AS
DECLARE VARIABLE VAR1 Type1;
DECLARE VARIABLE VAR2 Type2;
....
BEGIN
IF CONDITION1 THEN BEGIN
FOR SELECT F1, F2, .. FROM sp1
INTO :OUTField1, :OUTField2, ..
DO BEGIN
SUSPEND;
END
END ELSE BEGIN
FOR SELECT F1, F2, .. FROM sp2
INTO :OUTField1, :OUTField2, ..
DO BEGIN
SUSPEND;
END
END
END
END^
SET TERM ; ^
________________________________
De : Newbie <netfirebird@...>
À : firebird-support@yahoogroups.com
Envoyé le : Jeudi 3 mai 2012 22h53
Objet : [firebird-support] Stored Procedure executing another stored procedure (wrapper sp)
Is it possible and architecturally wise to execute another stored
procedure from a sp?
I have currently a selectable sp with many IF statements, all of them
return a select with same fields, but with different conditions.
I am thinking to divide them into several stored procedures and have
main sp to calling out others. something like
if () then
select * from sp1
else if()then
select * from sp2
etc.
is it wise to do this way? is there a good sample for doing it?
thanks.
[Non-text portions of this message have been removed]
SET TERM ^ ;
CREATE OR ALTER PROCEDURE SP (INParam1 Type1, INParam2 Type2, .....)
RETURNS
(
OUTField1 Type1,
OUTField2 Type2,
...
)
AS
DECLARE VARIABLE VAR1 Type1;
DECLARE VARIABLE VAR2 Type2;
....
BEGIN
IF CONDITION1 THEN BEGIN
FOR SELECT F1, F2, .. FROM sp1
INTO :OUTField1, :OUTField2, ..
DO BEGIN
SUSPEND;
END
END ELSE BEGIN
FOR SELECT F1, F2, .. FROM sp2
INTO :OUTField1, :OUTField2, ..
DO BEGIN
SUSPEND;
END
END
END
END^
SET TERM ; ^
________________________________
De : Newbie <netfirebird@...>
À : firebird-support@yahoogroups.com
Envoyé le : Jeudi 3 mai 2012 22h53
Objet : [firebird-support] Stored Procedure executing another stored procedure (wrapper sp)
Is it possible and architecturally wise to execute another stored
procedure from a sp?
I have currently a selectable sp with many IF statements, all of them
return a select with same fields, but with different conditions.
I am thinking to divide them into several stored procedures and have
main sp to calling out others. something like
if () then
select * from sp1
else if()then
select * from sp2
etc.
is it wise to do this way? is there a good sample for doing it?
thanks.
[Non-text portions of this message have been removed]