Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valued inserted in table in oracle not saved?

I am using Oracle Database 11g and use the SQL command line.

I created the tables and then inserted the values as usual .When i use the select query to see the inserted rows i see them without any problem.

SQL> connect
Enter user-name: hotel
Enter password:
Connected.
SQL> select * from hotel
2  ;

no rows selected

SQL> insert into hotel values('The Taj',11,'New York',5);

1 row created.

SQL> select * from hotel;

NAME                                                 HOTEL_ID
-------------------------------------------------- ----------
LOCATION                                           STAR_RATING
-------------------------------------------------- -----------
The Taj                                                    11
New York                                                     5

HOWEVER after i close the sql command line, open again and again use the select query to see all the rows...all the rows are gone. i get "no rows selected"

    SQL> connect
    Enter user-name: hotel
    Enter password:
    Connected.
    SQL> select * from hotel;

    no rows selected

    SQL>

I dont know why this is happening. Please Help! And i am completely new to this.. so please dont judge :)

like image 901
Fazil Nadeem Hussain Avatar asked Apr 19 '14 18:04

Fazil Nadeem Hussain


2 Answers

try

       SQL> commit;

just after insert

like image 158
Md.Rajibul Ahsan Avatar answered Sep 29 '22 20:09

Md.Rajibul Ahsan


try to commit the transaction after insertion and check once

like image 33
Monika Avatar answered Sep 29 '22 21:09

Monika