How to INPUT values from table into Stored Procedure

General
N/A

How to INPUT values from table into Stored Procedure

Hi Guys

I have created a Stored Procedure which do some string manipulation. Below is much simple version of actual string manipulation.

REPLACE PROCEDURE TST_PROC(IN VAL_TO_CHANGE VARCHAR(30), INOUT CHANGED_VAL VARCHAR(30))
BEGIN
SEL UPPER(VAL_TO_CHANGE) INTO CHANGED_VAL;
END;

And I can call the procedure

CALL TST_PROC('Testing Proc',CAST('' AS VARCHAR(30)))

However my requirement is ; instead of passing the static value, I want to pass a column in a table and whatever the output of Stored Procedure should come, the table column should be updated by that value.

Something like

CALL TST_PROC(LAST_NAME, CAST('' as VARCHAR(30)))

and the output of the stored procedure should be used to update the column LAST_NAME of the table CUSTOMER.

Something like

UPDATE CUSTOMER

set LAST_NAME=CALL TST_PROC(LAST_NAME, CAST('' as VARCHAR(30))) /* output value should be updated in table */

I understand syntactically above statements are wrong. And my approach may be not right. However I tried to explain the requirement.

Any inputs will be helpful.

Thanks in advance.

Tags (1)
3 REPLIES
N/A

Re: How to INPUT values from table into Stored Procedure

Hi Guys
I got this requirement working.
I used ref cursor and it worked fine.

Re: How to INPUT values from table into Stored Procedure

It will be great , if you share the solution here.

Re: How to INPUT values from table into Stored Procedure

Hi TD_Raj,

I was wondering if you could post your solution for this.

Thanks,

Akhil