postgresql函数创建错误

时间:2016-08-04 13:24:10

标签: postgresql

我正在尝试使用PGAdmin工具在PostgreSQL中创建该函数,但它给了我语法错误。我提到下面的功能。

create or replace FUNCTION "QTYONHOLDORLOCKOR" (
    M_Product_ID numeric, M_Warehouse_ID numeric,
    M_Locator_ID numeric, LocatorType character varying
) RETURNS numeric as language java
NAME org.compare.sqlj.Product.bomQtyOnHold(int,int,int,java.lang.String) return java.math.BigDecimal';

它让我跟随错误

ERROR: syntax error at or near "language"

SQL状态:42601

1 个答案:

答案 0 :(得分:1)

这是因为你没有在“as”和“language”

之间创建你的函数体
 create or replace FUNCTION "QTYONHOLDORLOCKOR" (
      M_Product_ID numeric, M_Warehouse_ID numeric,
      M_Locator_ID numeric, LocatorType character varying
  ) RETURNS numeric as 
       $BODY$
            // Your java code here
            return 1;
       $BODY$ 
  language java