Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. select js.*
  2. from D_V_LABMED_SAMPLES s
  3. join D_V_LBM_SAMPLE_DIRLINE sdl on sdl.PID = s.ID
  4. join D_V_LABMED_DIRECTION_LINE dl on dl.ID = sdl.DIRLINE
  5. join D_V_LABMED_RESEARCH r on r.ID = dl.RESEARCH_ID
  6. join D_V_LABMED_RSRCH_RES_LINK rl on rl.RESEARCH_ID = r.ID and rl.IS_ACTIVE = 1
  7. join D_V_LABMED_RESEARCH_RES rr on rr.ID = rl.RES_RESULT
  8. and rr.ID = 86915198
  9. --left join D_V_LABMED_ALTER_MEASURE am on am.RSRCH_RES_LINK = rl.ID
  10. left join D_V_LABMED_RSRCH_JOURSP js on js.RESULT_ID = rl.RES_RESULT
  11. and js.DIR_LINE = dl.ID
  12. and js.STR_VALUE is null
  13. and js.IS_ACTUAL = 1
  14.  
  15. --and js.CONFIRM_STATUS in (0, 1)
  16. and dbms_lob.getlength(js.TEXT_VALUE) is null
  17.  
  18. and js.CONFIRM_STATUS = 0
  19.  
  20. --left join D_V_LABMED_RES_VAL_LINK rvl on rvl.RSRCH_RES_LINK = rl.ID
  21. --left join D_V_LABMED_RSRCH_RES_VAL rv on rv.ID = rvl.RSRCH_RES_VAL
  22. where dl.STATUS_ID in (3, 4)
  23. and sdl.IS_REJECTED = 0
  24. and s.LPU = :LPU
  25. --and ((s.RES_OTHER_LPU = 1 and rr.LPU_FROM is not null) or (s.RES_OTHER_LPU != 1 and rr.LPU_FROM is null))
  26.  
  27. and s.ID = :LABMED_SAMPLE
  28.  
  29. and exists(select null
  30. from D_V_LABMED_WL_RSRCH_METHODS v
  31. join D_V_LABMED_RESEARCH_METHODS v2 on v2.ID = v.RMETHOD_ID
  32. where v.PID = :WORK_LIST
  33. and v2.PID = r.ID
  34. and v.AVAILABLE_FROM <= to_date('01.01.0001' || to_char(coalesce(to_date(D_PKG_SES.GETCONTEXT('MED', 'LOGON_DATE'), 'dd.mm.yyyy hh24:mi:ss'), sysdate), D_PKG_STD.FRM_T), D_PKG_STD.FRM_DT)
  35. and v.AVAILABLE_TO >= to_date('01.01.0001' || to_char(coalesce(to_date(D_PKG_SES.GETCONTEXT('MED', 'LOGON_DATE'), 'dd.mm.yyyy hh24:mi:ss'), sysdate), D_PKG_STD.FRM_T), D_PKG_STD.FRM_DT))
  36. and ((exists(select null
  37. from D_V_LABMED_WL_RSRCH_METHODS v
  38. join D_V_LABMED_RESEARCH_METHODS v2 on v2.ID = v.RMETHOD_ID
  39. where v.PID = :WORK_LIST
  40. and v2.PID = r.ID)
  41. and not exists(select dw.WORKLIST_ID
  42. from D_V_LBM_DIRLINE_WORKLIST dw
  43. where dw.PID = dl.ID
  44. and dw.WORKLIST_ID != :WORK_LIST))
  45. or exists(select dw.WORKLIST_ID
  46. from D_V_LBM_DIRLINE_WORKLIST dw
  47. where dw.PID = dl.ID
  48. and dw.WORKLIST_ID = :WORK_LIST))
  49.  
  50. LPU 10903
  51. WORK_LIST 68759532
  52. LABMED_SAMPLE 98703677
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement