Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- FUNCTION: public.fn_insert_pelamar_data_pribadi_pertanyaan(character varying, character varying, text, character varying, text, character varying)
- -- DROP FUNCTION public.fn_insert_pelamar_data_pribadi_pertanyaan(character varying, character varying, text, character varying, text, character varying);
- CREATE OR REPLACE FUNCTION public.fn_insert_pelamar_data_pribadi_pertanyaan(
- character varying,
- character varying,
- text,
- character varying,
- text,
- character varying)
- RETURNS character varying
- LANGUAGE 'plpgsql'
- COST 100
- VOLATILE PARALLEL UNSAFE
- AS $BODY$
- DECLARE r RECORD;
- DECLARE
- v_nik ALIAS FOR $1;
- v_kd_pert ALIAS FOR $2;
- v_nm_pert ALIAS FOR $3;
- v_jawaban ALIAS FOR $4;
- v_jwb_detail ALIAS FOR $5;
- v_nm_ins ALIAS FOR $6;
- rcd record;
- BEGIN
- select nik,kode_pertanyaan
- into rcd
- from hr_pelamar_pertanyaan_hasil
- where nik=v_nik and kode_pertanyaan=v_kd_pert;
- IF rcd.nik is not null THEN
- update hr_pelamar_pertanyaan_hasil set jawaban=v_jawaban,
- jawaban_detail=v_jwb_detail
- where nik=v_nik
- and kode_pertanyaan=v_kd_pert;
- return 'Update data pertanyaan pelamar berhasil';
- else
- INSERT INTO hr_pelamar_pertanyaan_hasil(nik,
- kode_pertanyaan,nama_pertanyaan,jawaban,jawaban_detail,nama_ins)
- values (v_nik,v_kd_pert,v_nm_pert,v_jawaban,v_jwb_detail,v_nm_ins);
- return 'Data pertanyaan pelamar berhasil dimasukkan';
- END IF;
- return null;
- /*
- select fn_insert_pelamar_data_pribadi_pertanyaan
- (v_nik,v_kd_pert,v_nm_pert,v_jawaban,v_jwb_detail,v_nm_ins)
- */
- END
- $BODY$;
- ALTER FUNCTION public.fn_insert_pelamar_data_pribadi_pertanyaan(character varying, character varying, text, character varying, text, character varying)
- OWNER TO postgres;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement