标签:式表 _id project case 形式 not sel 方法 col
decode()函数简介:
主要作用:
将查询结果翻译成其他值(即以其他形式表现出来,以下举例说明);
使用方法:
Select decode(columnname,值1,翻译值1,值2,翻译值2,…值n,翻译值n,缺省值)
From table
Where …
其中columnname为要选择的table中所定义的column,
含义解释:
decode(条件,值1,翻译值1,值2,翻译值2,…值n,翻译值n,缺省值)的理解如下:
if (条件==值1)
then
return(翻译值1)
elsif (条件==值2)
then
return(翻译值2)
……
else
return(缺省值)
end
(其中条件也可以为一个子查询)
举举例:
select
t.pmcon_project_id,
t.pmcon_id,
t.project_id,
pro.project_name,
pro.project_mgr,
(select b.account_name from bas_emp_account b where b.is_use=‘Y‘ and b.account_id=pro.PROJECT_MGR) PROJECT_MGR_TEXT,
pc.pmcon_name,
(select f.contract_type_name from fm_contract_type f
where f.is_use=‘Y‘ and pc.pmcon_type_id=f.contract_type_id) type_name,
decode(pa.workflow_status,null,‘未开始‘,3,‘已完成‘,‘进行中‘) is_pmcon_accept,
pa.complete_date,
pc.is_audit,
getdicname(‘IS_OR_NOT‘,pc.is_audit) is_audit_text,
(case pc.is_audit
when null then ‘‘
else decode(p.workflow_status,null,‘未开始‘,3,‘已完成‘,‘进行中‘)
end) is_pmcon_account,
p.report_date
from pm_pmcon_project t
left join pm_pmcon pc on t.pmcon_id =pc.pmcon_id
left join pm_project pro on t.project_id =pro.project_id
left join pm_pmcon_accept pa on t.is_use=‘Y‘ and t.pmcon_id =pa.pmcon_id and t.project_id=pa.project_id
left join pm_pmcon_account p on p.is_use=‘Y‘and p.pmcon_id=t.pmcon_id and p.project_id=t.project_id
where t.is_use=‘Y‘and pc.is_use=‘Y‘ and pc.workflow_status=‘3‘ and pro.is_use=‘Y‘
标签:式表 _id project case 形式 not sel 方法 col
原文地址:https://www.cnblogs.com/houchen/p/12112458.html