This content has been marked as final. Show 6 replies
i do not know what happens , i created a new form , then put a button , then i 've written this code in it , and i think it 's the same code , but no action happens , and no errors , nothing happens
x := Text_IO.Fopen('f:\new.txt', 'R');
1- i figured out that this "nothing happens" means that the file is opened , but sure i can not see it .
is this the ordinary thing ?
2- i am trying to use text_io.get_line , and it can read the first line of the .txt file , but there are two problems here :
1- i want to read a .xlsx file , and when i try to do so , i get something strange , it is not an error ,
it is "PK000" ,
my code is :
linebuf varchar2(90) ;
x := Text_IO.Fopen('f:\book1.xlsx ', 'R');
end if ;
i think it reads the line as encrypted or something because my first field in the excel sheet contains "h" charachter , nothing else .
second problem : i need to read the last record .
thanks a lot
1. ora-302000 usualy means that you have no permison to read the file or file doesn't exists.
2. xlsx file is a ZIP file in fact, and ZIP file signature starts always with two chars PK (initials of the inventor Phil Katz)
Edited by: kikolus on 2013-01-02 07:08
and ZIP file signature starts always with two chars PKwhy it reads the signature , not the file content , especially if the file is already opened ?
by the way , the situation is changed now . i saved my excel file in .csv format , and the code works fine with it , but
by big problem is : i need to read the very last record each time i press a button and assign the excel record to a record on my form ??? this is the big problem i am facing , how to read the last record and assign it to my form's record or to my database table , ??? then i can query it from my form .
can not i do this with "sql loader" ? can i restrict records with "sql loader" to get the latest record entered based on
sysdate for instance ?
Edited by: semsem on Dec 31, 2012 5:36 AM
Edited by: semsem on Dec 31, 2012 5:51 AM
why it reads the signature , not the file content , especially if the file is already opened ?
Cause file signature is a part of file :) .Try open *.xlsx file in any text editor (e.g. Notepad) then you'll see at first two position letters P and K
Regarding last row extraction: there is another your thread when I suggest to create external table from your file - try to use solution I wrote
Maybe you could provide the data-structure you get from the csv-file?