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

  • Home
  • SEARCH
  • 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 8996563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:46:16+00:00 2026-06-15T23:46:16+00:00

here is my trigger: create trigger wyplacamy before insert on `skladki_wyplaty` for each row

  • 0

here is my trigger:

create trigger wyplacamy before insert on `skladki_wyplaty`
for each row
BEGIN
  SELECT p.wysokosc_skladki, p.ilosc_miesiecy INTO @wysokosc_skladki, @ilosc_miesiecy
    FROM skladki_aktualne p
    WHERE p.pesel = NEW.pesel AND p.id_ubezpieczenia = NEW.id_ubezpieczenia;

  SET NEW.wyoskosc_wyplaty = @wysokosc_skladki / @ilosc_miesiecy *75;
END
$$

This works, but the iutpput of “wyoskosc_wyplaty” is NULL, even wysokosc_skladki = 8000, and ilosc_miesiecy = 8.

  • 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-15T23:46:17+00:00Added an answer on June 15, 2026 at 11:46 pm

    You need to declare the variables before using them.

    delimiter $$
    create trigger wyplacamy before insert on `skladki_wyplaty`
    for each row
    BEGIN
    
      DECLARE var_wysokosc_skladki INT;
      DECLARE var_ilosc_miesiecy INT; 
    
      SELECT p.wysokosc_skladki, p.ilosc_miesiecy INTO var_wysokosc_skladki, var_ilosc_miesiecy
      FROM skladki_aktualne p
      WHERE p.pesel = NEW.pesel 
      AND p.id_ubezpieczenia = NEW.id_ubezpieczenia;
    
      SET NEW.wyoskosc_wyplaty = var_wysokosc_skladki / var_ilosc_miesiecy * 75;
    
    END
    $$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following trigger; CREATE TRIGGER trFLightAndDestination ON checkin_flight AFTER INSERT,UPDATE AS BEGIN
I create trigger CREATE TRIGGER PartnersTrigger on Partners INSTEAD OF INSERT AS BEGIN SET
I'd like to create a before insert trigger that uses new values to insert
I tried writing this small trigger in MySQL, CREATE TRIGGER `leg` BEFORE INSERT ON
I'm trying to inject HTML code downloaded from URL into my page. Here the
i want to create a trigger that will select staffid where dateread = this
I've created a trigger manually (By pasting the SQL from another oracle db into
First off here is my code: CREATE FUNCTION unknown_Model () RETURNS TRIGGER LANGUAGE plpgsql
I have a trigger and I need to insert the ID from the tracks
I have a strange problem here, I want to create an emtpy trigger: SET

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.