Manuel
Manuel

Reputation: 2554

Why Oracle has a table showing different data with the same database?

I'm having trouble with Oracle. I have one database or schema and two applications to manage some data: admin app, and client app.
I access the data through client application, it shows the rows and fields.

I access the data through admin application and can see the exact same data.

Then I make an insert from the admin app and I can see the new row.
Now, I access with the client and it shows the old data, I mean the database without the new row. Even if I 'update' a field in the admin, I won't see that 'update' with the client app.

This is the insert:

INSERT
INTO sae_scenario_type
  (
    id,
    name,
    description,
    locked
  )
  VALUES
  (
    SEQ_SAE_SCENARIO_TYPE.nextVAL,
    'Direct_SQL_Insertion_1',
    'Direct SQL Insertion from RfoAdmin 1',
    'N'
  )

I've read the docs but I can't find something where one can have two versions of the same table or something like that. I'm used to PostgreSQL and MySQL, but not Oracle. Now I have to insert rows directly into the database bypassing the client application and I can with the admin app, but I can't see them in the client app.

I'm pretty sure this is related to the Oracle configuration or something like that, but just now I don't have access to that. I'm just trying to prepare myself for a project we'll begin in a few weeks. Then I will have access to people managing the database (I hope so).

Any ideas?

Upvotes: 1

Views: 121

Answers (2)

vishnu sable
vishnu sable

Reputation: 358

Yes you just need a commit; also you can check option on auto commit;

Upvotes: 1

Lalit Kumar B
Lalit Kumar B

Reputation: 49082

Now, I access with the client and it shows the old data, I mean the database without the new row. Even if I 'update' a field in the admin, I won't see that 'update' with the client app.

The only thing that could cause this is if you don't COMMIT.

You must commit after DML changes to make sure the changes are permanent.

INSERT
INTO sae_scenario_type
  (
    id,
    name,
    description,
    locked
  )
  VALUES
  (
    SEQ_SAE_SCENARIO_TYPE.nextVAL,
    'Direct_SQL_Insertion_1',
    'Direct SQL Insertion from RfoAdmin 1',
    'N'
  );

COMMIT;  --> you are missing this

From documentation,

COMMIT

Purpose

Use the COMMIT statement to end your current transaction and make permanent all changes performed in the transaction. A transaction is a sequence of SQL statements that Oracle Database treats as a single unit. This statement also erases all savepoints in the transaction and releases transaction locks.

Upvotes: 1

Related Questions