Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT AttachDoc.ATTACH_DOC_ID,
- AttachDoc.CONTENT_TYPE_ID,
- AttachDoc.CREATION_DATE,
- AttachDoc.DESCRIPTION,
- AttachDoc.DOCUMENT_DATE,
- AttachDoc.DOCUMENT_TYPE_ID,
- AttachDoc.EXPIRY_DATE,
- AttachDoc.FILE_PATH,
- AttachDoc.LM_COMMENT,
- AttachDoc.LM_DATE,
- AttachDoc.LM_NAME,
- AttachDoc.NAME,
- AttachDoc.ORDER_NUM,
- AttachDoc.PERSON_ID,
- AttachDoc.VEHICLE_ID,
- AttachDoc.GUI_USER_ID,
- AttachDoc.GENERIC_EVENT_ID,
- AttachDoc.SHORT_NAME,
- AttachDoc.POI_ID,
- AttachDoc.OBJECT_ID,
- Person.PERSON_ID AS PERSON_ID1,
- (Person.LAST_NAME || ' ' || Person.FIRST_NAME) AS VIEW_ATTR,
- P_WBS.getWbsName(AttachDoc.wbs_id, AttachDoc.POI_ID) AS VIEW_ATTR,
- (GuiUsers.LAST_NAME || ' ' || GuiUsers.FIRST_NAME) AS VIEW_ATTR,
- (Vehicle.COMPANY_NR || ' ' || Vehicle.NUMBERPLATE) AS VIEW_ATTR,
- NVL2 (Object.vehicle_id, '['|| Object.COMPANY_NR || '].[' || Object.numberplate || ']' , NULL) AS VIEW_ATTR,
- ('[' || P_WBS.getWbsName(AttachDoc.wbs_id, AttachDoc.POI_ID) || '].[' || AttachDoc.NAME || '].[' || Person.LAST_NAME || ' ' || '].[' || Person.FIRST_NAME || ' ' || Person.LAST_NAME || '].[' || Vehicle.Numberplate || '].[' || VoVehicleCategory.name || '].[' || Object.numberplate || ']') AS VIEW_ATTR,
- AttachDoc.WBS_ID,
- AttachDoc.REF_NUMBER,
- (SELECT numberplate FROM vehicle v WHERE v.vehicle_id = AttachDoc.VEHICLE_ID) AS VIEW_ATTR,
- (SELECT company_nr FROM vehicle v WHERE v.vehicle_id = AttachDoc.VEHICLE_ID) AS VIEW_ATTR,
- DocumentType.DOCUMENT_TYPE_CATEGORY_ID,
- DocumentType.DOCUMENT_TYPE_ID AS DOCUMENT_TYPE_ID1
- FROM OF_OWNER.ATTACH_DOC AttachDoc, V_UPDATABLE_PERSON Person, GUI_USERS GuiUsers, VEHICLE Vehicle, VEHICLE Object, VO_VEHICLE_CATEGORY VoVehicleCategory, OF_OWNER.DOCUMENT_TYPE DocumentType
- WHERE AttachDoc.person_id = Person.person_id (+)
- AND AttachDoc.DOCUMENT_TYPE_ID = DocumentType.DOCUMENT_TYPE_ID(+)
- AND AttachDoc.GUI_USER_ID = GuiUsers.GUI_USER_ID
- AND AttachDoc.vehicle_id = Vehicle.vehicle_id (+)
- AND AttachDoc.OBJECT_ID = Object.vehicle_id (+)
- AND Object.VO_VEHICLE_CATEGORY_ID = VoVehicleCategory.VO_VEHICLE_CATEGORY_ID (+)
- AND ( AttachDoc.PERSON_ID IN
- (SELECT PERSON_ID FROM GU_PERSON WHERE GUI_USER_ID = ?)
- OR AttachDoc.VEHICLE_ID IN
- (SELECT VEHICLE_ID FROM GU_VEHICLE WHERE GUI_USER_ID = ?)
- OR AttachDoc.object_id IN
- (SELECT VEHICLE_ID FROM GU_VEHICLE WHERE GUI_USER_ID = ?)
- OR AttachDoc.poi_id IN
- (SELECT poi_id FROM v_gui_user_oc_poi WHERE gui_user_id = ?)
- OR AttachDoc.wbs_id IN
- (SELECT wbs_id FROM wbs WHERE vehicle_owner_id IN (SELECT DISTINCT vehicle_owner_id FROM gu_vehicle_owner WHERE gui_user_id = ?))
- OR AttachDoc.gui_user_id = ?)
- AND (? IS NULL OR AttachDoc.PERSON_ID = ?)
- AND (? IS NULL OR AttachDoc.VEHICLE_ID = ?)
- AND (? IS NULL OR AttachDoc.POI_ID = ?)
- AND (? IS NULL OR AttachDoc.OBJECT_ID = ?)
- AND (? IS NULL OR AttachDoc.WBS_ID = ?)
- AND (DocumentType.DOCUMENT_TYPE_CATEGORY_ID = 101)
- ORDER BY CREATION_DATE DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement