Search code examples
sqloraclesql-delete

What is the delete statement if i using Oracle database?


when i write code to delete data in the row of my table it didn't delete

this my code `

SQL> select * from bill;

   PID        TID    BILL_NO       CODE                                     

     1          1          5          2                                     
     1          2          3                                                

SQL> delete from bill where bill_no in(5,3);

2 rows deleted.

SQL> select * from bill;

no rows selected

SQL> spool off;
SQL> select * from bill;

   PID        TID    BILL_NO       CODE                                     

     1          1          5          2                                     
     1          2          3                                                

SQL> spool off;`

what is the problem ? by the way i am beginner in oracle


Solution

  • Oracle and other relational databases support transactions. Transactions mean that you either have to commit your changes or roll them back, done with the COMMIT or ROLLBACK command respectively. Usually programs execute an implicit ROLLBACK on exit of similar activity as well as the Oracle Database issues a ROLLBACK on outstanding changes on a disconnect.

    SQL> select * from bill;
    
    PID        TID    BILL_NO       CODE                                     
    
     1          1          5          2                                     
     1          2          3                                                
    
    SQL> delete from bill where bill_no in(5,3);
    
    2 rows deleted.
    
    SQL> COMMIT;