Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 2 odgovora
  • 2.287 pregleda

Najnovija ↓

Missing semicolon ???? 08.12.2015. u 18:33 · pre 132 meseca #1
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)
Potpis
www.mladenmp.ml
Re: Missing semicolon ???? 09.12.2015. u 10:31 · pre 132 meseca #2
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 ;
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme