sqloracle-databaseplsqlpluggable-database

SQL Error: ORA-00942: table or view does not exist 00942. 00000 - "table or view does not exist"


I'm new to the Oracle PL/SQL. So I created a pluggable database named "EGITIM" as seen here: enter image description here

Then I got a SQL script from a UDEMY course. These scripts are for creating tables,inserting datas etc. First script is for creating tables. I executed it and created the tables successfully as seen here: enter image description here

But when I executed the other script which adds data to these table, i got an error for every table I've created:


Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:    
*Action:
Unknown Command: COMMIT

The SQL script:

SET DEFINE OFF;
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('1','İÇ ANADOLU');
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('2','MARMARA');
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('3','EGE');
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('4','AKDENİZ');
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('5','DOĞU ANADALU');
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('6','GÜNEY DOĞU ANADOLU');
Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('7','KARADENİZ');

////// same lines with other tables and datas
//////
//////
//////

COMMIT;

I tried to GRANT ALL PRIVILEGES to the user I created for this database. But I still get the same error.


Solution

  • As you successfully created tables in EGITIM schema, I guess you're connected as EGITIM; aren't you? If not, you should be!

    This:

    Insert into EGITIM.BOLGELER (BOLGE_KODU,BOLGE_ADI) values ('1','İÇ ANADOLU');
    

    inserts row into table named BOLGELER which is owned by EGITIM user. As table owner, you (once again: presuming you're connected as EGITIM!) don't have any privileges on your own table - you can insert rows, update values, delete rows ... everything.

    Apparently, something is wrong. As the only table involved in statement I posted is BOLGELER, what happens when you run the following:

    select user from dual;
    select owner from all_objects where object_name = 'BOLGELER';
    

    Depending on your answer, we'll see what to do next.