Subject | Re: [firebird-support] generators |
---|---|
Author | agung wibowo |
Post date | 2004-05-15T02:42:12Z |
hello luiz,
if you want to get last value on stored procedure you can do like this:
set term^;
create procedure ABC
returns (new_gen integer)
as
begin
new_gen=gen_id(G_SRSR_RECNO,0);
end^
set term;^
but, if want this on the trigger like make an autoincrement you can do like this:
set term^;
CREATE TRIGGER ABC FOR Teste2
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF ((NEW.ID IS NULL)OR (NEW.ID>GEN_ID(G_SRSR_RECNO,0))) THEN
NEW.ID = GEN_ID(G_SRSR_RECNO,1);
END
set term;^
regards,
agung w
--- Luiz Rafael Culik Guimaraes <culikr@...> wrote:
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
[Non-text portions of this message have been removed]
if you want to get last value on stored procedure you can do like this:
set term^;
create procedure ABC
returns (new_gen integer)
as
begin
new_gen=gen_id(G_SRSR_RECNO,0);
end^
set term;^
but, if want this on the trigger like make an autoincrement you can do like this:
set term^;
CREATE TRIGGER ABC FOR Teste2
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF ((NEW.ID IS NULL)OR (NEW.ID>GEN_ID(G_SRSR_RECNO,0))) THEN
NEW.ID = GEN_ID(G_SRSR_RECNO,1);
END
set term;^
regards,
agung w
--- Luiz Rafael Culik Guimaraes <culikr@...> wrote:
> Dear Friends---------------------------------
>
> How to get the last value generated by an generator
>
> Database name Teste2
> Generator name G_SRSR_RECNO that is used along with
> an trigger for an
> autoincrement field;
>
> Regards
> Luiz
>
>
>
>
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
[Non-text portions of this message have been removed]