문제

I'm using the database utility Execute Query to experiment with Oracle SQL (10g).

My problem is that even after successfully executing a CREATE TABLE and an INSERT, the records are not shown when opening the data inspector.

Here is what I run:

DROP TABLE Customer;

CREATE TABLE Customer (
    CustomerNr INTEGER PRIMARY KEY,
    LastName    VARCHAR2(50),
    FirstName   VARCHAR2(50)
);

INSERT INTO Customer VALUES (1, 'Example', 'Joe');


The table is listed correctly:

enter image description here

Screenshot 1

However, no records are listed in the data tab: enter image description here Screenshot 2

SELECT * FROM Customer; can be executed successfully, but nothing is returned.

If I disconnect from the database and connect again, the data is loaded properly.

SELECT * FROM Customer; now also returns the inserted record correctly.

Is this a bug in Execute Query? Am I doing something wrong? What could I try to fix this?

PS: Please edit my post to include the images as I don't have the reputation to add images.

도움이 되었습니까?

해결책

It sounds like the data inspector is running in a different database session to where you're doing the work. DDL statements (like create table) do implicit commits so the new table will be visible everywhere immediately. DML statements (like insert) do not (usually, by default, though some clients will based on settings), so the newly inserted data will not be visible in any other sessions.

In short... issue a commit in the same session as the insert to make it visible.

Disconnecting and reconnecting is also implicitly committing, which is why the data is visible after you've done that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top