Membuat Function di mySQL

Posted On // Leave a Comment

CREATE FUNCTION `fn_mst_rekening_nama`(`p_id` varchar(2))
RETURNS VARCHAR(20)
LANGUAGE SQL
DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''

BEGIN
DECLARE nama_rekening VARCHAR(20);
SELECT nama INTO nama_rekening
FROM mst_rekening
WHERE ID = p_id;
RETURN nama_rekening;
END;

0 komentar: