Subject Re: Triggers
Author visakan13
Thank you all the input,

Helen as per your advice I tried with the SET TRIM, I get

Starting transaction...
Preparing query: >SET TERM ^
*** IBPP::SQLException ***
Context: Statement::Prepare( >SET TERM ^ )
Message: isc_dsql_prepare failed

SQL Message : -104
Invalid token

Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 1
>


Execute time: 00:00:01.

Martijn as per your advice I get:

Preparing query:

CREATE TRIGGER Tri_Area FOR AREA
ACTIVE BEFORE INSERT
AS
BEGIN
new.SEQ = GEN_ID(AREA_ NEXTNO,1);
END


*** IBPP::SQLException ***
Context: Statement::Prepare(

CREATE TRIGGER Tri_Area FOR AREA
ACTIVE BEFORE INSERT
AS
BEGIN
new.SEQ = GEN_ID(AREA_ NEXTNO,1);
END
)
Message: isc_dsql_prepare failed

SQL Message : -104
Invalid token

Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Token unknown - line 7, column 24
NEXTNO


Execute time: 00:00:00.


I tried this sample in SQL Hammer I didn't get any error. Flame Robin
is good in getting the internal commands like object oriented, but SQL
Hammer dosn't give this, any of you could suggest any admin tool that
gives us the internal command and work like sql Hammer where it
handles all the quots by itself. I thank you again for the input as a
new commer for firebird and I have a project to complete at least I
know I am not on my own. Thank you very much.

Visakan


--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@...> wrote:
>
>
> > >2. It looks like FlameRobin is using ; as a SQL command terminator.
> > >Because the trigger is internally needing one, FlameRobin only sees
> > >down to the first ; so it does not see a valid create trigger
statement.
> > >
> > >Try using
> > >
> > >SET TERM ^ ;
> > >
> > >CREATE TRIGGER Tri_Area FOR AREA
> > >ACTIVE BEFORE INSERT
> > >AS
> > >BEGIN
> > > new.SEQ = GEN_ID(AREA_NEXTNO,1);
> > >END
> > >^
> > >
> > >SET TERM ; ^
> >
> > Beyond the boundaries of the isql application, DSQL statements don't
> > have terminators. SET TERM and the whole concept of "statement
> > terminators" are application-specific to isql. (That the default
> > terminator that the isql shell imposes on itself, which is arbitrary,
> > happens to mimic the PSQL statement terminator, which is not
> > arbitrary, is coincidental..some would even call it "silly"...)
> >
> > As an accommodation for users who haven't got around to reading the
> > literature, some third-party interactive SQL apps *tolerate*
> > extraneous terminators on statements and even SET TERM statements in
> > scripts, by parsing them out. Maybe FlameRobin does this, maybe
> > not...I use IB_SQL, which does. It's certainly not a bug in a 3P
> > application if it doesn't do this laundering, though.
>
> That being said, script runners parse until ";" OR use the isql
> behaviour, which is requiring a SET TERM to change the terminator.
>
> Martijn Tonies
> Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB,
Oracle &
> MS SQL Server
> Upscene Productions
> http://www.upscene.com
> My thoughts:
> http://blog.upscene.com/martijn/
> Database development questions? Check the forum!
> http://www.databasedevelopmentforum.com
>