6

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 :)

2 Answers2

11

try

       SQL> commit;

just after insert

2

try to commit the transaction after insertion and check once

Monika
  • 135
  • 1
  • 12