Re: REF CURSOR

From: Dan Blum <tool_at_panix.com>
Date: Tue, 17 Jun 2008 14:14:09 +0000 (UTC)
Message-ID: <g38grh$n3i$1@reader2.panix.com>


Mtek <mtek_at_mtekusa.com> wrote:

> Hi,

> I may be answering my own question, but I want to make sure.

> Say I have a ref cursor that has a dynamic where clase, and in
> addition a bind variable that changes each time through the loop:

> OPEN cust_ref FOR
> 'SELECT customer_name, customer_address
> FROM customer
> WHERE customer_id = :v_customer_id'
> USING v_customer_id;

> My question is, since v_customer_id is a parameter, do I need to close
> and open the cursor each time that value changes? Or can I just
> change the value and fetch the next record?

You need to close and open the cursor.

Actually, I suspect that what you really need to do is not use a cursor here. Are there multiple records per customer_id? If not, I see no need for an explicit cursor.

-- 
_______________________________________________________________________
Dan Blum					         tool_at_panix.com	
"I wouldn't have believed it myself if I hadn't just made it up."
Received on Tue Jun 17 2008 - 09:14:09 CDT

Original text of this message