Subject | RE: [firebird-support] Generator in SP |
---|---|
Author | Thomas Steinmaurer |
Post date | 2004-01-26T09:32:17Z |
> The following Generator returns NULL when I use following SQLHow do you use/call the stored procedure?
>
> SELECT NEW_EVRAKNO FROM GPR_MALZEMEHAREKET_EVRAKNO
>
>
> CREATE PROCEDURE GPR_MALZEMEHAREKET_EVRAKNO
> RETURNS (
> NEW_EVRAKNO VARCHAR (20))
> AS
> BEGIN
> NEW_EVRAKNO = 'EN' || GEN_ID(malzemehareket_evrakno, 1);
> END
>
> But, If I use Trigger there is no problem,
>
> Do you know? What is the reason?
With:
EXECUTE PROCEDURE GPR_MALZEMEHAREKET_EVRAKNO ...
or with:
SELECT * FROM GPR_MALZEMEHAREKET_EVRAKNO
?
If it is the latter, then you need a SUSPEND after the
NEW_EVRAKNO assignment.
CREATE PROCEDURE GPR_MALZEMEHAREKET_EVRAKNO
RETURNS (
NEW_EVRAKNO VARCHAR (20))
AS
BEGIN
NEW_EVRAKNO = 'EN' || GEN_ID(malzemehareket_evrakno, 1);
SUSPEND;
END
As said, the usage of SUSPEND depends on how you use/call
the stored procedure.
HTH,
Thomas