Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Adrian, Nov 09, 2017
- * Untuk mendapatkan flag warranty so item
- */
- CREATE OR REPLACE FUNCTION f_get_flag_warranty_for_so_id(bigint)
- RETURNS numeric AS
- $BODY$
- DECLARE
- pMasterId alias for $1; --so_item_id
- vResult numeric;
- BEGIN
- vResult := 0;
- WITH tt_count_so_warranty_item AS (
- SELECT COUNT(*) AS warranty_count
- FROM sl_so_warranty_item
- WHERE so_item_id = pMasterId
- )
- SELECT
- CASE WHEN warranty_count = 0 THEN
- 'N'
- ELSE
- 'Y'
- END IF
- INTO vResult
- FROM tt_count_so_warranty_item;
- return vResult;
- END;
- $BODY$
- LANGUAGE plpgsql VOLATILE
- COST 100;
- /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement