Skip to Main Content
  • Questions
  • Unable to find EMP & Dept in Object Browser (APEX oracle)

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Junaid.

Asked: March 17, 2018 - 8:21 pm UTC

Last updated: December 09, 2022 - 4:08 am UTC

Version: APEX

Viewed 10K+ times! This question is

You Asked

i have recently made an account on APEX oracle, my trainer illustrated how to make the account on Apex and use it for training purpose PL/SQL, therefore i tried by myself when i make the account and go to object browser there i am unable to find any table, views or any sort of objects, i have to work on EMP & DEPT tables to become an expert in SQL but the problem is i am unable to find any thing in the object browser,

i have also googled and go through with the oracle's documentation but i don't even find anything how to activate these accounts or i think these are called schema tables, can anybody help me how can i activate these tables to work on.


thanks

and Connor said...

You can load the data into your own schema using the below script

drop table emp;
drop table dept;
drop table salgrade;

CREATE TABLE EMP
       (EMPNO NUMBER(4) NOT NULL,
        ENAME VARCHAR2(10),
        JOB VARCHAR2(9),
        MGR NUMBER(4),
        HIREDATE DATE,
        SAL NUMBER(7, 2),
        COMM NUMBER(7, 2),
        DEPTNO NUMBER(2));

INSERT INTO EMP VALUES
        (7369, 'SMITH',  'CLERK',     7902,
        TO_DATE('17-DEC-1980', 'DD-MON-YYYY'),  800, NULL, 20);
INSERT INTO EMP VALUES
        (7499, 'ALLEN',  'SALESMAN',  7698,
        TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600,  300, 30);
INSERT INTO EMP VALUES
        (7521, 'WARD',   'SALESMAN',  7698,
        TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250,  500, 30);
INSERT INTO EMP VALUES
        (7566, 'JONES',  'MANAGER',   7839,
        TO_DATE('2-APR-1981', 'DD-MON-YYYY'),  2975, NULL, 20);
