Oracle stored Procedure (P1 in numeric, p2 out varchar)

Hi

I need to create an oracle stored procedure with 2 parameters
p1 and p2
P1 is input parameter of type numeric
p2 is output character of type varchar2(200)


My select statement is
select Field1 from table1 where field2 =:P1

This select statement will return more than 2 values

I need to loop through this two values concatnate the 2 or more values returned and send it out as an output parameter.

I tried creating a cursor and then looping through am not able to get the procedure to work.

Could any one please help.

Thanks

Madhavi
SMadhaviAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Harish_RajaniCommented:
You Can create a procedure in following lines :



CREATE OR REPLACE PROCEDURE  MY_TEST_PROC (Field1 IN NUMBER, Field2 OUT VARCHAR2)
AS
CURSOR My_Cursor(X Number)
IS
SELECT employee_name FROM emp
WHERE  employee_id >= X;

bigstring VARCHAR2(2000);

BEGIN

FOR recX IN My_Cursor(Field1)
LOOP
bigstring := bigstring||recX.employee_name;
END LOOP;

Filed2 :=bigstring;

END MY_TEST_PROC;

Rgds,
HR
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.