Skip to content
Advertisement

Oracle Cannot retain data

I have oracle database installed on my system

I access it through command line.

I had created a user

and

I created a table

Inserted few records.

then I exit

Problem is that when I try to login again.

table is still there. But the data which I had inserted is gone.

OUTPUT

Advertisement

Answer

SQL*Plus has option to auto-commit:

From documentation:

  • ON commits pending changes to the database after Oracle Database executes each successful INSERT, UPDATE, or DELETE, or PL/SQL block.
  • OFF suppresses automatic committing so that you must commit changes manually.
  • SET AUTOCOMMIT does not alter the commit behavior when SQL*Plus exits. Any uncommitted data is committed by default.

To control the commit on EXIT, you need to set the EXITCOMMIT parameter in SQL*Plus:

If it’s et to OFF, then you need to explicitly COMMIT after the insert statement which is a DML transaction. Create table is a DDL statement which does an implicit commit.

I have created a user system

SYSTEM is an administrative user account which is automatically created when you install Oracle database. It is meant for administration tasks and not to store application data etc. Create a separate user for your application.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement