Peformance Improved
Hemant Singh, November 18, 2016 - 8:24 am UTC
Thanks Connor !! Yes performance improved but still not up to the marks.
And yes SELECT was running slow, If something wrong in my logic? And if Optimizer is deciding Explain plan for every single data ? If yes then Bind Variable can be used like :
EXECUTE IMMEDIATE 'SELECT COUNT(1) FROM NEMIS.TT_MASTER_CLAIM WHERE TTID = :tt AND state = :state
AND type_of_claim = :type AND NVL(action, ''X'') NOT IN (''ADJ'', ''M'')
AND '||V_MASTER_CLAIM(J).COLUMN_NAME||' IS NOT NULL
AND ROWNUM = 1'
INTO V_EXISTS_RECORD_CLAIM USING v_tt, v_state,v_type;
Also there can be problem due to improper INDEXING on table as there is no INDEX on column TTID?
November 19, 2016 - 1:58 am UTC
If this is a frequent activity, you could create a custom index for this particular purpose, ie, an index on
ttid,state,type_of_claim
but obviously I dont have the required information to help you make that decision
Adding 1 more query
Hemant Singh, November 18, 2016 - 8:27 am UTC
Can we pass bind variable for '|| V_MASTER_CLAIM(J).COLUMN_NAME||' ?
While passing result was not appropriate, seems its a Identifier and hence can`t be passed like this ? Please confirm.
November 19, 2016 - 1:58 am UTC
No. Binding it for predicate *values* not for the tables/columns themselves