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
-
1And what is the error you get?user330315– user3303152016年08月04日 13:30:13 +00:00Commented Aug 4, 2016 at 13:30
-
ERROR: syntax error at or near "language" SQL state: 42601Lina– Lina2016年08月04日 13:32:06 +00:00Commented Aug 4, 2016 at 13:32
1 Answer 1
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
answered Aug 4, 2016 at 13:41
Rémy Baron
1,4099 silver badges15 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-sql