如何在表的过程中显示变量SET HasilBKD
?
表中仅显示别名,例如(AS Syt_Pendidikan,Pendidikan_Prodi等...)。
但是if和else中的变量(HasilBKD)没有出现。
请帮助我该如何解决?
这样的表格中的数据,但没有 HasilBKD 。
这是示例表。
CREATE DEFINER=`root`@`localhost` PROCEDURE
`hasil_approval_verifikator`(nip varchar(30))
BEGIN
DECLARE Pendidikan FLOAT;
DECLARE Penelitian FLOAT;
DECLARE Pengabdian FLOAT;
DECLARE Penunjang FLOAT;
DECLARE Points FLOAT;
DECLARE SumBKD FLOAT;
DECLARE SyaratBKD FLOAT;
DECLARE HasilBKD varchar(30);
SELECT
a.nip,b.nama_peg,c.id_kat_dosen,
MAX(CASE WHEN d.id_bkd = 1 THEN d.sks_bkd ELSE 0 END) AS Syt_Pendidikan,
MAX(CASE WHEN d.id_bkd = 2 THEN d.sks_bkd ELSE 0 END) AS Syt_Penelitian,
MAX(CASE WHEN d.id_bkd = 3 THEN d.sks_bkd ELSE 0 END) AS Syt_Pengabdian,
MAX(CASE WHEN d.id_bkd = 4 THEN d.sks_bkd ELSE 0 END) AS Syt_Penunjang,
FORMAT(SUM(CASE WHEN a.id_bkd = 1 AND a.applaporan_ketuaprodi=1 THEN
a.sks_subkegiatan/8 END),2) AS Pendidikan_Prodi,
FORMAT(SUM(CASE WHEN a.id_bkd = 2 AND a.applaporan_ketuaprodi=1 THEN
a.sks_subkegiatan/8 END),2) AS Penelitian_Prodi,
FORMAT(SUM(CASE WHEN a.id_bkd = 3 AND a.applaporan_ketuaprodi=1 THEN
a.sks_subkegiatan/8 END),2) AS Pengabdian_Prodi,
FORMAT(SUM(CASE WHEN a.id_bkd = 4 AND a.applaporan_ketuaprodi=1 THEN
a.sks_subkegiatan/8 END),2) AS Penunjang_Prodi,
FORMAT(SUM(CASE WHEN a.id_bkd IN (1,4) AND a.applaporan_ketuaprodi=1 THEN
a.poin_subkegiatan/8 END),2) AS Points_Prodi,
FORMAT(SUM(CASE WHEN a.id_bkd = 1 AND a.app_assesor1=1 AND
a.app_assesor2=1 THEN a.sks_subkegiatan/8 END),2) AS Pendidikan_As1,
FORMAT(SUM(CASE WHEN a.id_bkd = 2 AND a.app_assesor1=1 AND
a.app_assesor2=1 THEN a.sks_subkegiatan/8 END),2) AS Penelitian_As1,
FORMAT(SUM(CASE WHEN a.id_bkd = 3 AND a.app_assesor1=1 AND
a.app_assesor2=1 THEN a.sks_subkegiatan/8 END),2) AS Pengabdian_As1,
FORMAT(SUM(CASE WHEN a.id_bkd = 4 AND a.app_assesor1=1 AND
a.app_assesor2=1 THEN a.sks_subkegiatan/8 END),2) AS Penunjang_As1,
FORMAT(SUM(CASE WHEN a.id_bkd IN (1,4) AND a.app_assesor1=1 AND
a.app_assesor2=1 THEN a.poin_subkegiatan/8 END),2) AS Points_As1
FROM bkd_subkegiatan_laporan a
JOIN tb_pegawai b on a.nip=b.nip
JOIN profil_dosen c on a.nip=c.nip
JOIN bkd_remun_dosen d on c.id_kat_dosen=d.id_kat_dosen
JOIN periode_lkd e on a.id_periode=e.id_periode
WHERE e.status = 1 AND a.nip=nip;
IF (c.id_kat_dosen = 3 or c.id_kat_dosen = 7 or c.id_kat_dosen = 9)
THEN
SET SyaratBKD = Syt_Penelitian+4;
SET Pendidikan = Pendidikan_Prodi+Pendidikan_As1;
SET Penelitian = Penelitian_Prodi+Penelitian_As1;
SET Pengabdian = Pengabdian_Prodi+Pengabdian_As1;
SET Penunjang = Penunjang_Prodi+Penunjang_As1;
SET Points = Points_Prodi+Points_As1;
SET SumBKD = Pendidikan+Penelitian+Pengabdian+Penunjang
IF (Pendidikan>=Syt_Pendidikan and Penelitian>=Syt_Penelitian and
Pengabdian>=Syt_Pengabdian and SumBKD>=12)
THEN
SET HasilBKD = 'OK';
ELSE
SET HasilBKD = 'NOT OK';
END IF;
ELSEIF (c.id_kat_dosen = 1 or c.id_kat_dosen = 2 or c.id_kat_dosen = 4)
THEN
SET SyaratBKD = Syt_Penelitian+4;
SET Pendidikan = Pendidikan_Prodi+Pendidikan_As1;
SET Penelitian = Penelitian_Prodi+Penelitian_As1;
SET Pengabdian = Pengabdian_Prodi+Pengabdian_As1;
SET Penunjang = Penunjang_Prodi+Penunjang_As1;
SET Points = Points_Prodi+Points_As1;
SET SumBKD = Pendidikan+Penelitian+Pengabdian+Penunjang;
IF (Pendidikan>=Syt_Pendidikan)
THEN
SET HasilBKD = 'OK';
ELSE
SET HasilBKD = 'NOT OK';
END IF;
ELSE
SET HasilBKD = 'id not available';
END IF;
END