We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

SMadhavi
SMadhavi asked
on
Medium Priority
977 Views
Last Modified: 2007-12-19
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
Comment
Watch Question

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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.