Advertisement
psi_mmobile

Untitled

Nov 28th, 2023
881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 1.71 KB | None | 0 0
  1. SELECT
  2.     v.*,
  3.     vo.company_name vehicle_owner_name,
  4.     vo.vehicle_owner_id,
  5.     vovc.name       category_name,
  6.     vovc.graphical_symbol,
  7.     ru.remote_unit_type_id,
  8.     ru.serial_number,
  9.     ru.msisdn,
  10.     ru.imei,
  11.     ru.lm_comment   rucomment,
  12.     ru.msisdn_data,
  13.     ru.sim_nr,
  14.     ru.software_version,
  15.     ru.remote_unit_type_name,
  16.     vd.gps_full_date,
  17.     p.first_name
  18.     || ' '
  19.     || p.last_name  default_driver_name
  20. FROM
  21.     vehicle             v,
  22.     vo_vehicle_category vovc,
  23.     vehicle_owner       vo,
  24.     person              p,
  25.     vehicle_data        vd,
  26.     (
  27.         SELECT
  28.             ru.*,
  29.             TRIM(rut.model
  30.                  || ' '
  31.                  || rut.version
  32.                  || ' '
  33.                  || rut.RELEASE) remote_unit_type_name
  34.         FROM
  35.             remote_unit      ru,
  36.             remote_unit_type rut
  37.         WHERE
  38.             ru.remote_unit_type_id = rut.remote_unit_type_id
  39.     )                   ru
  40. WHERE
  41.         v.vo_vehicle_category_id = vovc.vo_vehicle_category_id (+)
  42.     AND v.remote_unit_id = ru.remote_unit_id (+)
  43.     AND v.vehicle_owner_id = vo.vehicle_owner_id
  44.     AND v.last_vehicle_data_id = vd.vehicle_data_id (+)
  45.     AND v.person_id = p.person_id (+)
  46.     AND EXISTS (
  47.         SELECT
  48.             gu_vehicle.vehicle_id
  49.         FROM
  50.             gu_vehicle
  51.         WHERE
  52.                 gui_user_id = 102737
  53.             AND v.vehicle_id = gu_vehicle.vehicle_id
  54.     )
  55.     AND ( ( v.in_service_date IS NULL )
  56.           OR ( v.in_service_date < SYSDATE ) )
  57.     AND ( ( v.out_service_date IS NULL )
  58.           OR ( v.out_service_date > SYSDATE ) )
  59. ORDER BY
  60.     vo.company_name,
  61.     vovc.name,
  62.     v.company_nr,
  63.     v.numberplate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement