0
votes

I ve checked this "SQLCODE=-104, SQLSTATE=42601" this Error code but still not able to find what wrong with above proc. I also execute the query and it worked fine. the below error I got when I run proc.
** SQLCODE=-104, SQLSTATE=42601, SQLERRMC=select Con_Gruop_Name from;t vparam = grpName; ;**

create OR REPLACE PROCEDURE getConGroup(in grpName varchar(100))
begin 
declare vparam varchar(100);
set vparam = grpName;
select Con_Gruop_Name from Grp_Table where Gruop_Name=vparam;
end
1
"where Gruop_Name=vparam" ? May be do you mean "where Group_Name=vparam;" - Esperento57

1 Answers

1
votes

1) verify Con_Gruop_Name and Gruop_Name is correct name, i suppose its Con_Group_Name and Group_Name

2) You can use parameter directly into your query

3) You must use cursor for return result select, like this

4) May be you should be add Library into your select " ... from yourlib.yourtable where ..."

CREATE PROCEDURE getConGroup (IN grpName varchar(100))
RESULT SETS 1
LANGUAGE SQL

P1: BEGIN

    DECLARE cursor1 CURSOR WITH RETURN FOR
    select Con_Gruop_Name from Grp_Table where Gruop_Name=grpName ;

    OPEN cursor1;
END P1