This content has been marked as final. Show 3 replies
I think, in your case is better to run a unix command that will insert those rows in oracle, connecting to oracle.
Another ideea is to ouput the result of df command to a file (with -T parameter i think) and read that file from oracle job.
Reading is something like :
f := utl_file.fopen('SAMPLEDATA','sample1.txt','R');
but you can find more on this forum.
anonymous block completed
I wonder how to write the content to a table from the utl_file.get_line(f,s);
In s varchar you will have the line from the file.
If the content is a comma separated value as: 'field1, field2, field3,..etc' you can use a split function to take the parts (are examples on web), or, if they are only few, even play with subtr/instr functions.
this code will give you the first and second item for example:
substr(notParsedText,0,instr(notParsedText,',')-1) as firstitem,
substr(notParsedText,instr(notParsedText,',',1)+1,instr(notParsedText,',',2)-1) as seconditem
(select '1,2,3,4,5' as notParsedText from dual)
you can have an isert into your table with select like the one above.
As an example
insert into test
substr(s,0,instr(s,',')-1) as firstitem,
substr(s,instr(s,',',1)+1,instr(s,',',2)-1) as seconditem