Unable to run script
Posted: Tue  17 Oct 2017 17:47
				
				Hello,
I am using ODAC version 9.7.26 on C++Builder 6.0 Professional edition.
I am attempting to run the script bellow which I have added it first to a TOraSQL component using parameters and second to a TOraScript using macros, but none of the alternatives were successful.
Where is the correct position to place a macro or a parameter to run a Script on ODAC components, using SQLDeveloper I can run it.
Thank you very much.
			I am using ODAC version 9.7.26 on C++Builder 6.0 Professional edition.
I am attempting to run the script bellow which I have added it first to a TOraSQL component using parameters and second to a TOraScript using macros, but none of the alternatives were successful.
Code: Select all
"DECLARE \
 -- data a excluir  \
 day DATE := null; \
 nrec     INTEGER := 0;  \
 -- Cursor para identificar o rowid (endereco unico) a ser limpo na tabela  \
 -- Rowid seria um endereco unico que localiza o registro na instancia dados  \
 CURSOR CV_LIMPEZA IS \
     SELECT ROWID      \
     FROM SAM.HST_HOL_15MIN \
     WHERE DATAHORA >= day \
     AND   DATAHORA <= day +1 ; \
 -- Estou criando uma especie de array aqui  \
 TYPE TP_ROWID IS TABLE OF CHAR(18);  \
 RY_ROWID      TP_ROWID; \
BEGIN  \
  day := TO_DATE(&DTDEL , \'YYYY-MM-DD\'); \
  -- Abrindo cursor \
  OPEN CV_LIMPEZA; \
  -- Loop de limpeza principal  \
  LOOP \
     -- Carregando no array 50000 registros (enderecos rowid) \
     FETCH  CV_LIMPEZA BULK COLLECT INTO RY_ROWID LIMIT 50000; \
     -- Se chegou ao final do cursor, sai do LOOP    \
     EXIT WHEN CV_LIMPEZA%NOTFOUND;  \
     -- Comando FORALL para limpeza massiva dos registros  \
	 BEGIN  \
	   FORALL I IN 1..RY_ROWID.COUNT \
			 DELETE FROM SAM.HST_HOL_15MIN WHERE ROWID = RY_ROWID(I); \
		nrec := nrec + SQL%ROWCOUNT;  \
	 EXCEPTION   \
	   WHEN OTHERS THEN \
		   ROLLBACK;  \
		   RAISE;  \
	 END;  \
     COMMIT; \
   END LOOP; \
   -- Fechando o cursor \
   CLOSE CV_LIMPEZA; \
   --DBMS_OUTPUT.PUT_LINE(nrec|| ' registros excluidos.'); \
END;"
Thank you very much.