Subject | execute statement |
---|---|
Author | frische_brise2003 |
Post date | 2004-02-23T10:51:03Z |
Hi all,
I'm using the following stored proc to generate
my primary keys:
CREATE PROCEDURE GET_NEXT_GEN_VALUE (
GEN_NAME VARCHAR (37))
RETURNS (
GEN_VALUE VARCHAR (20))
AS
DECLARE VARIABLE NUM_VALUE NUMERIC (18, 0);
BEGIN
EXECUTE STATEMENT ( 'select gen_id(' || :gen_name ||
', 1) FROM rdb$Database' ) into :NUM_VALUE;
GEN_VALUE = CAST(NUM_VALUE as VARCHAR(20));
SUSPEND;
END
Input parameter is the name of a generator, output is the next
value of this generator.
I have created several databases which I use for testing
and replication.
The strange thing is, that calling the SP in one database
works fine, but in another I always get the following
error:
SQLCODE=-904:
Variable type (position 0) in EXECUTE STATEMENT 'select
gen_id(ADDRESS_PK_GEN, 1) FROM rdb$Database' INTO does not match
returne
IBCODE=335544829
There are no differences between the databases....
Any ideas what could be the problem?
Regards
Jürgen
I'm using the following stored proc to generate
my primary keys:
CREATE PROCEDURE GET_NEXT_GEN_VALUE (
GEN_NAME VARCHAR (37))
RETURNS (
GEN_VALUE VARCHAR (20))
AS
DECLARE VARIABLE NUM_VALUE NUMERIC (18, 0);
BEGIN
EXECUTE STATEMENT ( 'select gen_id(' || :gen_name ||
', 1) FROM rdb$Database' ) into :NUM_VALUE;
GEN_VALUE = CAST(NUM_VALUE as VARCHAR(20));
SUSPEND;
END
Input parameter is the name of a generator, output is the next
value of this generator.
I have created several databases which I use for testing
and replication.
The strange thing is, that calling the SP in one database
works fine, but in another I always get the following
error:
SQLCODE=-904:
Variable type (position 0) in EXECUTE STATEMENT 'select
gen_id(ADDRESS_PK_GEN, 1) FROM rdb$Database' INTO does not match
returne
IBCODE=335544829
There are no differences between the databases....
Any ideas what could be the problem?
Regards
Jürgen