简体   繁体   English

Informatica Pre SQL删除索引

[英]Informatica pre sql to drop an index

I am trying to load 2 million records into a oracle table using the Oracle external loader in Informatica. 我正在尝试使用Informatica中的Oracle外部加载器将200万条记录加载到oracle表中。 In order to load the data, I am trying to drop the index on the table and re create after the data is loaded. 为了加载数据,我试图在表上删除索引并在数据加载后重新创建。 I am using the below anonymous block in the pre SQL in mapping for the target: 我在映射前的目标SQL中使用下面的匿名块:

Declare indxcnt int\;

 BEGIN

  SELECT COUNT(INDEX_NAME) 
  INTO indxcnt 
  FROM all_INDEXES WHERE INDEX_NAME  = 'TEST_INDEX1'\;

  IF indxcnt > 0 THEN
     Execute Immediate 'DROP INDEX TEST_INDEX1'\;
  END If \;
 END\;

However the pre SQL is not working and as the index is not getting dropped. 但是,pre SQL无法正常工作,并且索引也不会丢失。

When I use the same anonymous block in the session properties using the relation writer, it is working fine. 当我使用关系编写器在会话属性中使用相同的匿名块时,它工作正常。

Kindly help me how to drop and re create the index while using the loader to load the table. 请帮助我如何在使用加载程序加载表的同时删除并重新创建索引。

At the end of the software you want to execute. 在要执行的软件末尾。 You can do it by /: 您可以通过/:

This is in PL/SQL. 这在PL / SQL中。 I don't know informatica but perhaps this could help you. 我不知道informatica,但这也许可以为您提供帮助。

DECLARE 
  indxcnt NUMBER;
BEGIN
  --
  SELECT COUNT(INDEX_NAME) 
  INTO indxcnt 
  FROM all_indexes WHERE index_name = 'TEST_INDEX1';
  --
  IF indxcnt > 0 
  THEN
    EXECUTE IMMEDIATE 'DROP INDEX TEST_INDEX1';
  END IF;
END;
/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM