PL/SQL (MOSC)

MOSC Banner

conditional update

edited Jul 15, 2013 10:40PM in PL/SQL (MOSC) 8 commentsAnswered
hi

I have two tables.. 

1. csv_country (country_code      varchar2(2) , country_name      varchar2(255) 
2. country     (country_code      varchar2(2) , country_name      varchar2(255) 

now. i want to update country table with below condition..


if country.country_name = csv.country_name then 
if country.country_code != csv.country_code  then
   update country set country_code = csv.country_code  where country.country_name=csv.country_name;
end if;
else
insert into country select * from csv_country.

how to write pl/sql or sql for above requirement.

Thanks,
Rajesh

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center