uploading text_file to oracle database [message #262460] |
Mon, 27 August 2007 02:06 |
gauravsunil
Messages: 68 Registered: August 2007 Location: bhubaneswar
|
Member |
|
|
Hi all,
I am using SQL+ editor.
I want to upload a text file from my desktop and put into a column of the table.
Is it possible ? If yes then whats the querry for it?
Thanks and Regards
Sunil Gaurav
|
|
|
|
|
Re: uploading text_file to oracle database [message #262480 is a reply to message #262460] |
Mon, 27 August 2007 03:26 |
muzahid
Messages: 281 Registered: September 2004 Location: Dhaka, Bangladesh
|
Senior Member |
|
|
Use BFile data type and follow the following steps
CREATE DIRECTORY DIR1 AS 'd:\data'
CREATE TABLE filetable(id NUMBER(6),filename bfile)
INSERT INTO filetable VALUES (1,BFILENAME('DIR1','filename'));
|
|
|
Re: uploading text_file to oracle database [message #262491 is a reply to message #262480] |
Mon, 27 August 2007 04:01 |
gauravsunil
Messages: 68 Registered: August 2007 Location: bhubaneswar
|
Member |
|
|
But I m not able to see the content of the file here.
CREATE DIRECTORY DIR1 AS 'd:\data';
CREATE TABLE filetable(id NUMBER(6),filename bfile);
INSERT INTO filetable VALUES (1,BFILENAME('DIR1','sunil.dat'));
select * from filetable;
output i am getting is...
ID FILENAME
---------------------- --------------------------
1
|
|
|
|
|
|
|
|
|
|
|
|
Re: uploading text_file to oracle database [message #262550 is a reply to message #262542] |
Mon, 27 August 2007 08:10 |
gauravsunil
Messages: 68 Registered: August 2007 Location: bhubaneswar
|
Member |
|
|
Getting error with this code:
load data
infile 'd:\sunil.csv'
into table scott.emp
fields terminated by "," optionally enclosed by '"'
( EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO);
The error informations are:...
Error starting at line 1 in command:
load data
Error report:
Unknown Command
Error starting at line 2 in command:
infile 'd:\sunil.csv'
Error report:
Unknown Command
Error starting at line 3 in command:
into table scott.emp
Error report:
Unknown Command
Error starting at line 4 in command:
fields terminated by "," optionally enclosed by '"'
Error report:
Unknown Command
Error starting at line 5 in command:
( EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO)
Error at Command Line:1 Column:2
Error report:
SQL Error: ORA-00928: missing SELECT keyword
Regards
Sunil Gaurav
|
|
|
|
|