#1  
Old 20th November 2007, 02:26 AM
phd13
 
Posts: n/a
Default [nxV2] Trigger

Hello
I' have 2 tables T_VARPP et T_FORMPP
I use T_VARPP to create T_FORMPP

ex Table T_VARPPP
VARPP = "Colonne 1"
DESC = 'la premiere colonne '
Will create a table T_FORMPP
with a column 'Colonne 1' type varchar(50) -figé- with a description 'la
premiere colonne "
All that is done in D7 and it works fine
unfortunately I don't know how to keep uptodate T_FORMPP each time I
modify T_VARPP

DROP TRIGGER IF EXISTS "MAJVARPP";

CREATE TRIGGER MAJVARPP
AFTER INSERT, DELETE ON VARPP
REFERENCING OLD AS o NEW AS n
BEGIN
IF INSERTING THEN
ALTER TABLE FORMPP ADD COLUMN n.VARPP VARCHAR(50) DESCRIPTION n.DESC
;
//ELSEIF UPDATING THEN
//
ELSEIF DELETING THEN
ALTER TABLE FORMPP DROP COLUMN o.VARPP ;
END IF;
END

I got an syntax error on n.VARPP .
What wrongs


  #2  
Old 20th November 2007, 03:03 AM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: [nxV2] Trigger

That statement can not be used in this way.

Beside the fact that it's not allowed in NexusDB to perform DDL
statements while a transaction is active (which is always the case
during the execution of a trigger), if you take a look at the SQL
standard:

<add column definition> ::= ADD [ COLUMN ] <column definition>

<column definition> ::=
<column name> [ <data type or domain name> ]
...

<column name> ::= <identifier>

<identifier> ::= <actual identifier>

<actual identifier> ::=
<regular identifier>
| <delimited identifier>
| <Unicode delimited identifier>

You can can clearly see that you need to specify an identifier as
column name.

You are instead trying to specify an expression which is totally
invalid in this context.


phd13 wrote:

> Hello
> I' have 2 tables T_VARPP et T_FORMPP
> I use T_VARPP to create T_FORMPP
>
> ex Table T_VARPPP
> VARPP = "Colonne 1"
> DESC = 'la premiere colonne '
> Will create a table T_FORMPP
> with a column 'Colonne 1' type varchar(50) -figi- with a description
> 'la premiere colonne "
> All that is done in D7 and it works fine
> unfortunately I don't know how to keep uptodate T_FORMPP each time I
> modify T_VARPP
>
> DROP TRIGGER IF EXISTS "MAJVARPP";
>
> CREATE TRIGGER MAJVARPP
> AFTER INSERT, DELETE ON VARPP
> REFERENCING OLD AS o NEW AS n
> BEGIN
> IF INSERTING THEN
> ALTER TABLE FORMPP ADD COLUMN n.VARPP VARCHAR(50) DESCRIPTION
> n.DESC ;
> //ELSEIF UPDATING THEN
> //
> ELSEIF DELETING THEN
> ALTER TABLE FORMPP DROP COLUMN o.VARPP ;
> END IF;
> END
>
> I got an syntax error on n.VARPP .
> What wrongs




--



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Trigger Matthew Balraj nexusdb.public.support.adoprovider 1 25th November 2009 10:48 PM
SQL Trigger How-To Question... Shane Stump nexusdb.public.support.sql 9 24th June 2007 12:35 AM
Trigger help Eric Noel nexusdb.public.support.sql 7 7th May 2006 08:52 AM
Trigger bug Ole Willy Tuv nexusdb.public.support.sql 5 21st January 2006 02:45 PM
Can a trigger do this? Dennis Landi nexusdb.public.support.sql 1 26th November 2005 01:28 AM


All times are GMT +11. The time now is 09:51 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.