Home » Developer & Programmer » Forms » insert data to table from file
insert data to table from file [message #87185] Mon, 13 December 2004 02:29 Go to next message
S. Sathish Kumar
Messages: 11
Registered: October 2004
Junior Member
i have a table and a text file. I want to insert the datas into the table(temp_tab) from the file(data.txt)

How to to this, i have given example table and text file

create table temp_tab(sno number,
cus_name varchar2(100));

data.txt

1 sathish
2 nataraj

With regards

S. Sathish Kumar
Re: insert data to table from file [message #87199 is a reply to message #87185] Mon, 13 December 2004 23:24 Go to previous messageGo to next message
Niranjan
Messages: 34
Registered: June 2001
Member
use the package utl_file. it has got some procedures and functions like

utl_file.fopen(),fread(),fclose() and all.

otherwise u can go for SQL * LOADER to load data from file to the table.
Hope that helps.
Re: insert data to table from file [message #87215 is a reply to message #87185] Tue, 14 December 2004 07:28 Go to previous messageGo to next message
Matloob Ali
Messages: 19
Registered: December 2004
Junior Member
i have not used the package but the whay by which i have loaded the data is quite simple
there r some stepd included

Note:
*** but be shure that ur data fields are seprated with any operater for eg (,) as
*** as described below in exp.

--- save ur text file with extention of .CTL
--- and write down the script in the file
as requirment i have made it as ur requirment

LOAD DATA
INFILE *
APPEND INTO TABLE temp_tab
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED '"'
(sno,cus_name)
BEGINDATA
1,sathish
2,nataraj
--- save the file open a command prompt
--- use the following command to load CTL file
its a utility called sql loader
sqlldr80 scotttiger control=(path of control file which u have made)
log = (path where log file will be saved)
it will tell u that how much rows are affected

Take care
Matloob Ali Raza
Re: insert data to table from file [message #87298 is a reply to message #87215] Thu, 16 December 2004 19:07 Go to previous messageGo to next message
S. Sathish Kumar
Messages: 11
Registered: October 2004
Junior Member
Thank you very much Matloob Ali

S. Sathish Kumar
Re: insert data to table from file [message #87299 is a reply to message #87199] Thu, 16 December 2004 19:09 Go to previous messageGo to next message
S. Sathish Kumar
Messages: 11
Registered: October 2004
Junior Member
Thank you very much niranjan

with regards
S. Sathish Kumar
Re: insert data to table from file [message #87314 is a reply to message #87185] Fri, 17 December 2004 03:52 Go to previous messageGo to next message
Matloob Ali
Messages: 19
Registered: December 2004
Junior Member
no problem dood u r most welcome
Transfer of Log files into a table [message #87598 is a reply to message #87215] Wed, 19 January 2005 21:51 Go to previous messageGo to next message
VENKATARAMAN
Messages: 1
Registered: January 2005
Junior Member
Hi

We have some process which creates logs for each and every step. Some log may be static and some may be dynamic.Static meaning no physical updation but dynamic meaning if we do some updates, insertes etc.

Basically at a time one process will start and that process generates some text log files. Now we have to convert the text logfiles into Tables.I have created a table but what i need is how to bring log files into the table using plsql.So far what i was doing is that send the complete log file to the user/Support. But now i have decided to create a table by segregating log files as which logs to whom.For Ex Step1 is static which should go for both.

I need in the same procedure how to pass values for dynamic process.

I have an template which i'm copying as follows

Procedure Name ( [[in]] var datatype, [[out]] var datatype )
Begin
step 1
Ex. The process has started - static

step 2
Insert
Insert --- Dynamic
.
step n
End

Based on the above please provide me an plsql algorithm or procedure.

with thanks and regards
LAKSHMI
Re: Transfer of Log files into a table [message #87604 is a reply to message #87598] Thu, 20 January 2005 06:52 Go to previous message
Matloob
Messages: 39
Registered: December 2004
Member
for that u have to use packages i think soo i have to find them out first then i wil tell u inthe while if u get any solution do provide me some information
Previous Topic: desinger migration
Next Topic: How can I solve it?
Goto Forum:
  


Current Time: Mon Sep 16 13:10:00 CDT 2024