Lina
Lina

Reputation: 315

postgresql function creation error

I am trying to create the function in PostgreSQL using PGAdmin tool but it giving me syntax error. I am mentioning the function below.

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';

it gives me following Error

ERROR: syntax error at or near "language"

SQL state: 42601

Upvotes: 0

Views: 43

Answers (1)

Rémy  Baron
Rémy Baron

Reputation: 1399

it's because you don't create body of your function between "as" and "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

Upvotes: 1

Related Questions