Re: Oracle 8 Pro*C cursor problem

From: Heath & Sharmelle Wickman <hswick_at_home.com>
Date: Fri, 16 Mar 2001 05:14:45 GMT
Message-ID: <9jhs6.168550$bb.1620278_at_news1.rdc1.tx.home.com>


[Quoted] You don't need to declare your cursor in your oracle declare section. Try [Quoted] something like the following. This works on v.8.0.6 You also don't need to declare your host variables in the oracle declare section; I'm not sure which version changed that.

EXEC SQL DECLARE orders_tms_cursor CURSOR FOR  SELECT ord_id,

          min(ord_tote_tms) "firstorder"    FROM ord_tote
   WHERE ord_tote_stat_cd IN (:or_szTote_Stat_Onway, :or_szTote_Stat_Recirc)    AND ord_id NOT in

      (SELECT DISTINCT ord_id FROM pack_lane_ord WHERE ord_id IS NOT NULL)    GROUP BY ord_id
[Quoted]    ORDER BY "firstorder";

 EXEC SQL OPEN orders_tms_cursor;

 EXEC SQL FETCH orders_tms_cursor

         INTO :or_ord_tote.ord_id;

EXEC SQL CLOSE orders_tms_cursor;

"Mark Heiple" <markh_at_xetron.com> wrote in message news:markh-AF941E.16101415032001_at_news.xetron.com...
> I am trying to use a cursor from inside a Pro*C program and can't get it
> to compile. I took the cursor sample right out the Oracle docs:
>
> EXEC SQL BEGIN DECLARE SECTION;
> SQL_CURSOR emp_cursor;
> int dept_num;
> EXEC SQL END DECLARE SECTION;
>
> EXEC SQL ALLOCATE :emp_cursor;
>
> EXEC SQL EXECUTE
> BEGIN
> OPEN :emp_cursor FOR SELECT ENAME FROM emp
> WHERE deptno = :dept_num;
> END;
> END_EXEC;
>
> Error at line 95, column 14 in file sample.pc
> WHERE deptno = :dept_num;
> ............1
> PLS-S-00201, identifier 'EMP' must be declared
>
> Why won't this compile? Why does it think EMP is an identifier? It's
> not, it is a table. Thanks.
Received on Fri Mar 16 2001 - 06:14:45 CET

Original text of this message