• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cant delete frrom table

 
Laura Mike
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i want to delete a record from the table "myTab" and using this query.but when i run the prog. it executes without eror but the deletion is not performed in the table.wt is the problem plz help.
my query is:
UPDATE myTab SET flag = true WHERE id = 4
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you expect an UPDATE op to perform a delete? Perhaps a DELETE op would be more effective?
bear
 
Laura Mike
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know but i want to do it with update for some reason.
am i doing it in wrong way?
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear already asked why you would expect and UPDATE to delete/remove a record from a table. Am I missing something? After executing your statement the record will still be in the table. You still need a DELETE statement to remove it from the table. If you are new to SQL and/or relational databases in general, you will need a tutorial.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some people do use flags to mark a record as "deleted". I wrote at least one system that I can recall where we never deleted anything but simply used a flag to identify a record as no longer being available. We then gacve the users a special screen they could use to recover "deleted" records. The users thought we were magicians!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case...
Laura,
Why do you think that your posted example UPDATE statement isn't working? Are you receiving an error message? If so, what is it? Or does the proper record seem to not actually be updated?
 
Anurag Gupta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soft delete is good option for certain aplication - by flaging a Record as Deleted , though it remains in the DataBase.
Check whether u are committing the record after update is fired.
Check whether the Record exists in the Table, which u r trying to update.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we get more info on your setup?
if you're using Access or the JDBC-ODBC bridge I'd say it could be the common 'missing update' problem. Try executing an dummy select after your update to 'flush' the connection.
 
Laura Mike
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx friends...
problemis solved....
David was right i did as he directed and am successful in doing the job.it was a missing update problem which i did no knew before.
Thanx again to all helpers....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic