How to update salary of employees department wise?

Answers were Sorted based on User's Feedback



How to update salary of employees department wise?..

Answer / k v koteswara rao

UPDATE employees SET salary=DECODE(department_id,10,salary+1000,20,salary+2000,30, salary+3000,salary);

Is This Answer Correct ?    18 Yes 0 No

How to update salary of employees department wise?..

Answer / ajit nayak

update emp
set sal = case Deptno when 10 then 1000
when 20 then 2000
when 30 then 3000
else 0
end;

Is This Answer Correct ?    7 Yes 0 No

How to update salary of employees department wise?..

Answer / manoranjan sethy

UPDATE EMP
SET SAL=DECODE (
DEPTNO,
10, SAL+SAL*0.1,
20, SAL+SAL*0.2,
30, SAL+SAL*0.3,
40, SAL+SAL*0.4,
'NA'
)
/

Is This Answer Correct ?    6 Yes 0 No

How to update salary of employees department wise?..

Answer / prativa mishra

update employees
set salary=salary+1000
where department_id=&department_id

Is This Answer Correct ?    4 Yes 3 No

How to update salary of employees department wise?..

Answer / 8008064637

begin
updata emp set sal=sal+1000 where deptno in(10,20,30,40);
end;

Is This Answer Correct ?    4 Yes 4 No

How to update salary of employees department wise?..

Answer / meher.shareen

begin
update emp set sal=sal+1000
where deptno=10;
update emp set sal=sal+2000
where deptno=20;
update emp set sal=sal+3000
where deptno=30;
update emp set sal=sal+4000
where deptno=40;
end;

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More SQL PLSQL Interview Questions

What is materialized view in sql?

0 Answers  


How are functions and procedures called in PL/SQL?

0 Answers  


What is difference between mysql and postgresql?

0 Answers  


create or replace procedure search_matter(empno varchar2) as sql_stmt varchar2(200); stmt varchar2(200); v_table_name varchar2(200); val_pres number; inp_value varchar2(200); type obj_typ is table of cols.column_name%type index by binary_integer; type all_col is table of varchar2(100) index by binary_integer; typ_obj_typ obj_typ; typ_all_col all_col; begin select object_name bulk collect into typ_obj_typ from user_tables,user_objects where table_name = object_name AND object_type = 'TABLE'; select empno into inp_value from dual; dbms_output.put_line('inp value : '||inp_value); for i in typ_obj_typ.first..typ_obj_typ.last loop v_table_name := NULL; v_table_name := typ_obj_typ(i); dbms_output.put_line(i||':'||typ_obj_typ(i)); dbms_output.put_line('....................'); sql_stmt := 'select column_name from cols where table_name = :1 and data_type in (''CHAR'', ''VARCHAR2'', ''NCHAR'', ''NVARCHAR2'',''NUMBER'')'; EXECUTE IMMEDIATE sql_stmt bulk collect into typ_all_col using typ_obj_typ(i); for inside in typ_all_col.first..typ_all_col.last loop dbms_output.put_line('sql stmt: '||sql_stmt); dbms_output.put_line('column name: '||typ_all_col(inside)||'table name: '||typ_obj_typ(i)); stmt := 'select count(*) from ||typ_obj_typ(i)||'; EXECUTE_IMMEDIATE stmt into val_pres ; if val_pres = 1 then dbms_output.put_line('value present col name: '||typ_all_col(inside)||'table name :'||typ_obj_typ(i)); end if; end loop; dbms_output.put_line('....................'); end loop; exception when others then dbms_output.put_line('sql code '||sqlcode||'Table name: '||v_table_name); dbms_output.put_line('sql message '||sqlerrm); end; Compile-time I am getting below error, Plz help to resolve. LINE/COL ERROR -------- ----------------------------------------------------------------- 47/23 PLS-00103: Encountered the symbol "STMT" when expecting one of the following: := . ( @ % ;

0 Answers  


Can I learn sql in a week?

0 Answers  






What is materialised View?

2 Answers   IBM,


How many types of tables are there?

0 Answers  


Does a user_objects view have an entry for a trigger?

0 Answers  


what is unique key constraint? : Sql dba

0 Answers  


How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?

0 Answers  


What is pl/sql language case sensitive?

0 Answers  


What is your daily office routine?

0 Answers   Data Vision,


Categories