4 Replies Latest reply: Feb 17, 2014 8:58 AM by Byron Van Wyk RSS

    Creating temporary tables

    Márcio Rodrigo Campestrini

      Hi!


      I have this part of my load script. I'm trying to create multiple QVD files based on a SQL query. Everything seems to work, but the commands inside the FOR...NEXT loop. QV doesn't create the table "NotaFiscal", but stores at NTF table.

       

      NTF:

      Select NRNFSC,
             SRNOTA,
             to_date(DTEMIS, 'yyyymmdd') DTEMIS,
             to_date(DTSAID, 'yyyymmdd') DTSAID From rch0090
      Where  to_date(dtemis, 'yyyymmdd') >= to_date('01-jan-$(minYearOfLoadingBills)');

      FOR varYear = $(minYearOfLoadingBills) TO year(today())
         NotaFiscal:
        
      LOAD  *
        resident  NTF WHERE Year(DTEMIS) = $(varYear);
        
      STORE     NotaFiscal INTO $(Root)\qvd\rch0090_$(varYear).qvd (qvd);
      NEXT;
      Drop table NotaFiscal;
      Drop table
      NTF;

       

      Variable minYearOfLoadingBills has value = 2013.

       

      Anyone can help me?