This is my function:
CREATE OR REPLACE FUNCTION public.func_leonard_test2(
IN url text,
OUT translation text)
RETURNS text AS
$BODY$BEGIN
DECLARE tempo text;
SELECT CONCAT(translate,'=true') INTO tempo FROM seo_content WHERE name=url;
CASE
WHEN tempo = 'location_town' THEN
SET translation = 'A';
ELSE
SET translation = 'B';
END CASE;
END;$BODY$
I'm having trouble declaring tempo.
This is the output:
ERROR: invalid type name "CONCAT(translate,'=true') INTO tempo FROM seo_content WHERE name"
Even when I remove concat and I just keep translate, I get
ERROR: invalid type name "translate INTO tempo FROM seo_content WHERE name"
Thanks
答案 0 :(得分:0)
try this:
CREATE OR REPLACE FUNCTION public.func_leonard_test2(
IN url text,
OUT translation text)
RETURNS text AS
$BODY$
DECLARE tempo text;
BEGIN
SELECT CONCAT(translate,'=true') INTO tempo FROM seo_content WHERE "name"=url;
CASE
WHEN tempo = 'location_town' THEN
translation := 'A';
ELSE
translation := 'B';
END CASE;
END;$BODY$ language plpgsql;