【问题标题】:DBeaver not compiling a function that compiles using psql clientDBeaver 未编译使用 psql 客户端编译的函数
【发布时间】:2021-08-17 16:38:58
【问题描述】:

我可以使用 psql 客户端编译下一个函数。但是,DBeaver-ce 返回错误

SQL 错误 [42601]:未终止的美元报价开始于 SQL $$; 中的位置 0。预计终止 $$"。

为什么?

CREATE OR REPLACE FUNCTION numOf_icd10cm_4_snomed(oldCode TEXT)
RETURNS integer
LANGUAGE plpgsql
AS 
$$

-- This function returns the nunber of icd10cm codes matching oldCode in the table snomed2icd10

DECLARE
   quantity integer;  
BEGIN

   quantity := (select count(maptarget) 
             from 
                snomed2icd10
              where 
                 referencedcomponentid = oldCode
             );
    return quantity;

END;
$$;

【问题讨论】:

标签: postgresql plpgsql dbeaver dollar-quoting


【解决方案1】:

尝试将整个内容包含在 DbVis SQL block 中,使用 --/ 和 / 来包装 DDL(或 DML),即:

--/
CREATE OR REPLACE FUNCTION numOf_icd10cm_4_snomed(oldCode TEXT)
RETURNS integer
LANGUAGE plpgsql
AS 
$$

-- This function returns the nunber of icd10cm codes matching oldCode in the table snomed2icd10

DECLARE
   quantity integer;  
BEGIN

   quantity := (select count(maptarget) 
             from 
                snomed2icd10
              where 
                 referencedcomponentid = oldCode
             );
    return quantity;

END;
$$;
/

【讨论】:

    猜你喜欢
    • 2019-01-09
    • 1970-01-01
    • 1970-01-01
    • 2014-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-27
    • 2014-05-25
    相关资源
    最近更新 更多