Importar txt sem ser pelo SQL Loader

Backup, Recover, Import, Export, Datapump, etc
Responder
targinosilveira
Rank: Programador Sênior
Rank: Programador Sênior
Mensagens: 45
Registrado em: Ter, 16 Set 2008 5:56 pm
Localização: Fortaleza - CE

Bom dia amigos, talvez essa pergunta já tenha sido feita anteriormente, através de tópicos anteriores encontrei como faço para importar arquivos pelo SQL Loader e funcionou perfeitamente, mas tenho um problema em usar o SQL Loader para fazer minhas próximas importações, é que a tabela precisa estar limpa e no caso quero apenas importar para acrescentar dados na minha tabela.

Tem como fazer isso pelo SQL Loader ou terei que usar lagum outro meiow

Atencipadamente agradeço qualquer responsta.

Targino Silveira

Informações do Ambiente:
Oracle 10g
Windows Server 2003
Avatar do usuário
dr_gori
Moderador
Moderador
Mensagens: 5024
Registrado em: Seg, 03 Mai 2004 3:08 pm
Localização: Portland, OR USA
Contato:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

É possível, mas vai ter que alterar o arquivo CTL.

http://esupport.csci.unt.edu/oracle/ser ... tm#1006863
Loading Data into Nonempty Tables

If the tables you are loading into already contain data, you have three options:

* APPEND

* REPLACE

* TRUNCATE
Aí vai um exemplo com APPEND:

Selecionar tudo

Example 2 Loading a Delimited, Free-Format File

CONTROL FILE - The control file for this example.

	        -- Variable-length, delimited and enclosed data format

	        LOAD DATA
	a.      INFILE *

	b.      APPEND

	        INTO TABLE emp
	c.      FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
	        (empno, ename, job, mgr,
	d.      	 hiredate DATE "DD-Month-YYYY",
	         sal, comm, deptno CHAR TERMINATED BY ':',
	         projno,
	e.      loadseq SEQUENCE(MAX,1))

	f.      BEGINDATA
	         7782, "CLARK", "Manager", 7839, 09-June-1981, 2572.50, 10:101
	         7839, "King", "President", , 17-January-1982, 920.00, 10:102

		---------------------------------------------------------------

NOTES:

(a) 	INFILE * signifies the data is found at the end of the control file.
(b) 	APPEND indicates that data may be loaded even if the table already contains rows; the table need not be empty.
(c) 	The default terminator for the data fields is a comma, and some fields may be enclosed by a double quote.
(d) 	The data to be loaded into column HIREDATE appears in the format DD-Month-YYYY.
(e) 	The SEQUENCE function is used to generate a unique value in the column LOADSEQ. This function finds the current maximum value in column LOADSEQ and adds the increment (1) to it to obtain the value for LOADSEQ for each row inserted.
(f) 	BEGINDATA signifies the end of the control information and the beginning of the data. 
targinosilveira
Rank: Programador Sênior
Rank: Programador Sênior
Mensagens: 45
Registrado em: Ter, 16 Set 2008 5:56 pm
Localização: Fortaleza - CE

Valeu dr_gori!!!

Funcionou corretamente.

Abraços!!
Responder
  • Informação
  • Quem está online

    Usuários navegando neste fórum: Nenhum usuário registrado e 12 visitantes