2016-08-04 116 views
0

我想使用PGAdmin工具在PostgreSQL中创建函数,但它给我语法错误。我提到下面的功能。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

错误:处于或接近“语言”的语法错误 SQL状态:42601 – Lina

回答

1

,那是因为你没有创建与你的函数体 “是” 和 “语言”

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