prueba tecnica
This commit is contained in:
15
db/06_CheckRateExists.sql
Normal file
15
db/06_CheckRateExists.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
DROP FUNCTION IF EXISTS public.check_rate_exists(INTEGER);
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.check_rate_exists(p_id INTEGER)
|
||||
RETURNS INTEGER
|
||||
AS $$
|
||||
SELECT CASE
|
||||
WHEN EXISTS (
|
||||
SELECT 1
|
||||
FROM public.rates
|
||||
WHERE id = p_id
|
||||
)
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
Reference in New Issue
Block a user