3 Replies Latest reply on Nov 4, 2010 1:59 AM by 523861

    SP2-0552: Bind variable "INTARRAY" not declared.

    28026
      CAN ANYONE TELL ME WHY THIS GIVES THE BIND VARIABLE ERROR

      DECLARE

      BatchSize : constant := 50;
      subtype IndexRanges is INTEGER range 1 .. BatchSize;
      type IntArrays is array( IndexRanges) of INTEGER;
      IntArray : IntArrays;

      EXEC SQL DECLARE network_cursor CURSOR FOR

           select pal.provider_id from hold_provider_address_link pal;

      EXEC SQL OPEN network_cursor;

      -- establish a local block, with an exception to

      -- handle the "no data found" condition

      begin

      EXEC SQL WHENEVER NOT FOUND raise NO_MORE_DATA;

      FETCH_LOOP:

      loop -- fetch the data, 20 rows at a time

      EXEC SQL FETCH network_cursor

      INTO :IntArray;

      for I in 1..20 loop

      -- process batches of 20 rows

      ...

      end loop;
                          commit;
      end loop FETCH_LOOP;

      -- the exception NO_MORE_DATA is raised when there is

      -- no more data to FETCH

      exception

      when NO_MORE_DATA =>

      PUT("No more data to fetch. N of rows fetched was ");

      PUT(ORACLE.SQLROWS);

      NEW_LINE;

      -- turn off the error handling

      EXEC SQL WHENEVER NOT FOUND CONTINUE;

      end;
      /