All Forums General
TD_Raj 50 posts Joined 05/10
24 May 2013
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.

TD_Raj 50 posts Joined 05/10
27 May 2013

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

Harpreet Singh 101 posts Joined 10/11
27 May 2013

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

akhilkotak 4 posts Joined 10/13
04 Dec 2013

Hi TD_Raj,
I was wondering if you could post your solution for this.
Thanks,
Akhil

You must sign in to leave a comment.