Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Missing semicolon ????

[es] :: MySQL :: Missing semicolon ????

[ Pregleda: 1549 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

mladenmp

Član broj: 193827
Poruke: 51
*.zg.cable.xnet.hr.

Jabber: info@mladenmp.ml
Sajt: www.mladenmp.ml


+1 Profil

icon Missing semicolon ????08.12.2015. u 17:33 - pre 101 meseci
Može li mi neko reći gdje je greška u mojoj proceduri?
Code:

create procedure yearly_income_tax_calculation_federal()

begin

declare salary float;
declare tax float;

SELECT salary_annually INTO salary FROM ndcga776_payroll_db.payroll WHERE payroll_id=2;

IF (salary>0 AND salary<=44701) THEN SET tax = salary*0.15; 
ELSE IF (salary>44701 and salary<=89401) THEN SET tax=44701*0.15+(salary-44701)*0.22;
ELSE IF (salary>89401 and salary<=138586) THEN SET tax=44701*0.15+(89401-44701)*0.22+(salary-89401)*0.26;
END IF
END IF
ELSE SET tax=44701*0.15+(89401-44701)*0.22+(138596-89401)*0.26+(salary-138586)*0.29;
END IF

END


Ova procedura mi ne radi u MySQL Workbench 6.2 64bit (Local Instance MySQL 5.6)
 
Odgovor na temu

igorv
Igor Vujovic
Beograd

Član broj: 70222
Poruke: 68
*.static.isp.telekom.rs.

Sajt: objengine.com


+4 Profil

icon Re: Missing semicolon ????09.12.2015. u 09:31 - pre 101 meseci
Zadnji else (ovaj sto sam iskomentarisao) nema odgovarajuci if

Code:

DELIMITER //
create procedure yearly_income_tax_calculation_federal()
begin

declare salary float;
declare tax float;

SELECT salary_annually INTO salary FROM ndcga776_payroll_db.payroll WHERE payroll_id=2;

IF (salary>0 AND salary<=44701) THEN SET tax = salary*0.15; 
ELSE 
    IF (salary>44701 and salary<=89401) THEN SET tax=44701*0.15+(salary-44701)*0.22;
    ELSE 
        IF (salary>89401 and salary<=138586) THEN SET tax=44701*0.15+(89401-44701)*0.22+(salary-89401)*0.26;
         END IF;
    END IF;
-- ELSE SET tax=44701*0.15+(89401-44701)*0.22+(138596-89401)*0.26+(salary-138586)*0.29;
END IF;

END
//
DELIMITER ;
 
Odgovor na temu

mladenmp

Član broj: 193827
Poruke: 51
*.zg.cable.xnet.hr.

Jabber: info@mladenmp.ml
Sajt: www.mladenmp.ml


+1 Profil

icon Re: Missing semicolon ????09.12.2015. u 12:55 - pre 101 meseci
@igorv HVALA !!!!!!!!!!!!!
 
Odgovor na temu

[es] :: MySQL :: Missing semicolon ????

[ Pregleda: 1549 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.