Fetch data from text file to print
Dear All,
I am trying to fetch data from a text file in to Oracle database to print.
The problem I have is that I cannot gather data because this is a statement, generated by a report utility and the data consist of multiple dimensions.
First 3 fields of data are in the first 3 rows of a page and the rest is displayed column wise for the next 20 rows (5th row to 24th Row). Then there is a page break character ASCII (012) (Hex - 0C)then the next record starts.
Please give me a solution to fetch first 3 lines to one master table & the column of data to a detail table.
I konw I can fetch data using SQL Loader but the problem is how can I seperate multiple dimention data.
Sample
<page breake>
Code:123456
Name:1233445566
Address:aaaaaaaaaaaaa
Detail1 Detail2 Detail3
======= ======= =======
AAAAAAA BBBBBBB CCCCCCC
AAAAAAA BBBBBBB CCCCCCC
<page break>
Code:123457
Name:AAAAAAAA
Address:AAAAAAAA
Detail1 Detail2 Detail3
======= ======= =======
AAAAAAA BBBBBBB CCCCCCC
AAAAAAA BBBBBBB CCCCCCC
<page break>
Thank you in advance..
Regards, Shaamil.
Try using the package UTL_FILE.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#998101
Similar Messages
-
Cant get data from text file to print into Jtable
Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
String hold;
try {
File f = new File("customer.txt");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
Vector dataVector = new Vector();
Vector headVector = new Vector(2);
Vector row = new Vector();
// read the record of the text database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
while (st.hasMoreTokens()) {
row.addElement(st.nextToken());
System.out.println("Inside nested loop: " + row);
System.out.println("inside loop: " + row);
dataVector.addElement(row);
System.out.println("outside loop: " + row);
headVector.addElement("Title");
headVector.addElement("Type");
dataTable = new JTable(dataVector, headVector);
dataTableScrollPane.setViewportView(dataTable);
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
} // end if
} // end finally
} // end dbTestHere's a thread that loads a text file into a JTable:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
And my reply in this thread shows how you can use a text file as a simple database:
http://forum.java.sun.com/thread.jsp?forum=31&thread=342380 -
Unable to find file error while loading data from text file to Oracle
Hi,
I am having a interface where i am loading a data of Text file to Oracle.
But when i am trying to do this i am getting following error.
ODI-1227: Task SrcSet0 (Loading) fails on the source FILE connection SAPMM.
Caused By: java.sql.SQLException: File not found: d:/mdb/#General.get_filename
at com.sunopsis.jdbc.driver.file.FileResultSet.<init>(FileResultSet.java:160)
at com.sunopsis.jdbc.driver.file.impl.commands.CommandSelect.execute(CommandSelect.java:57)
at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
SAPMM is connection name.
I am using get_filename to get the filename and it is fetching correct value as the this variable refreshes in previous step of this interface.
KM used for loading is File to SQL
What would be cause of this error?
Thanks,
MaheshHi,
Did a testing and following are the result
I have
A> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Execution of Interface which gets the file name from v_filename and load into target table
Package executes successfully.
B> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Scenario of Interface which gets the file name from v_filename and load into target table
Package executes with erre as it is not able to find the file
C> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Execution of Interface which gets the file name from v_filename and load into target table
4. Now create a scenario of the package , use the generated scenario in another package say main_package
Execution of main_package is successful.
Thanks,
Sutirtha -
Loading data from text file into ListBox
I have data in a text file that I want to load into a
listbox... I have fully mastered handling strings and arrays so I'm
going to need some help...
I was wondering how do I get flash to load a text file that
contains the data below.. and display it line for line like I want
it to list down the component
"Launch;7.1.7.6"
"Engine;7.1.7.6"
"OSX;7.0.0.2" (or something close to that)
and I was wondering how do i just get it to take it fromt he
file.. line for line from where it says exeversion in the file and
list it in the listbox...
I'm really thankful to anybody that helps.
Data in text file:
quote:
exeversion=Launch;7.1.7.6;
exeversion=Engine;7.1.7.6;
exeversion=LinuxX86;7.0.0.2;
exeversion=LinuxPPC;7.0.0.2;
exeversion=LinuxMIPS;7.0.0.2;
exeversion=OSX;7.0.0.2;
exeversion=Config;7.1.7.6;
exeversion=UI;7.1.7.7;
exeversion=JAVA;7.0.4.5;nobody cna help me? i really need to know or have a tutorial
or something so i can learn from it... i really appreciate anyone
who helps -
Charting data from text file in LabVIEW 5.1 for Windows
I am having some difficulties trying to figure out how to plot a chart with
data from a file. I would like to be able to read data from a text file
into a chart using LabVIEW 5.1 for Windows. I have looked in the help
within the program and online. I have also looked in the user manual and
the book "LabVIEW for Everyone". Could you please give me specific
instructions on how I would construct the program to be able to do this.
Thank you.Hi Ellie,
It depends on how data is stored in that txt file. Usually you load the data into an array either using or , the array if necessary and send it to the graph indicator in required form. If you want a more detailed answer, send me a sample data file ([email protected]). -
HOW to retrieve PURCHASE ORDER DATA from archieve file and print a report
Dear all
1) I have retrieve purchase order data from archived files.
2) print purchase order data and created pdf file.
VIJ.............
Moderator message - Please ask a specific question - post locked
Edited by: Rob Burbank on Apr 28, 2009 12:00 PMDear all
1) I have retrieve purchase order data from archived files.
2) print purchase order data and created pdf file.
VIJ.............
Moderator message - Please ask a specific question - post locked
Edited by: Rob Burbank on Apr 28, 2009 12:00 PM -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
To fetch data from Primavera files
Hi all,
I would like to fetch data
available in Primavera P3 Planner and save it to SQL
database table.
We can fetch data
from MS Project files using VB.NET.So,in a similar way how
can i fetch data from Primavera P3 Planner.<br
/>
Looking forward to an early reply.<br
/>
Thanks in advanceHi all,
I would like to fetch data
available in Primavera P3 Planner and save it to SQL
database table.
We can fetch data
from MS Project files using VB.NET.So,in a similar way how
can i fetch data from Primavera P3 Planner.<br
/>
Looking forward to an early reply.<br
/>
Thanks in advance -
Using Query to fetch data from xml file
Hi guys ,
Just want to know , how to fetch data from an XML file in adobe flex? i have a database generated xml file.you can use httpService.
-
CO-PA load data from text file
Hello
At present, in our company, we load data from Excel files to CO-PA. Is there any way to load those data to CO-PA from text files ?
I will be grateful for any suggestions.You can create a structure using KEFA, assign the Value fields in KEFB and then use KEFC to upload data against that structure.
You have various file format options, but I don't think Excel is one of them... you have have to save the file as txt and upload.
Play around with those transactions and come back if you need additional help.
Cheers. -
Unable to Upload data from text file into BEx Analyzer selection screen
Hi,
No response from BEx Analyzer when I am trying to upload around 40,000 material from text file into BEx Analyzer selection screen using "Upload selections" options. But I am able to upload only 10,000 material from text file. I never faced same kind of issue when I am using BEx Analyzer 3.x. Please let me know I have to change any settings related to BEx or any other.
Thanks
Sri Krishna Ponnada.Hello
It seems you are reaching the .NET memory limitation informed in note 1040454.
Because 3.5 does not use .NET it can work that.
Regards,
Ricardo -
Remove duplicates while loading data from text file
Hi,
Data in text file (some times has duplicates) is being loaded into Oracle 9i database using Informatica. To improve performance, we would like to remove duplicates at the time of each load using Oracle procedure. Could you please help me with this?
Thanks,
LakshmiNo, our table doesn't have that. Most of the functionality is managed at the informatica level. Is there any other way? Thanks,
-
Hi Gurus,
This seems to be a regular task, and I have recieved suggestions from my coleagues too.
I am not an ABAP consultant, so unable to decide all alone.
This is the sceanario,
I have a text file, which contains trace of application server. Data from this flat file must be fetched on a daily basis and should be updated in a custom table, so that I can generate some application displaying the trace info.
I was suggested to use OPEN_DATASET and CLOSE_DATASET, which requires file to be under application server's root.
I thought that is a easy and better way, but BASIS consultant is not willing. He has his own concers which are valid. If the trace files were not removed as soon as they are read, they are going to hand the server in cource of time.
Anyway, my plan is to have only one file there, but seems like convincing the BASIS is diffucult task. I am looking for alternates here.., and FTP came into my mind. But I have a doubt about using it in a background task, that is scheduled to run once a day..
And it will be greate if I can get some more suggestions...
Thanks and regards,
ChinnuHi Chinnu,
See the given link, It may help you.
Re: how to Get Data from AL11
Regards,
Shamma -
Error while loading the data from text file
Hi,
I got an error " Data Value Encountered before all Dimensions selected" while loading the data from the text file.
Can any one please suggest me the solution.Possible Solutions
Make sure that the data source is valid.
Is a member from each dimension specified correctly in the data source or rules file?
Is the numeric data field at the end of the record? If not, move the numeric data field in the data source or move the numeric data field in the rules file.
Are all members that might contain numbers (such as "100") enclosed in quotation marks in the data source?
If you are using a header, is the header set up correctly? Remember that you can add missing dimension names to the header.
Does the data source contain extra spaces or tabs?
Has the updated outline been saved? -
Hi there,
I am having a real battle trying to delete data from a text file I am using. There seems to be this giant cloud with Java, where there is no real easy way to delete text from a file??
I have a JFrame with two textfields on it where you enter the username and pcname. There is a OK button once you have entered those details.
On action event I would like those two details, to be removed from the text file that has been read in.
I have a text file like this:
bob
pc1
bill
pc2
The data above gets written no problem, one at at a time using the below.
File f = new File("\\c:\\filename.txt");
String strToWrite;
try
FileOutputStream fstr = new FileOutputStream(f);
strToWrite = username1+ '\r'+'\n' ;
byte[] bytes = strToWrite.getBytes(); fstr.write(bytes);
strToWrite = pcname1 + '\r'+'\n' ;
byte[] bytes2 = strToWrite.getBytes(); fstr.write(bytes2);
strToWrite = username2+ '\r' +'\n' ;
byte[] bytes3 = strToWrite.getBytes(); fstr.write(bytes3);
strToWrite = pcname2 + '\r'+'\n' ;
byte[] bytes4 = strToWrite.getBytes(); fstr.write(bytes4);
catch (IOException e)
System.out.println("Error -- " + e.toString());
To read them back in I have made the follwoing:
BufferedReader br= null;
Count = 0;
try
br = new BufferedReader(new InputStreamReader(new FileInputStream("\\c:\\filename.txt")));
String s = "";
while((s=br.readLine()) != null )
Count = 1;
//System.out.println("Data is " + s);
inboundtext = s;
if ( Count == 1 )
break;
while((s=br.readLine()) != null )
//System.out.println("Data is " + s);
inboundtext = s;
Count = 2;
if ( Count == 2 )
break;
catch(IOException ie)
finally
try
if(br!=null) br.close();
catch(Exception e)
Now the above I know, is reading each line of the text file one at a time.
Now what I would like is that when the text that we got from the textfields, using getText(), be removed from the file without destroying the rest of the records in there? Why is it so easy to add and replace files, but not do any deleting from them?
please help!!sorry, FileOutputStream fstr = new FileOutputStream(f);
should be FileOutputStream fstr = new FileOutputStream(f, true);
Maybe you are looking for
-
Safari Won't Open and Can't Reinstall
All of a sudden Safari will not open and ends with the following message:Safari cannot open a browser window and may be missing important resources. Try installing Safari again.I have tried to install it from my original Tiger disk but it starts and
-
IPhone 4 shutting on and off randomly and says restore necessary?
So I was on my phone using Safari when all of a sudden it shuts off and will not respond, I tried the awake+menu and alas to no avail so I plugged it in to my wall charger and it powers on saying that it's at 100% and that it's Wednesday December31 a
-
Standard or Moving Average Material Cost
If we have PO price / costs plus shipping costs....can we use these to calculate the product cost whether standard or moving average? Thanks in advance Message was edited by: Satish A Kumar
-
File to IDoc Scenario exception handling
I have configured Time bound File to IDoc scenario with processing mode in Sender adapter as 'Delete'. And it is running perfectly. I am trying to add additional functionality to the scenario, i.e.,if a file does not exist on the ftp server, a mail s
-
PE10:How can I limit a transition to just part of the video
I want to limit the page peel transition to affect the portion of the video screen that depicts a screen showing a slide presentation. The slide show does not show up on the video, so I have to overlay the screen with images from the slide show & wan