Board index » delphi » can not set generator in SP

Can't set generator in SP


2005-08-23 03:22:10 PM
delphi205
Hello,
I want to set generator to 0 in my SP, the code is like this :
SET TERM ^ ;
CREATE PROCEDURE NEW_PROCEDURE (
TGLSKR INTEGER)
AS
DECLARE VARIABLE CURR_DATE INTEGER;
begin
select currentdate from param into :TGLSKR;
if (TGLSKR = :curr_date) then
begin
set generator nomutasi_kred_numgen to 0;
set generator nomutasi_tab_numgen to 0;
update param set currentdate = :curr_date;
end
/* Procedure Text */
suspend;
end
^
SET TERM ; ^
GRANT SELECT ON PARAM TO PROCEDURE NEW_PROCEDURE;
But I can't.
Is generator can not be set from a Stored procedure ?
TIA.
Ari.
 
 

Re:Can't set generator in SP

Quote
I want to set generator to 0 in my SP, the code is like this :

SET TERM ^ ;

CREATE PROCEDURE NEW_PROCEDURE (
TGLSKR INTEGER)
AS
DECLARE VARIABLE CURR_DATE INTEGER;
begin
select currentdate from param into :TGLSKR;
if (TGLSKR = :curr_date) then
begin
set generator nomutasi_kred_numgen to 0;
set generator nomutasi_tab_numgen to 0;
update param set currentdate = :curr_date;
end
/* Procedure Text */
suspend;
end
^

SET TERM ; ^

GRANT SELECT ON PARAM TO PROCEDURE NEW_PROCEDURE;

But I can't.
Is generator can not be set from a Stored procedure ?
That is correct.
SET GENERATOR is a DDL command, InterBase doesn't support DDL
commands inside a Stored Procedure.
If you really really really want to set the generator value and you're very
very
sure you're the only one connected, you could do:
declare variable dummy integer;
dummy = gen_id(mygen, -gen_id(mygen, 0));
--
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
www.upscene.com
Database development questions? Check the forum!
www.databasedevelopmentforum.com