insert data to table from file [message #87185] |
Mon, 13 December 2004 02:29 |
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 |
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 |
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
|
|
|
|
|
|
Transfer of Log files into a table [message #87598 is a reply to message #87215] |
Wed, 19 January 2005 21:51 |
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
|
|
|
|