Ref Cursor Question

From: Mtek <mtek_at_mtekusa.com>
Date: Fri, 12 Sep 2008 12:36:18 -0700 (PDT)
Message-ID: <80885bc7-b3ab-4682-ada5-3f13297664d6@d77g2000hsb.googlegroups.com>


Hi,

I'm new to ref cursors. Please look at this:

TYPE select_cursor IS REF CURSOR;
v_data_crs SELECT_CURSOR;
v_data_rec DATA_CRS%ROWTYPE;

   IF p_daily_pass = 'N' THEN

      OPEN v_data_crs FOR
       'SELECT p.code, p.type, p.subproduct_id, NULL
        FROM order_line ol, product p
        WHERE ol.product_id    = p.product_id
          AND ol.order_item_id = :p_order_item_id'
        USING p_order_item_id;
   ELSE
      OPEN v_data_crs FOR
       'SELECT p.code, p.type, p.subproduct_id, co.customer_id
        FROM product.newsletter_subscr_features ns, product p,
order_line ol, customer_order co
        WHERE is_daily_pass = ''Yes''
          AND autorenew = ''No''
          AND ns.code = p.code
          AND p.product_id = ol.product_id
          AND ol.order_id = co.order_id'
          AND ol.status IN ('Active','Pending');
   END IF; FETCH v_data_crs INTO v_data_rec;
.
.
.

What is wrong here? I'm going to open up a number of possible cursors based on some parameters. So, I thought you define the cursor, then define a type of that ref cursor, then you can define a a row of that......

Probably pretty simple what I ask.......but help is appreciated. Received on Fri Sep 12 2008 - 14:36:18 CDT

Original text of this message