Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:17:45+00:00 2026-06-15T13:17:45+00:00

I have created a trigger to insert values into Payroll once an entry to

  • 0

I have created a trigger to insert values into Payroll once an entry to Employees have been made. But when I insert values into Employees , no values are entered into Payroll from the trigger. Payroll remains empty when I insert values into Employees. Any ideas?

CREATE TABLE Employees(
empid FLOAT,
dept FLOAT,
empname varchar2(25),
salary FLOAT
);

CREATE TABLE Payroll(
empid FLOAT,
salary FLOAT
);

CREATE OR REPLACE TRIGGER NewEmployee
AFTER INSERT 
ON Employees
FOR EACH ROW
BEGIN
INSERT INTO Payroll 
VALUES(:Old.empid,:Old.salary);
END;
/


INSERT INTO Employees values (1,1,‘supply’,50000);
INSERT INTO Employees values (2,2,‘hard’,80000);

Select * from Employees;
Select * from payroll;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:17:46+00:00Added an answer on June 15, 2026 at 1:17 pm

    Your :Old.empid and :Old.salary should be :new.empid and :new.salary.

    Also, it is slightly more efficient to use a BEFORE INSERT trigger when you can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple question. Ive got a trigger to insert the values into
I have created the following trigger for insert in the deleted user table the
I have created an INSTEAD OF INSERT trigger on a view in my database.
I have created an update trigger in MySQL Community Server 5.5.16 but when I
I have created a trigger in the xaml and it works fine. However, when
We have created a table with a trigger that updates a ModifiedDate field in
I have a table where I created an INSTEAD OF trigger to enforce some
I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
I need to create trigger in SQL Server 2008 that gone insert all values
This is what I currently have: CREATE OR REPLACE TRIGGER MYTRIGGER AFTER INSERT ON

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.