When condition of trigger
Posted in 2007
Topics: Data Types & Schema Design, Triggers, Constraints & Referential Integrity
Hello,
IDS 10
Solaris 10
I'm creating a trigger on a table with the following syntax
create trigger trig1 insert on tableAreferencing new as post
for each row when(col1 <>'')
(insert into tableB values (post.col1,1))
when(col2<>'')
(insert into tableB values (post.col2,2))
TableA has 2 varchar columns (col1 and col2)
When I run the statement , it returns an error message (syntax error)
Is it possible to specify multiple when conditions?
If yes, what is the right syntax?
If not, is there a way to get it run?
Thanks
How about:
insert into tableB values (post.col1,1) where (post.col1<>'')
insert into tableB values (post.col2,2) where (post.col2<>'')
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
GEORGES MARTIN
Sent: Thursday, August 16, 2007 10:01 AM
To: ids@iiug.org
Subject: When condition of trigger [9799]
Hello,
IDS 10
Solaris 10
I'm creating a trigger on a table with the following syntax
create trigger trig1 insert on tableAreferencing new as post
for each row when(col1 <>'')
(insert into tableB values (post.col1,1))
when(col2<>'')
(insert into tableB values (post.col2,2))
TableA has 2 varchar columns (col1 and col2)
When I run the statement , it returns an error message (syntax error) Is
it possible to specify multiple when conditions?
If yes, what is the right syntax?
If not, is there a way to get it run?
Thanks
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
Please do not transmit orders or instructions regarding a UBS account by
e-mail. The information provided in this e-mail or any attachments is not an
official transaction confirmation or account statement. For your protection,
do not include account numbers, Social Security numbers, credit card numbers,
passwords or other non-public information in your e-mail. Because the
information contained in this message may be privileged, confidential,
proprietary or otherwise protected from disclosure, please notify us
immediately by replying to this message and deleting it from your computer if
you have received this communication in error. Thank you.
UBS Financial Services Inc.
UBS International Inc.
UBS Financial Services Incorporated of Puerto Rico
You need a comma after the first insert statement before the next when.
Graeme Norton | Development Manager North | BROADCAST - IT | ITV Plc
Television Centre, Kirkstall Road | Leeds | LS3 1JS | Tel: 084488 19357 | Mob:
07764 256655 | Graeme.Norton@ITV.COM | itv.com
Please consider the environment before printing this email
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
GEORGES MARTIN
Sent: 16 August 2007 15:01
To: ids@iiug.org
Subject: When condition of trigger [9799]
Hello,
IDS 10
Solaris 10
I'm creating a trigger on a table with the following syntax
create trigger trig1 insert on tableAreferencing new as post
for each row when(col1 <>'')
(insert into tableB values (post.col1,1))
when(col2<>'')
(insert into tableB values (post.col2,2))
TableA has 2 varchar columns (col1 and col2)
When I run the statement , it returns an error message (syntax error)
Is it possible to specify multiple when conditions?
If yes, what is the right syntax?
If not, is there a way to get it run?
Thanks
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
--------------------------------------------------------
ITV plc (Registration No. 4967001) ("ITV") is incorporated in England and
Wales with its registered office at 200 Grays Inn Road, London WC1X 8HF.
Please visit the official ITV website at www.itv.com for the latest company
news.
The contents of this email and any attachments are confidential, may be
privileged, may be subject to copyright and are intended solely for the use of
the individual to whom they are addressed. If you have received this email and
you are not the intended recipient please notify postmaster@itv.com and delete
this email and you are notified that disclosing, copying, distributing or
taking any action in reliance on the contents of this email are strictly
prohibited.
Although ITV routinely screens for viruses, recipients should scan this email
and any attachments for viruses. ITV makes no representation or warranty that
this email or any of its attachments is free of viruses or defects and does
not accept any responsibility for any damage caused by any virus or defect
transmitted by this email. ITV reserves the right to monitor all e mails and
the systems upon which such e mails are stored or circulated.
Any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of ITV.
Thank You.
--------------------------------------------------------
Use comma (,) between when expression.
create trigger trig1 insert on tableA
referencing new as post
for each row
when(col1 <>'') (insert into tableB values (post.col1,1)),
when(col2<>'') (insert into tableB values (post.col2,2));
GEORGES MARTIN escreveu:
Hello,
IDS 10
Solaris 10
I'm creating a trigger on a table with the following syntax
create trigger trig1 insert on tableA
referencing new as post
for each row when(col1 <>'')
(insert into tableB values (post.col1,1))
when(col2<>'')
(insert into tableB values (post.col2,2))
TableA has 2 varchar columns (col1 and col2)
When I run the statement , it returns an error message (syntax error)
Is it possible to specify multiple when conditions?
If yes, what is the right syntax?
If not, is there a way to get it run?
Thanks
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
--
Jairo Gubler
Supervisor
SIC - TBD - Tecnologia em Banco de Dados
DÍGITRO TECNOLOGIA
E-mail: [1]jairo.gubler@digitro.com.br
Fone: +55 48 3281-7213 / +55 48 3281-7000
Fax: +55 48 3281-7299
Site: [2]www.digitro.com
References
1. mailto:jairo.gubler@digitro.com.br
2. http://www.digitro.com/