INSERT INTO EMP VALUES
        (7654, 'MARTIN', 'SALESMAN',  7698,
        TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
INSERT INTO EMP VALUES
        (7698, 'BLAKE',  'MANAGER',   7839,
        TO_DATE('1-MAY-1981', 'DD-MON-YYYY'),  2850, NULL, 30);
INSERT INTO EMP VALUES
        (7782, 'CLARK',  'MANAGER',   7839,
        TO_DATE('9-JUN-1981', 'DD-MON-YYYY'),  2450, NULL, 10);
INSERT INTO EMP VALUES
        (7788, 'SCOTT',  'ANALYST',   7566,
        TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES
        (7839, 'KING',   'PRESIDENT', NULL,
        TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
INSERT INTO EMP VALUES
        (7844, 'TURNER', 'SALESMAN',  7698,
        TO_DATE('8-SEP-1981', 'DD-MON-YYYY'),  1500, NULL, 30);
INSERT INTO EMP VALUES
        (7876, 'ADAMS',  'CLERK',     7788,
        TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
INSERT INTO EMP VALUES
        (7900, 'JAMES',  'CLERK',     7698,
        TO_DATE('3-DEC-1981', 'DD-MON-YYYY'),   950, NULL, 30);
INSERT INTO EMP VALUES
        (7902, 'FORD',   'ANALYST',   7566,
        TO_DATE('3-DEC-1981', 'DD-MON-YYYY'),  3000, NULL, 20);
INSERT INTO EMP VALUES
        (7934, 'MILLER', 'CLERK',     7782,
        TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);

CREATE TABLE DEPT
       (DEPTNO NUMBER(2),
        DNAME VARCHAR2(14),
        LOC VARCHAR2(13) );

INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
INSERT INTO DEPT VALUES (20, 'RESEARCH',   'DALLAS');
INSERT INTO DEPT VALUES (30, 'SALES',      'CHICAGO');
INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');

CREATE TABLE SALGRADE
        (GRADE NUMBER,
         LOSAL NUMBER,
         HISAL NUMBER);

INSERT INTO SALGRADE VALUES (1,  700, 1200);
INSERT INTO SALGRADE VALUES (2, 1201, 1400);
INSERT INTO SALGRADE VALUES (3, 1401, 2000);
INSERT INTO SALGRADE VALUES (4, 2001, 3000);
INSERT INTO SALGRADE VALUES (5, 3001, 9999);

COMMIT;

alter table emp add constraint emp_pk primary key (empno);
alter table dept add constraint dept_pk primary key (deptno);
alter table emp add constraint emp_fk foreign key (deptno) references dept (deptno);




Rating

  (16 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Appreciated, Timely and Useful Reply

Junaid Ahmed, March 18, 2018 - 10:50 am UTC

i am really thankful to you, i just run the script that you provided to me and it created all the required tables.



thank you so much.
Connor McDonald
March 19, 2018 - 4:47 am UTC

glad we could help

Not working

Angelina, October 18, 2018 - 9:58 am UTC

ORA-00922: missing or invalid option

When running the above code due to not seeing the default tables, I received this error message.
Connor McDonald
October 20, 2018 - 4:16 pm UTC

Save the script I provided as a file, go into Apex, and upload it as a SQL Script and run it.

If you have problems, post the output here after OpenWorld when Chris and I are back on board.

Thank you so much, it helped!

A reader, April 23, 2019 - 5:13 pm UTC


Nikhil, May 19, 2019 - 8:01 am UTC

Thank you for posting this:)
Connor McDonald
May 21, 2019 - 4:05 am UTC

Glad we could help

Query

Arun, June 05, 2019 - 6:51 am UTC

I am really sorry to ask you this but can you please tell me the steps to load schema using the below script?
Connor McDonald
June 11, 2019 - 5:47 am UTC

Literally just fire up SQL Developer, cut-paste the code section and hit F5.

That's all there is to it.


Very Helpful

Sudha, June 21, 2019 - 1:58 am UTC


Very Useful

Hemal, June 21, 2019 - 8:59 pm UTC

This is very useful to get into the groove of practicing different queries on the go.


Connor McDonald
June 23, 2019 - 6:32 pm UTC

glad we could help

How can I load this Script

Takunda, December 07, 2019 - 6:11 am UTC

I'm just a few hours old in the Oracle Apex, how can I load this script.
Connor McDonald
December 13, 2019 - 3:15 am UTC

Paste into the SQL Workshop, or just save it as as file and use upload in SQL Scripts.

How to?

Sahar, March 24, 2020 - 9:04 pm UTC

I've read the conversation because I have the same problem. No tables in my workspace. I copied the script, run it and I got nothing.
How to upload it as a file? and where to go to do that .

Connor McDonald
March 26, 2020 - 2:50 am UTC

OK, here's a full walkthrough


Video

Sahar, March 25, 2020 - 1:09 pm UTC

Hi
Thanks for the try, but the video doesn't work.
I'm really swamped and wish to find the way that I can get this work.
Thanks
Connor McDonald
March 26, 2020 - 2:51 am UTC

Sorry - cut/paste fail on my part. Its been fixed

It works Yaaaay

A reader, March 26, 2020 - 8:17 pm UTC

Thanks a lot
Connor McDonald
March 27, 2020 - 4:19 am UTC

glad we could help

Thank you for the timely help

Arvind Nair, January 29, 2021 - 5:06 am UTC

I got the below errors. However I can see the tables.

1 0.01 drop table emp ORA-00942: table or view does not exist ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200", line 626 ORA-06512: at "SYS.DBMS_SYS_SQL", line 1658 ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200", line 612 ORA-06512: at "APEX_200200.WWV_FLOW_DYNAMIC_EXEC", line 1749 -
2 0.01 drop table dept ORA-00942: table or view does not exist ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200", line 626 ORA-06512: at "SYS.DBMS_SYS_SQL", line 1658 ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200", line 612 ORA-06512: at "APEX_200200.WWV_FLOW_DYNAMIC_EXEC", line 1749 -
3 0.00 drop table salgrade ORA-00942: table or view does not exist ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200", line 626 ORA-06512: at "SYS.DBMS_SYS_SQL", line 1658 ORA-06512: at "SYS.WWV_DBMS_SQL_APEX_200200", line 612 ORA-06512: at "APEX_200200.WWV_FLOW_DYNAMIC_EXEC", line 1749 -
Connor McDonald
February 01, 2021 - 1:49 am UTC

Notice that we drop the tables before we create them (which lets you re-run the script whenever you want)

So those errors can be ignored

Helpful

Oseloka Chukwuma Onyeabo, August 28, 2021 - 3:16 pm UTC

Thank you very much for the answer you have given on how to access tables "emp" and "dept". I was presently facing the same challenge but now resolved through your simple and precise answer. thanks Tom.
Connor McDonald
August 30, 2021 - 4:35 am UTC

Glad we could help

A big Thank you for the script

A reader, April 14, 2022 - 4:56 pm UTC

Thank you for sharing the script. Was wondering how to get started...comments helped me to run this script. Thanks again
Connor McDonald
April 19, 2022 - 3:12 am UTC

Glad we could help

THANK YOU SO MUCH FOR THE HELP

NIKHIL, December 05, 2022 - 3:44 pm UTC

The video that you've created is very helpful.
Connor McDonald
December 09, 2022 - 4:08 am UTC

glad we could help

Default tables in the Utilities

Golam, July 05, 2023 - 8:29 pm UTC

If you click on the Utility tab then you would see
the list of tools.
You would find "Sample Dataset"
If you click on it you will be given he default tables (dep/emp included) which you can just click and install.

More to Explore

APEX

Keep your APEX skills fresh by attending their regular Office Hours sessions.