SQL> create table tab_new as select employee_id eid,first_name fname,last_name lname from employees;
Table created.
SQL> desc tab_new;
Name Null? Type
----------------------------------------- -------- ----------------------------
EID NUMBER(6)
FNAME VARCHAR2(20)
LNAME NOT NULL VARCHAR2(25)
SQL> truncate table tab_new;
Table truncated.
--------
SQL> insert into tab_new values(101,'nasim','khan');
1 row created.
SQL> insert into tab_new values(102,'alina','khan');
1 row created.
SQL> commit;
Commit complete.
SQL> insert into tab_new values(103,'rafat','shaikh');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from tab_new;
EID FNAME LNAME
---------- -------------------- -------------------------
101 nasim khan
102 alina khan
103 rafat shaikh
------------
SQL> merge into tab_new t
2 using employees e
3 on (t.eid=e.employee_id)
4 when matched then
5 update set
6 t.fname=e.first_name,
7 t.lname=e.last_name
8 when not matched then
9 insert values (e.employee_id,e.first_name,e.last_name)
10 /
107 rows merged.
SQL> select * from tab_new;
EID FNAME LNAME
---------- -------------------- -------------------------
101 Neena Kochhar
102 Lex De Haan
103 Alexander Hunold
198 Donald OConnell
199 Douglas Grant
:
:
:
:
107 rows inserted
Happy New Year 2023...! This is a blog for Oracle ERP lovers. BLOG - Begin Learning Oracle with Girish. :-)
Pages
OracleEBSpro is purely for knowledge sharing and learning purpose, with the main focus on Oracle E-Business Suite Product and other related Oracle Technologies.
I'm NOT responsible for any damages in whatever form caused by the usage of the content of this blog.
I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.
I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.
No comments:
Post a Comment