Using a SP in a DB2 Function
Posted on 2012-12-24
I have a stored procedure SP1 which returns the following result set.
ID1 CL_ID Link_ID1
123 ABC 234
333 DEF --
444 HIJ 567
Now, i want to create a UDF with V_ID as a parameter.
This will call this stored Procedure SP1 and pass the V_ID parameter against the result set, to filter for the Link_ID1.
So, if i pass the V_ID as 444 inside the UDF, then it should check for the Link_ID1 in the stored procedure. Since there is no match, it should return 444.
IF i pass 234 in the UDF, then it should look for the match of 234 and return ID1, which is 123.
Is there a way i can do it? Please advise.