473,396 Members | 2,111 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.

Need Help with Database Trigger

1
Here is two tables: -

Table A cols
Message
location
city

Table B cols
Message
location
city

I want to create a trigger, so that when any matching message column "HELLO" comes to table A, it gets to table B and get deleted from table A.
Apr 23 '07 #1
3 1126
debasisdas
8,127 Expert 4TB
please specify clearly

which record u want to insert to table B
(old or new)
which record u want to delete from table A
(old or new)

and do u want to matching a particular word or what

only then i can send u the code if u want
Apr 27 '07 #2
wel
5
try this ... hope that will help
we assume :
- Tables and trigger are in scott's schema
- Table A col Message
- Table B col Message
- The trigger is named TRIG_HELLO , will fire BEFORE INSERT on table A and when message is 'HELLO'

CREATE OR REPLACE TRIGGER "SCOTT".TRIG_HELLO
BEFORE INSERT ON "SCOTT"."A"
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
WHEN (NEW.MESSAGE='HELLO')
BEGIN
delete from "SCOTT"."A" where message='HELLO';
insert into "SCOTT"."B" values ('HELLO');
commit;
END;
May 1 '07 #3
debasisdas
8,127 Expert 4TB
Dear wel

AS per the rule commands like COMMIT,ROLLBACK n SAVEPOINT can't be specified in a trigger body.

Please don't post such things in the forum which u r not sure yourself.
May 2 '07 #4

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

Similar topics

1
by: Ken | last post by:
I got an Access database that need to be converted to Oracle 9i. Somehow the Trigger we created to simulate the "AUTO NUMBER" on Access could not create the sequence number as soon as the value has...
3
by: SS | last post by:
Hi, I don't want to refresh a web page to query and display database. I want the page shows information immediately when database changes. What kind of technology or method would be able to...
5
by: Raphael Bauduin | last post by:
Hi, I'm looking at the logging of a database we'll put in production soon. I've seen some posts on this list about history tables, like mentioned in...
1
by: Eric D. Nielsen | last post by:
I'm in the process of implementing a "monitor this" type feature on a web-application. When something changes on the monitored item an email to the subscriber is generated. I'd like to do this...
2
by: TJ Talluto | last post by:
Instead of putting the same 12 columns on every table (these 12 columns contain info about who created the record and when, for example)... It may be more efficient to make a new table to hold that...
2
by: rdraider | last post by:
I created and successfully tested a trigger on a test database. Now that I want to put this on a production system, the create trigger statement takes way too long to complete. I cancelled after...
0
by: Michael L | last post by:
Hi Guys(I apologize for the lengty post - Im trying to explain it as best i can) I've been cracking my head on this one for the past 24+ hours and i have tried creating the function in ten...
1
by: sainathr | last post by:
Hi, I would like to run shell scripts with respect to the time mentioned in postgres data base tables. Postgres database should trigger the shell script for the time mentioned in the table. To...
7
by: RogBaker | last post by:
I haven't gotten a response yet, so I moved this from another group. I have been working on this for 2 days so if anyone has any ideas, I would be grateful. I have a 3rd party program that...
2
by: popprem | last post by:
Hi, I have to feed database A from database B which are in different machines but in the same network when a insert/update occurs on database B. I decided to use trigger for this and was trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.