Sunday, November 20, 2011

Update or Insert the rows into Table or VIew using Oracle || MERGE Class in Oracle

Oracle database has one class to update or insert the rows into table or view which is "MERGE".
MERGE class can do this kind of operations very easily.Now i will shown a simple example in below

Example:

MERGE  into Employee USING Users
         ON(Employee.name=Users.name)
        WHEN matched  then UPDATE SET Employee.role=Users.role,Employee.Add=Users.Add
        WHEN matched  Then Insert(name,role,add,phno) values (Users.name,Users.role,Users.add,Users.phno)

No comments:

Bel