The content of the string is where the back of the conditions of the query script,
Logic is through a stored procedure can I obtain judgment conditions conforming to the provisions of the current incoming people then put together a where condition and multiple conditions with or separated from the complete
Select *
The from t_pms_bu_project_info t
The where (instr (t.p roject_responsible, '# emp_id #') & gt; 0 or
(t.p roject_responsible_dept in
(' 11729 ', '9115', '12942', '568', '687', '8745') and
'# emp_id #'='8669806') or the exists
(select 1
The from t_pms_bu_project_info a
Where Amy polumbo roject_code=t.p roject_code
And ((Amy polumbo ROJECT_RESPONSIBLE_TYPE='1' and
(' # # emp_id in (' 8601494 ', '8610963') or
(Amy polumbo roject_type_class='1' and
'# # emp_id in
(' 8662888 ', '8671434', '8671555', '8610692', '8610737')))) or
(Amy polumbo ROJECT_RESPONSIBLE_TYPE='2' and
'# # emp_id in (' 8671342', '8671976')))
Or (Amy polumbo ROJECT_RESPONSIBLE_TYPE='3' and
'# # emp_id in (' 8671899', '8676026'))) or the exists
(select 1
The from t_Eap_Sys_Role_User m
Where m.r ole_id in (' PMS_ROLE_ZZ005,
'PMS_ROLE_ZZ010'
'PMS_ROLE_ZZ019'
'PMS_ROLE_ZZ020')
And m.u ser_id='# emp_id #') or the exists
(select 1
The from t_bs_employee bs
Inner join v_bs_leader cl
On bs. Last_office ANIZATION_CODE=cl.ORG
Or bs. Last_department ANIZATION_CODE=Cl.ORG
Where instr (t.p roject_responsible, bs. Employee_id) & gt; 0
And cl. EMPLOYEE_CODE='# emp_id #') or the exists
(select 1
The from t_pms_bu_project_info info
Inner join t_pms_bu_budget_info bi
On the info. Wbs_code=bi. Wbs_code
And bi. Year_budget_type='2'
And bi. Arrival_fee & gt; 0
Inner join t_eim_bd_lookup lb
On 1=1
And lb. Lookup_class='PMS_SYS_056'
And lb. Lookup_code='# emp_id #'
And the info. Project_type='5'
Where the info. Project_code=t.p roject_code) or the exists
(select 1
The from t_eap_sys_role_user u
Inner join t_bs_employee ue
On u.u ser_id=ue. Employee_id
And u.u ser_id='# emp_id #'
Left the join t_eap_sys_organization o
On o.p arent_org_id=ue. Last_department
The where ((t.p roject_responsible_dept=ue. Last_office and
U.r ole_id='PMS_ROLE_ZZ008') or
(t.p roject_responsible_dept _id=o.org and
U.r ole_id='PMS_ROLE_ZZ003))) or the exists
(select 1
The from t_eap_sys_organization o
Inner join t_pms_bd_resp rp
On the rp. Resp_unit _id=o.org
The or rp. Resp_unit=o.p arent_org_id
Where the rp. Resp_user='# emp_id #'
And rp. Is_enable='1'
And t.p roject_responsible_dept _id))
=o.org
CodePudding user response:
That your problem?CodePudding user response:
Not understand, what do you mean by this SQL? It also doesn't return conditionsCodePudding user response:
The create or replace procedure find_emp_id (p_emp_id varchar2) in the asV_sql varchar2 (4000);
Recode_t_pms_bu_project_info t_pms_bu_project_info % rowtype;
The begin
V_sql:='select * into recode_t_pms_bu_project_info from t_pms_bu_project_info t
The where (instr (t.p roject_responsible, '| | p_emp_id | |') & gt; 0 or '...
- put the back of the statement also modify splicing, then
The execute immediate v_sql;
end;
CodePudding user response: