Home > Database > Mysql Tutorial > body text

Oracle数据库根据不同条件给同一字段修改相应的值

WBOY
Release: 2016-06-07 17:34:41
Original
1849 people have browsed it

Oracle数据库根据不同条件给同一字段修改相应的值: 例如:根据职务调整雇员的工资,如果职务为ldquo;SALESMANrdquo;或者ldquo

Oracle数据库根据不同条件给同一字段修改相应的值:

例如:根据职务调整雇员的工资,如果职务为“SALESMAN”或者“ANALYST”工资上调100元,如果职务为“MANAGER”工资上调200元,其它职务工资上调50元。
update emp
set sal=(
case
when job in('SALESMAN','ANALYST') then sal+100
when job = 'MANAGER' then sal+200
else sal+50
end
);

查询出当前的oracle数据库系统时间

日期:select sysdate from dual;
或    select current_date from dual;
日期+时间:select systimestamp from dual;
本月最后一天:last_day(sysdate)
格式化日期:
select tochar(sysdate,'YYYY/YY-MM-DD HH24:MI:SS') from dual;

星期几:
select tochar(sysdate,'day') from dual;
day/dy  表示星期几 
d表示一周中的第几天,从1(周日为第一天)开始算

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!