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 8648847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:24:37+00:00 2026-06-12T13:24:37+00:00

DROP FUNCTION IF EXISTS bramkiStracone; CREATE FUNCTION bramkiStracone(idDruzyny INT) RETURNS int(11) DETERMINISTIC BEGIN DECLARE

  • 0
DROP FUNCTION IF EXISTS bramkiStracone;

CREATE FUNCTION bramkiStracone(idDruzyny INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE bramek INT;
DECLARE tmp1 INT;
DECLARE tmp2 INT;

SELECT DISTINCT COALESCE(SUM( b.bramki ), 0) INTO tmp1
FROM LigaBramki b
INNER JOIN LigaZawodnicy z ON b.idZawodnika = z.idZawodnika
INNER JOIN LigaDruzyny d ON z.idDruzyny = d.idDruzyny
INNER JOIN LigaMecze m ON b.idMeczu = m.idMeczu
WHERE m.idDruzyny2 = idDruzyny
AND z.idDruzyny != idDruzyny
AND d.idDruzyny != idDruzyny
AND m.rozegrany = '1';

SELECT DISTINCT COALESCE(SUM( b.bramki ), 0) INTO tmp2
FROM LigaBramki b
INNER JOIN LigaZawodnicy z ON b.idZawodnika = z.idZawodnika
INNER JOIN LigaDruzyny d ON z.idDruzyny = d.idDruzyny
INNER JOIN LigaMecze m ON b.idMeczu = m.idMeczu
WHERE m.idDruzyny1 = idDruzyny
AND z.idDruzyny != idDruzyny
AND d.idDruzyny != idDruzyny
AND m.rozegrany = '1';

SET bramek = tmp1 + tmp2;

RETURN bramek;
END

I have error near DECLARE bramek INT; but don’t know what am i missing,
i tried to make it work by removing semi-colons but that didn’t work either.

after i added delimiter i still have error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER |
CREATE FUNCTION bramkiStracone(idDruzyny INT)
RETURNS int(11)
DET' at line 1 
  • 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-12T13:24:38+00:00Added an answer on June 12, 2026 at 1:24 pm

    dont forget to change the default DELIMITER so the query won’t terminate at DECLARE bramek INT;

    DROP FUNCTION IF EXISTS bramkiStracone;
    
    DELIMITER $$
    
    CREATE FUNCTION bramkiStracone(idDruzyny INT)
    RETURNS int(11)
    DETERMINISTIC
    BEGIN
    DECLARE bramek INT;
    DECLARE tmp1 INT;
    DECLARE tmp2 INT;
    
    SELECT DISTINCT COALESCE(SUM( b.bramki ), 0) INTO tmp1
    FROM LigaBramki b
    INNER JOIN LigaZawodnicy z ON b.idZawodnika = z.idZawodnika
    INNER JOIN LigaDruzyny d ON z.idDruzyny = d.idDruzyny
    INNER JOIN LigaMecze m ON b.idMeczu = m.idMeczu
    WHERE m.idDruzyny2 = idDruzyny
    AND z.idDruzyny != idDruzyny
    AND d.idDruzyny != idDruzyny
    AND m.rozegrany = '1';
    
    SELECT DISTINCT COALESCE(SUM( b.bramki ), 0) INTO tmp2
    FROM LigaBramki b
    INNER JOIN LigaZawodnicy z ON b.idZawodnika = z.idZawodnika
    INNER JOIN LigaDruzyny d ON z.idDruzyny = d.idDruzyny
    INNER JOIN LigaMecze m ON b.idMeczu = m.idMeczu
    WHERE m.idDruzyny1 = idDruzyny
    AND z.idDruzyny != idDruzyny
    AND d.idDruzyny != idDruzyny
    AND m.rozegrany = '1';
    
    SET bramek = tmp1 + tmp2;
    
    RETURN bramek;
    END $$
    
    DELIMITER ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

DROP FUNCTION IF EXISTS my_func; DELIMITER || CREATE FUNCTION my_func(arg_id INT) RETURNS VARCHAR(200) BEGIN
DROP FUNCTION IF EXISTS shorten; delimiter $$ CREATE FUNCTION shorten(s VARCHAR(255), n INT) RETURNS
DELIMITER $$ DROP FUNCTION IF EXISTS `workplantype`.`FUN_STOCKINVENTRY_CHECK` $$ CREATE FUNCTION `workplantype`.`FUN_STOCKINVENTRY_CHECK` ( PONo1 VARCHAR(20),
DELIMITER $$ USE `horizon_jake`$$ DROP FUNCTION IF EXISTS `GPS_Distance_Meters`$$ CREATE DEFINER=`horizon_jake`@`localhost` FUNCTION `GPS_Distance_Meters`(lat1 DOUBLE,
I've this function: DROP FUNCTION IF EXISTS find_linkid; DELIMITER // CREATE FUNCTION `find_linkid`(pc1 VARCHAR(50)
I have this code DELIMITER $$ DROP FUNCTION IF EXISTS `GetNextID` $$ CREATE FUNCTION
Modifed. DROP FUNCTION IF EXISTS PersonName; DELIMITER |; CREATE FUNCTION PersonName( personID SMALLINT )
function populateDB(tx) { tx.executeSql('DROP TABLE IF EXISTS test'); tx.executeSql('CREATE TABLE IF NOT EXISTS test(course
I'm writing a function which will drop a table if it already exists. It
The following is my MySQL stored procedure: DROP PROCEDURE IF EXISTS sp_authenticate; CREATE PROCEDURE

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.