Subject | Re: [ib-support] view generator |
---|---|
Author | Helen Borrie |
Post date | 2002-03-21T04:13:14Z |
At 01:01 AM 21-03-02 +0000, Paul wrote:
This statement:
SELECT GEN_ID(UNIQNO, 1) FROM RDB$DATABASE
would "up" the generator by 1 each time it is called.
To read the generator's last generated value, you need:
SELECT GEN_ID(UNIQNO, 0) FROM RDB$DATABASE
As for what is giving you the error in IBConsole, it could be anything. It
might be fun to put an SQL Monitor over IBConsole's query and see what it's
doing to your statement. It works fine in IB_SQL and ISQL.
Anyway, this is a pretty useless sort of view to make, considering that you
can get exactly the same data back (and optionally push up the generator
value) via the plain ol' statement.
cheers,
Helen
All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________
>I created and set a generator as follows:Aaargh!!!
>
>CREATE GENERATOR UNIQNO;
>
>SET GENERATOR UNIQNO TO 10000;
>
>
>I also created a view as follows:
>
>CREATE VIEW "VUNIQNO"
>(
> "UNIQ_NO"
>) AS
> SELECT GEN_ID(UNIQNO, 1) FROM RDB$DATABASE;
>
>
>In IBConsole, I connect to my database and click on VIEWS. Then
>after double-clicking the VUNIQNO view I attempt to click on the
>DATA tab. The following message appears:
>
>Dynamic SQL Error
>SQL error code = -104
>Token unknown line 1, char 24
>)
>
>
>Can anyone tell me what I am doing wrong here? I am using Firebird
>1.0 for Linux.
This statement:
SELECT GEN_ID(UNIQNO, 1) FROM RDB$DATABASE
would "up" the generator by 1 each time it is called.
To read the generator's last generated value, you need:
SELECT GEN_ID(UNIQNO, 0) FROM RDB$DATABASE
As for what is giving you the error in IBConsole, it could be anything. It
might be fun to put an SQL Monitor over IBConsole's query and see what it's
doing to your statement. It works fine in IB_SQL and ISQL.
Anyway, this is a pretty useless sort of view to make, considering that you
can get exactly the same data back (and optionally push up the generator
value) via the plain ol' statement.
cheers,
Helen
All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________