CREATE OR REPLACE FUNCTION sp_mar_po_public( character varying, bpcahar, integer, ....refcursor)
RETURNS refcursor AS
$BODY$
DECLARE
current_cd_seq character varying;
INTO next_id_var character varying;
BEGIN
IF $1='SELECT' THEN
BEGIN
IF $2 = 'mar_wo' THEN
Select * from mst_employee into current_cd_seq;
END IF;
Return ”Berhasil”;
END;
ELSEIF $1='INSERT' THEN
BEGIN
IF $2 = 'mst_customer' THEN
SELECT * FROM sp_autoincrement
sp_autoincrement('mst_customer','cd_customer',5) INTO next_id_var;
INSERT INTO
mst_customer(cd_customer,name,address)
VALUSE (next_id_var, ”hendi”,”situ gunting”);
RETURN ”berhasil”;
END
END IF;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION sp_mar_po_public (character varying, bpcahar, integer, ....refcursor)
Kamis, 02 April 2009
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar