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

Populating a table using trigger

8
Hi,
I am inserting data in table1.using a trigger I want to populate TABLE2.My code is like this :
TABLE1 :ST_INFO
FIELDS : NAME (varchar),ACCOUNT_TYPE(varchar),TIME(date)
TABLE2 :TOTALS
FIELDS : CURR_DAY(date),DISCONNECTIONS(number)
I am inserting data in ST_INFO using SQLLOADER.I want to populate TOTALS with the TIME,count of TIME field after insertion.
CREATE OR REPLACE TRIGGER TRI_TOTALS
AFTER INSERT ON ST_INFO FOR EACH ROW
BEGIN
IF(:NEW.TIME=:OLD.TIME) THEN
UPDATE TOTALS SET CURR_DAY=:OLD.TIME;
ELSE
INSERT INTO TOTALS(CURR_DAY) VALUES(:NEW.TIME);
END IF;
END;

With this only INSERTION operation is happening not UPDATION.
Can anybody help me ? and suggest a way to insert DISCONNECTIONS value in TABLE2.
Jul 17 '07 #1
2 1723
debasisdas
8,127 Expert 4TB
do u have any existing data in the TOTALS table ?
Jul 18 '07 #2
potti
8
do u have any existing data in the TOTALS table ?
I have initialized the fields of TOTALS with NULL values.
Jul 18 '07 #3

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

Similar topics

1
by: shottarum | last post by:
I currently have 2 tables as follows: CREATE TABLE . ( mhan8 int, mhac02 varchar(5), mhmot varchar(5), mhupmj int )
4
by: brent.ryan | last post by:
How do I get the next int value for a column before I do an insert in MY SQL Server 2000? I'm currently using Oracle sequence and doing something like: select seq.nextval from dual; Then I...
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...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
7
by: Serge Rielau | last post by:
Hi all, Following Ian's passionate postings on problems with ALTOBJ and the alter table wizard in the control center I'll try to explain how to use ALTOBJ with this thread. I'm not going to get...
13
by: Mary | last post by:
I'll pulling my hair out on this one and would be so appreciative of any help. I am creating a data entry form to enter results of a student survey. There are 40 questions on the survey. The...
1
by: ITHELP85 | last post by:
So I am working on this project, where I have an ITEM_PURCHASE table and an WAREHOUSE table I want users to be able to input data into the ITEM_PURCHASE table thru a form and the WAREHOUSE table will...
1
by: ITHELP85 | last post by:
using SQL Server 2005 I have a table SALES_ITEM, users should be able to input the Primary Keys (ItemNumberSK and InvoiceNumber), and Qty. I want the ItemName and UnitPrice fields to update...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.