473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

create triggers

HI, I HOPE SOMEBODY CAN HELP ME WITH THIS, I´M TRYING TO CREATE A
TRIGGER WITH A SCRIPT, BUT WEND I RUN IT ALWAYS SEND ME A ERROR
"SQL0104N Se ha encontrado una señal imprevista
"END-OF-STATEMENT" a continuación de "END". Entre las señales
esperadas se puede incluir: "JOIN <joined_table>".

THIS IS THE SCRIPT, I LIKE TO USE A SCRIPT TO CREATE ALL MY TRIGGERS
(8 0R 10) BECAUSE EVERY TIME I NEED TO CREATE THEM I HAVE TO USE THE
WIZARD OF CONTROL CENTER. AND THAT'S A HEAD ACHE.

CREATE TRIGGER LEDAT.INGOBS AFTER INSERT ON LEDAT.ICITEM
REFERENCING NEW AS FN FOR EACH ROW MODE DB2SQL

/*
*SI EL VALOR RECIBIDO ES MAYOR A CERO ENTONCES SE CONSIDERA
*QUE EL CAMPO LLEVA UN VALOR VALIDO
*/
WHEN (LENGTH(LTRIM(FN.DEFPRICLST)) > 0)
BEGIN ATOMIC
INSERT INTO LEDAT.OBSERVACIONES (IDPROD,IDLISPRE) VALUES (FN.ITEMNO,
FN.DEFPRICLST);
END
Nov 12 '05 #1
2 2620
Omar Vazquez wrote:
HI, I HOPE SOMEBODY CAN HELP ME WITH THIS, I´M TRYING TO CREATE A
TRIGGER WITH A SCRIPT, BUT WEND I RUN IT ALWAYS SEND ME A ERROR
"SQL0104N Se ha encontrado una señal imprevista
"END-OF-STATEMENT" a continuación de "END". Entre las señales
esperadas se puede incluir: "JOIN <joined_table>".

THIS IS THE SCRIPT, I LIKE TO USE A SCRIPT TO CREATE ALL MY TRIGGERS
(8 0R 10) BECAUSE EVERY TIME I NEED TO CREATE THEM I HAVE TO USE THE
WIZARD OF CONTROL CENTER. AND THAT'S A HEAD ACHE.

CREATE TRIGGER LEDAT.INGOBS AFTER INSERT ON LEDAT.ICITEM
REFERENCING NEW AS FN FOR EACH ROW MODE DB2SQL

/*
*SI EL VALOR RECIBIDO ES MAYOR A CERO ENTONCES SE CONSIDERA
*QUE EL CAMPO LLEVA UN VALOR VALIDO
*/
WHEN (LENGTH(LTRIM(FN.DEFPRICLST)) > 0)
BEGIN ATOMIC
INSERT INTO LEDAT.OBSERVACIONES (IDPROD,IDLISPRE) VALUES (FN.ITEMNO,
FN.DEFPRICLST);
END

Omar,

How do you run the script?
Make sure that after the END of the trigger statement you use a
character different from ';'. Popular are '$', '#' or '!'.
Then use that character in comntrol center as termination character for
tools-settings and/or use db2 -td$ -f <file> to run the script.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
On Mon, 24 Jan 2005 14:25:51 -0800, Omar Vazquez wrote:

If you created the script on a windows machine, remember to run dos2unix
before you try to execute it on a unix machine. (different newline
interpretation).

-R-

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: efinney | last post by:
Hi, I'm a newbie to sql server and this may be a really dumb question for some you. I'm trying to find some examples of sql server triggers that will set columns (e.g. the created and modified...
4
by: Mark Flippin | last post by:
I'm just starting to use triggers in my databases and find the support in Enterpise Manager lacking. Using Enterprise Manager and Query Analyzer you can maintain the triggers, but it's...
1
by: tim.pascoe | last post by:
I'm trying to generate scrips for a database, and everything so far has worked fine, except for the triggers. When I try and script existing triggers, all I get is a blank file - no SQL script. I...
1
by: Ling Xiaoyu | last post by:
Hello there. Can anybody help me with Postgresql triggers? what I need is a trigger which update value of field "tables_rows.total_rows" to rows count of table "zzz" if I insert new row in table...
1
by: Manish Bafna | last post by:
speaking of me, I'm not very new to Access, but I haven't worked on it as a professional. I know that you can fire queries in Access, but I don't think you can create views. i want to know that...
8
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
0
by: fblake | last post by:
Active Flash V1.0 http://www.activeup.com/products/components/activeflash Price - $295 Evaluation - http://dl.filekicker.com/send/file/184524-5045/ActiveFlash1.zip
2
by: lakuma | last post by:
Hi, I have a table called A (say) with columns called name, place, animal and thing. I would want to write an on insert trigger on this table, which would create a table with the name of the...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.