473,548 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

trigger with check integer column

3 New Member
I have create trigger:

CREATE TRIGGER TR
NO CASCADE
BEFORE INSERT ON T
REFERENCING NEW AS newrow
FOR EACH ROW MODE DB2SQL
WHEN (newrow.id = null)
BEGIN ATOMIC
set newrow.id = nextval for SAMPLE.sequ ;
END

But, write error with type. Column 'id' is integer and primery key.
If ID is then entered id, unless it gets sequence. but I can not do a check on value.

Please help me.
Thanks
Sep 10 '07 #1
2 1805
pashki
3 New Member
i'm find vote this problem
Sep 10 '07 #2
pashki
3 New Member
CREATE TRIGGER TR
NO CASCADE
BEFORE INSERT ON T
REFERENCING NEW AS newrow
FOR EACH ROW MODE DB2SQL
WHEN (newrow.id = null)
BEGIN ATOMIC
set newrow.id = nextval for SAMPLE.sequ ;
END
CREATE TRIGGER TR
NO CASCADE
BEFORE INSERT ON T
REFERENCING NEW AS newrow
FOR EACH ROW MODE DB2SQL
WHEN (newrow.id is null)
begin atomic
set newrow.id = nextval for sequ;
end
Sep 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4081
by: Sean Utt | last post by:
Table "grps" Column | Type | Modifiers -------------+-----------------------------+-------------------------------- --------------------- grpsid | integer | not null default nextval('"grps_grpsid_seq"'::text) grpsname | text | not null...
2
7173
by: Rigs | last post by:
Hi, I'm a SQL Server newbie, so I'd appreciate if someone would tell me if this is possible. I'm running SQL Server 2000 on Win2k Server I have one table with a large number of columns. I have two pieces of logic that I'd like to execute depending upon whether an insert or an update statement was executed on that table. I'd prefer this...
9
3449
by: Martin | last post by:
Hello, I'm new with triggers and I can not find any good example on how to do the following: I have two tables WO and PM with the following fields: WO.WONUM, VARCHAR(10) WO.PMNUM, VARCHAR(10) WO.PROBLEMCODE, VARCHAR(8)
33
4740
by: coosa | last post by:
I have a table: ---------------------------------------------------- CREATE TABLE CATEGORY ( CATEGORY_ID INTEGER IDENTITY(1,1) NOT NULL, CATEGORY_NAME VARCHAR(40) NOT NULL, PARENT_CATEGORY_ID INTEGER, CATEGORY_ICON IMAGE, DEPTH INTEGER,
2
2637
by: ezra epstein | last post by:
Hi, I've got a table: <code language="SQL"> CREATE TABLE "common"."dynamic_enum" ( "pk_id" integer DEFAULT nextval('"common"."pw_seq"') , "enum_type" common.non_empty_name
4
4169
by: Alexander Pope | last post by:
I am using db2 udb v8.2 AIX I have created trigger, however I am not confident it meets industry standards. If I make it fail, I cant tell from the message where it is failing. what can I add to trap the errors properly? CREATE TRIGGER myschema.t1_upd_t AFTER UPDATE OF dt ON myschema.t1 REFERENCING NEW AS N
2
6425
by: 73blazer | last post by:
Perhaps my thinking is wrong but this is what I have: 1 table (Tab1) with 1 attribute (Attr1) Attr1 char(16) for bit data ----------------------------------------------- create trigger check no cascade before insert on Tab1 referencing new as N
0
2459
by: JohnO | last post by:
Thanks to Serge and MarkB for recent tips and suggestions. Ive rolled together a few stored procedures to assist with creating audit triggers automagically. Hope someone finds this as useful as I've found it educational. Note: - I build this for use in a JDEdwards OneWorld environment. I'm not sure how generic others find it but it...
3
3418
by: beer | last post by:
Hello All I'm running 7.3.4-1 on a RH9 box. I'm having a problem with a trigger that seems to execute without actually performing the update that it should. The update returns true everytime however if it is the first time that the trigger executes on a given row, the column is not updated. The column is updated correctly on subsequent...
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7444
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7954
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.