473,396 Members | 2,030 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,396 software developers and data experts.

to solve trigger

1
CREATE OR REPLACE PROCEDURE MFGNO(BODYSRNO IN VARCHAR2)
IS
MFGSRNO VARCHAR2(8);
mfgno varchar2(8);
cnt varchar2(3);
BDATE DATE;
BEGIN
Select year_code||TO_CHAR(SYSDATE, 'MMDD') INTO mfgno from year_master
where year in (select to_char(sysdate,'yyyy') from dual);
select lpad(count(*)+1,3,0) into cnt from manu where
substr(bodysrno,1,1) in ('U','S','P')
AND bdate IN (SELECT SYSDATE FROM DUAL);
mfgno:=mfgno||cnt;
UPDATE manu SET mfgsrno=MFGNO WHERE BODYSRNO IN(SELECT BODYSRNO FROM MANU) ;
DBMS_OUTPUT.PUT_LINE(MFGSRNO);
END;


this is the procedure to create the trigger using this and put the output in that way bodysrno,mfgsrno,bdate in one table so pls help me for creating trigger
May 11 '12 #1
1 1814
rski
700 Expert 512MB
Could you precise
1) what operation on what table should invoke the trigger
2) in what table do you want to insert the rows
3) this query
Expand|Select|Wrap|Line Numbers
  1. UPDATE manu SET mfgsrno=MFGNO WHERE BODYSRNO IN(SELECT BODYSRNO FROM MANU) ;
  2.  
does not make sense to me, you update manu for all records which exists in manu.
it is equall to
Expand|Select|Wrap|Line Numbers
  1. UPDATE manu SET mfgsrno=MFGNO;
  2.  
Also if you use IN you have to make sure that BODYSRN is not null.

Please put here table structures and describe how should it work.
May 11 '12 #2

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

Similar topics

1
by: RobertGl | last post by:
Hi everybody! My problem is as following: I have a trigger which fires on delete of a table row. The body of the trigger checks and manipulates entries in other tables. If the entries have...
4
by: Marie-Christine | last post by:
i want to audit transactions done to table TOrig. I created table TAudit same as TOrig in addition to ActionID (1 for insert, 2 for update, 3 for delete), System Date and System User. I created...
9
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,...
6
by: Mary | last post by:
We are developing a DB2 V7 z/OS application which uses a "trigger" table containing numerous triggers - each of which is activated by an UPDATE to a different column of this "trigger" table. When...
5
by: William of Ockham | last post by:
Hi, I was asked to recreate a new clean database for our developers because the current one they use is not entirely up to date. So I created a new database and I run into the followin strange...
2
by: Chris Gamache | last post by:
Tsearch2 comes with its own tsearch2 trigger function. You pass column names to it, and it puts a vanilla tsvector into the column named in TG_ARGV. Not only can you pass column names to it, but...
13
by: dennis | last post by:
Hello, I'm having trouble solving the following problem with DB2 UDB 8.2. I need to create a trigger that performs certain extra constraint validations (temporal uniqueness). One of the tables...
0
by: cnplnsk | last post by:
i am giving whole program of trigger plz point out any error if there this program is in file and called as trig2.sql drop trigger trig2; delimiter $$ create trigger trig2 after insert on tab...
1
by: cnplnsk | last post by:
i am giving whole program of trigger plz point out any error if there this program is in file and called as trig2.sql drop trigger trig2; delimiter $$ create trigger trig2 after insert on tab...
3
by: anuja pokharel | last post by:
hello, i have a problem in trigger. My trigger is CREATE OR REPLACE TRIGGER duplicate_deptno BEFORE INSERT OR UPDATE OF deptno ON DEPT1 REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW...
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.