数据库函数给出错误 - Postgresql [英] Database Function giving an error - Postgresql

查看:40
本文介绍了数据库函数给出错误 - Postgresql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I had some help on here and got the following code:

-- Setup Solrid Function
CREATE OR REPLACE FUNCTION solrid(IN local_id INTEGER, OUT result TEXT) AS $$
DECLARE
  database_id TEXT := 'A';
BEGIN
  result := database_id || local_id::TEXT;
END;
$$ LANGUAGE PLPGSQL;

However when I run it in sqlfiddle it says:

Schema Creation Failed: ERROR: unterminated dollar-quoted string at or near "$$ DECLARE database_id TEXT := 'A'":

This error may seem pretty self explanatory but I can't figure out the way to fix it. Would anyone mind shedding some light on this please?

解决方案

There is absolutely nothing wrong with this function, it is 100 % legit. I tested with 8.4 and 9.1 in my installation.

There must be some kind of misunderstanding. This cannot be exactly the same code that triggers the error message.

这篇关于数据库函数给出错误 - Postgresql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