Subject Re: [firebird-support] Set term gives Token unknown error
Author Stevio
Ah ok I was trying to run it in the DSQL window. (I told you I haven't used
this stuff in quite a while lol!)

Why does SET TERM ^ ; not work in the DSQL window in IB_SQL, and it also
does not work in Database Explorer (from the Enter SQL window), but it works
from within IB_SQL when you select Execute Script from the Connection tab?

What I am trying to do is to create a new table and create a primary key
generator stored procedure. Standard stuff I think?

/* Create Table */
CREATE TABLE LETABLE (
LETABLE_ID INTEGER NOT NULL,
...more fields...
PRIMARY KEY (LETABLE_ID)
);

/* Primary key generator */
CREATE GENERATOR GEN_NEW_LETABLE_ID;
SELECT GEN_ID(GEN_NEW_LETABLE_ID, (SELECT MAX (LETABLE_ID) FROM LETABLE))
FROM RDB$DATABASE;

SET TERM ^ ;
CREATE TRIGGER SET_NEW_LETABLE_ID FOR LETABLE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.LETABLE_ID IS NULL) THEN NEW.LETABLE_ID =
GEN_ID(GEN_NEW_LETABLE_ID, 1);
END ^

CREATE PROCEDURE PROC_NEW_LETABLE_ID
RETURNS (THE_NEW_LETABLE_ID INTEGER)
AS
BEGIN
THE_NEW_LETABLE_ID = GEN_ID(GEN_NEW_LETABLE_ID, 1);
END ^
SET TERM ; ^

Thanks for your help.
Stephen


----- Original Message -----
From: "Aage Johansen" <aagjohan@...>
To: <firebird-support@yahoogroups.com>
Sent: Friday, April 25, 2008 9:55 PM
Subject: Re: [firebird-support] Set term gives Token unknown error


> Stevio wrote:
> >> From: "Aage Johansen" <aagjohan@...>
> >> Using set term ^; in the script pane of IB_SQL should work fine.
> >
> > It doesn't however. Here is the actual error I get:
> >
> > ISC ERROR CODE:335544569
> >
> > ISC ERROR MESSAGE:
> > Dynamic SQL Error
> > SQL error code = -104
> > Token unknown - line 1, char 5
> > term
> >
> > STATEMENT:
> > TIB_DSQL: "<TApplication>.frmSQL.dsqlEdit."
> >
> >
> > Any ideas anyone? What am I doing wrong?
> >
> > ------------------------------------
>
> Nevertheless, I just ran this:
> -----------------------------
> set term ^;
> create trigger TRG_TAPELBL for TAPELBL
> active
> before insert
> as
> begin
> new.ID = gen_id(X,1);
> end^
> set term ;^
> commit;
> -----------------------------
> Firebird/1.5.4
> IB_SQL (IBO(4.8.5)
>
> Will not work in the DSQL pane, of course.
>
>
> Try to show your actual code, and tell us how/where/what you are doing.
>
> --
> Aage J.
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>
>
>