Subject Re: [ib-support] view generator
Author Claudio Valderrama C.
""phoove27"" <phoove27@...> wrote in message
news:a7bbcp+7277@......
> I created and set a generator as follows:
>
> 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=20
> after double-clicking the VUNIQNO view I attempt to click on the=20
> DATA tab. The following message appears:
>
> Dynamic SQL Error
> SQL error code =3D -104
> Token unknown =96 line 1, char 24
> )
>
> Can anyone tell me what I am doing wrong here? I am using Firebird=20
> 1.0 for Linux.

You are doing only one thing wrong: using IBConsole.
:-)

This is the buggy command that IBConsole sends to the engine for
preparation:

«insert into "VUNIQNO" () values ()
»

Notice that IBConsole appends a CRLF after the view's name and the same
happens for every command sent to the engine from IBConsole. Is this a
defect in the IBX parser? Anyway, it's only a minor glitch, the command
would be executed anyway if it was correct.

But you can't prepare that statement. You don't have a list of fields inside
the first pair of parenthesis and you don't have a "?" to signal a parameter
inside the second pair of parameters.

As why IBConsole does that when you browse: it tries to prepare in advance
parameterized statements to insert, modify and delete from the table. It's
not executing, it's only preparing.

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing