sql - how to put case statement in where clause in Stored procedure in oracle 11g r2 -
I am stuck in a problem .. I have searched it from the net and found the solution in this way .. < / p>
sELECT (selected LOC_ROW_ID of B.ROW_ID as ROWNUM the ROW_ID, A.YEAR, Aprid (sELECT DISTINCT TP.YEAR, TP.MONTH fROM TB_PLAN TP WHERE ML_TYP = PARM_ML and ANALYSIS_TYP = PARM_ANALYSIS_TYP ** case when PARM_TYP_ST is zero PLAN_CDE end = PARM_PLAN_CDE case when not nULL in PARM_TYP_ST PLAN_CDE end = PARM_PLAN_CDE ** by year DESC, month DESC) a) where B order B.YEAR = 2013 and Period of 3; Here PARM_ML, PARM_ANALYSIS_TYP, PARM_TYP_ST parameters are passed as input parameters. And LOC_ROW_ID local parameters for the Between value ROW_ID
I do not know that it is the view of my problem or not but get nothing when ML_TYP = PARM_ML and ANALYSIS_TYP = PARM_ANALYSIS_TYP and PLAN_CDE = PARM_PLAN_CDE case2: when ML_TYP = I PARM_ML and ANALYSIS_TYP = PARM_ANALYSIS_TYP to this query is what I do .. two cases result from using the same query to Casel what can I do right Please suggest or should go for any other solution please I
Select the basic question SELECT DISTINCT TP.YEAR, the TP.MONTH TB_PLAN TP WHERE ML_TYP = PARM_ML and ANALYSIS_TYP = PARM_ANALYSIS_TYP ** case when PARM_TYP_ST tap PLAN_CDE END = PARM_PLAN_CDE and when the case if not NULL in PARM_TYP_ST PLAN_CDE end = PARM_PLAN_CDE ** by year DESC, month DESC command I think the argument you're looking for:
Where ML_TYP = PARM_ML and ANALYSIS_TYP = PARM_ANALYSIS_TYP and (PARM_TYP_ST is not zero or PLAN_CDE = PARM_PLAN_CDE) creates an optional parameter PARM_PLAN_CDE B NULL , this will not filter data.
Comments
Post a Comment