Deleting records from a file
how do i delete records from a file on my presentation server after a successfull read operation
Hi,
First store records in to internal table using giu_upload.
then read the records and then delete the records which ever u want based on some condition and download the records to the presentation server using gui_download
Rgds,
Prajith
Similar Messages
-
Deleting records from XML file--just a little problem
Hi!
My xml file has a simple form like this:
<?xml version="1.0" encoding="UTF-8"?>
<AdressBook>
<Name>Suzy</Name>
<Lastname>Love</Lastname>
<Adress>You street 22</Adress>
<Phone>911</Phone>
<Email>[email protected]</Email>
</Record>
<Record>
<Name>Judy</Name>
<Lastname>Goblin</Lastname>
<Adress>Milkyway</Adress>
<Phone>911</Phone>
<Email>[email protected]</Email>
</Record>
</AdressBook>Now, whenever I delete a record from that file it leaves a remaining tag <Record /> on the loction were previous record was. How do I delete that remaining tag or better yet, how do I delete Record element in whole. I am using jdom.
Here is the code I use to delete records:
public void deleteRecordFromFile(Record r)
Element root=doc.getRootElement();
List records=root.getChildren();
Iterator listIt=records.iterator();
while(listIt.hasNext())
Element rec=(Element)listIt.next();
Record p=new Record("","","","","");
List recChildren=rec.getChildren();
Element e=null;
for( int i=0;i<recChildren.size();i++)
e=(Element)recChildren.get(i);
switch (i)
case 0: p.setName(e.getText()); break;
case 1: p.setLastName(e.getText());break;
case 2: p.setAddress(e.getText());break;
case 3: p.setPhone(e.getText());break;
case 4: p.setEmail(e.getText());break;
default: ;
if(p.equals(r))
rec.removeContent();
System.out.println("Record deleted!");
writeToFile(filename);
}Like you see above I use the method removeContent(), should I use some other method? I need to get rid of that remaining tags in order to make my editing of the records stored in there easier. I guess I could make a seperate routine that would clean my file of those tags, but I think that is just too much time consuming...or not?
Please help me out here.:)
Message was edited by:
byteministerYou cannot remove the elements of a List while iterating over them without the risk of throwing a ConcurrentModificationException, whatever method you would use. So you can only delete the records in two steps: collect them all, and delete them afterwards.
public void deleteRecordFromFile(Record r)
Element root=doc.getRootElement();
List records=root.getChildren();
Iterator listIt=records.iterator();
// Create a container for storing references to the records that will be deleted.
ArrayList<Element> deleteList = new ArrayList<Element>();
while(listIt.hasNext())
Element rec=(Element)listIt.next();
Record p=new Record("","","","","");
List recChildren=rec.getChildren();
Element e=null;
for( int i=0;i<recChildren.size();i++)
e=(Element)recChildren.get(i);
switch (i)
case 0: p.setName(e.getText()); break;
case 1: p.setLastName(e.getText());break;
case 2: p.setAddress(e.getText());break;
case 3: p.setPhone(e.getText());break;
case 4: p.setEmail(e.getText());break;
default: ;
if(p.equals(r))
// This record will be deleted.
deleteList.add(rec);
// Delete all the records in deleteList.
records.removeAll(deleteList);
writeToFile(filename);
} -
Hi all,
I have a text file abc.txt, i want to delete records from a table take the input from the txt file from linux operating. lets see
My table table structure is
desc unix_logins
Name Null? Type
UNIX_LOGIN NOT NULL VARCHAR2(7)
NAME_LAST VARCHAR2(20)
NAME_FIRST VARCHAR2(20)
NAME_MI VARCHAR2(1)
LOGIN_CONTACT_TN VARCHAR2(12)
and abc.txt
UNIX_LOGIN
abc
bdf
fyz
rmt
lik
My Oracle is installed in Linux plat form. Can please suggest me how can do it.>
I have a text file abc.txt, i want to delete records from a table take the input from the txt file from linux operating.
>
It's not clear what you mean. Do you want to delete records from a table if those records exist in a txt file?
You can create an EXTERNAL TABLE on the text file and then use that 'table' in a query that deletes records from your table.
DELETE FROM myTable where LAST_NAME in (SELECT NAME_LAST from myExternalTable); See this Oracle-base example of creating an external table on a text file
http://www.oracle-base.com/articles/9i/external-tables-9i.php -
Delete recording from VSMS server
In VSMS server, how can delete recording from storage? and can delete some of recording, like 1 hour from all recording or 1 day?
Hello mshah,
This is not recommended at all to delete recording files manually or for certain durations since every files has reference id created which are being associated to cameras.Deleting files in such can cause issue to the server.
What is the reason behind deleting those files from server?
Regards
Nadeem Ahmed -
How to delete data from flat file ?
Hi all,
I deleted a record from a tables and I want to delete it from data file.
Can I do it ?
Pls help me !What do you mean by deleting it from datafile ?, Is it flat file or something else you want to ask? I believe you have records in flat files and you want to delete them as soon as you load them into oracle table.Oracle dosent offer such facility, however you can syncronise your tables and flat file contents by using merge statements and update it in a fashion, so that only records which reflects in flat files syncronises with table in oracle database .
hare krishna
Alok -
Is there a way to delete records from MDM automatically?
Is there a way to delete records from MDM automatically?
I am able to import the data automatically through MDIS, but I have to delete the data first. Itu2019s possible to do it ?Hi Adam,
Current scenario
USER1: call ME to delete old catalog data
ME: open the MDM & delete it manually
USER1: Transaction to extract new data file
MDIS: load the data to catalog
As per your requirement, you should save map in following way which can solve your purpose. Create a XML file which should consist of new and existing records. So in import Manager, for newly added records you need to set Default Import Action as Create and for existing records you should use or set Default Import Action as Replace and then should save in map.
So using this every-time if new record comes (not available in data manager), it will get created and for existing record (already available in Data Manager) it will replace (which means delete the existing record (old catalog data) and create a new record).
Regards,
Mandeep Saini -
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); -
Delete record from the form and from the database
hi,
i want delete record from the form and the database ,but the record is only delete from the from !!!
this is my code :
if //condition then
delete_record;
commit;
end if ;
Any solutions ??
thnxYou have unique key field(s) on the table you are trying to insert which actually restricts you from inserting the same value again.
When you are deleting the record and issue commit there is a record to be inserted in the table which is a duplicate that's why you are getting this unique error.
As oracle is not able to insert your commit fails and stops your deletion of record from table -
Delete records from tableA which are not in tableB
Table A contains milions of records which is the best way to delete records from tableA which are not in tableB
delete from tableA where empno not in (select empno from tableb)
or
delete from tableA where empno not exists (select empno from tableb
where b.empno=a.empno)
any helpHi
If you can do this, do with this:
create table tableC
as select a.*
from tableA a,
(select empno from tableA
minus
select empno from tableB) b
where a.empno = b.empno;
drop table tableA;
rename table tableC to tableA;
Ott Karesz
http://www.trendo-kft.hu -
How to delete records from standard maintenance view
Dear Sir/Madam,
i want to delete records from standard view " v_mmim_rep_cust "
This is a standard maintenance view , used in MBLB report.
here i found the records with different report name but same fields as shown below...
REPORT TABLE NAME FIELD NAME
RM07DOCS MKPF BKTXT
RM07DOCS MKPF BLDAT
RM07DOCS MKPF BUDAT
RM07DOCS MSEG ANLN1
RM07DOCS MSEG ANLN2
RM07DOCS MSEG APLZL
YRM07DOCS MKPF BKTXT
YRM07DOCS MKPF BLDAT
YRM07DOCS MKPF BUDAT
YRM07DOCS MSEG ANLN1
YRM07DOCS MSEG ANLN2
YRM07DOCS MSEG APLZL
I WANT TO DELETE THE RECORDS FROM THE VIEW WITH REPORT = YRM07DOCS.
PLEASE HELP ME.
Thanks in Advance,
Dastagiri.Dear Sir,
when i did so , it displays a message that " entry mseg zeile must not be deleted ".
hense i went through writing a program to delete the records from table mmim_rep_cust
but it says that record not found.
program logic :
delete from mmim_rep_cust
where report in report
and TABNAME in TABNAME.
if sy-subrc = 0.
write ' RECORDS DELETED SUCCESSFULLY'.
else.
write ' RECORD NOT FOUND'.
endif.
please guide me to delete the records from the view.
Thanks in advance,
Dastagiri. -
i want to delete lines from a file after reading the line. the next time i read the file i should find a unread line as the 1st line of the file.
how do i do tat? this is very similar to delete from table name query in sql. but i have to do this with java and txt files. how do i code this??You can't delete part of a file. The way to do that in general is like this:
1. Read a line.
2. If you want to delete it, do nothing. Otherwise write it to a new file.
3. Repeat until end-of-file.
After you've finished all that, the new file will contain everything you didn't want to delete. Now delete the original file and rename the new file to have its name. -
SQL Server 2012 Developer Edition will not install. Setup files don't even get copied completely. Win 8.1. ACT instance is loaded & can't be deleted. From log file: Error: Action "PreMsiTimingConfigAction" failed during execution.
Hello,
I am glad it worked.
Thank you for visiting MSDN forums!
Regards,
Alberto Morillo
SQLCoffee.com -
Delete records from internal table
hi all,
i want to delete records from intenal table which are starting with a particular starting number .
eg internal table
10000
20000
90000
91000
92000
88880
i want delete the records starting with 9 i.e. 90000 91000 92000.
Thanks in Adv
RAJYou can test this piece of code.
DATA:
i_tab TYPE STANDARD TABLE OF mara,
wa_tab TYPE mara.
wa_tab-matnr = '1000'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1002'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '1003'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '2001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '3001'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
wa_tab-matnr = '4010'.
APPEND wa_tab TO i_tab.
CLEAR wa_tab.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Aug 8, 2008 4:49 PM -
Delete records from multiple table
Hi,
I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
Kindly Help.
Thanks,
Alexander.Hi Tim,
Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
Technically, there are other ways of deleting from multiple tables with one statement.
1. "Use a trigger":
What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
2. Dynamic SQL:
Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
3. Using Foreign-Key constraint with Cascade-Delete:
This I feel is a more 'cleaner' way of doing this.
Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind. -
Any way to restore deleted record from VBAP table.
Hi Guru,
Is their any way to restore deleted record from vabp.
Back is taken but , All quality server back is taken, any way to restore only
deleted VBAP data from all Back.
Regards
DurgeshHi Sahu ji,
you will not be able to get those records.
Check this : If this issue is in Development than no need to worry.
If in quality and production , then usually a copy of the system is there , and this can help you.
Also , check is there any report that exports this data in some other form for backup.
Hope it help you.
Maybe you are looking for
-
As stated I turned on my passcode lock to come on after 1 hour of operation. It doesn't work like I thought it would. My thoughts were that it would go to the lock screen and then require a code. Is my thinking not right on this? What am i doing
-
Is there a problem using popup LOVs in a portal form with a bind variable?
I have a portal form with 2 LOVs. The second LOV is a dependent LOV whose bind variable can be NULL. I have read Note 263923.1, "How To Create Dependent Lovs In Forms", and my form works as long as I use combo boxes to display the LOVs. I need to use
-
this may sound like a really dumb question but i have nearly 200 songs in itunes (and some i downloaded long before itunes was mainstream) but i can't figure out how to get them onto my iphone. i plug in iphone, it shows up in devices in itunes, but
-
ITunes 10.7 error -42408
I use a Mac Pro(2.66ghz Dual-Core Intel Xeon -32bit- 10.6.8/12GB ram) whenever I plugin my New iPad Mini w/iTunes 10.7.. it gives me "iTunes 10.7 error (-42408) won't sync! asks me EVERY-time to RESTORE it to original version( I have the New iOS 6.1
-
when trying to download the latest itunes it stops half way through and says "error occured whilst installing the update" anybody know how to fix this?