I am using below code to load the text file into table
But this code is not compling
There are a number of reasons why this will not work:
First, "INSERT INTO <tablename>" is not a valid statement, because there is nothing specified to insert into the table at all. If you haven't truncated your code before putting it here you have to correct that.
Second, i am not sure what your loop is supposed to do, but it definitely does soething else.
This loop has no input, because the read-command works differently from what you seem to suspect. If you want to read the file specified by variable "filename", do it like this:
Each line in "$filename" will then be assigned to "<variablename>" every turn. You can try this demo code to see how it works:
Next is: you specifiy "IFS", seemingly to split the input line into (comma-separated) pieces. But because you specify only one variable to "read" the whole line gets put into that variable anyway. The way you use it the IFS-specification is superfluous.
When you want to split the input line upon reading it you have to specify more than one variable to be assigned with the "read"-command. The first "field" (everything before the first IFS character) will be assigned the first variable, the second field (everything between the first and second IFS character) will be assigned the second variable and so on. If you specify less variables than there are fields all the remaining fields are getting crammed into the last variable specified. In your case that was everything.
Hi....can you guys help me out in this script??
Below is a portion text file and it contains these:
GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005675 000001... (1 Reply)
Hi all,
I have a data like,
0,R001,2,D
this wants to be loaded into a oracle database table.
Pl let me know how this has to be done.
Thanks in advance (2 Replies)
Hi Guys,
I'm new to this forum as well as to UNIX shell scripting.
I'm looking for a shellscript to query an Oracle database table and populate the result set of the query in a text file.
Could you someone help me out with a sample code?
Thanks,
Bhagat (7 Replies)
Hi All,
I need to BCP out a table into a text file along with the table headers. Normal BCP out command only bulk copies the data, and not the headers.
I am using the following command: bcp database1..table1 out file1.dat -c -t\| -b1000 -A8192 -Uuser -Ppassword -efile.dat.err
Regards,... (0 Replies)
Hi one help,
I need one procedure to load data from flat file to table. Table name as input parameter for the procedure. can anyone help me
Thanks,
Raj, (1 Reply)
Hi,
I have a text file say file1 having data like
ABC c:/hm/new1 Dir
DEF d:/ner/d sd
......
So i want to make a table from this text file, is it possible to do it using perl.
Thanks in advance
Sarbjit (1 Reply)
If you have a text file and if you want to Insert data to your Database Table, You can do it with these queries
LOAD DATA LOCAL INFILE '/path/yourTextFile.txt' INTO TABLE yourTableName
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n' (0 Replies)
hi ,
i need to create a bash shell script that insert a text data file into an html made table, this table output has to mailed.I am new to shell scripting and have a very minimum idea of shell scripting.
please help. (9 Replies)
Hi,
I have a pipe separated text file.
Can some someone tell me how to convert it to a table?
Text File contents.
|Activities|Status1|Status2|Status3|
||NA|$io_running2|$io_running3|
|Replication Status|NA|$running2|$running3|
||NA|$master2|$master3|... (1 Reply)