/* TC BOMView Precice  New:06.07.14 L.Up 11.08.17 */
SELECT
  i.puid         AS BOML_i_puid,
  i.pitem_id     AS BOML_pitem_id,
  ir.puid        AS BOML_ir_puid,
  ir.pitem_revision_id AS BOML_pitem_revision_id,
  bo.pseq_no     AS BOML_pseq_no,
  bo.puid        AS BOML_puid,
  bo.rnotes_refu AS BOML_OcN_ptt_puid,
  bvr.pstruct_last_mod_date AS BOMV_pstruct_last_mod_date,
  
  bo.pqty_value            AS BOML_qty_val,  
  bo.pext_transform_rot00  AS BOML_trf_rot00,
  bo.pext_transform_rot01  AS BOML_trf_rot01,
  bo.pext_transform_rot02  AS BOML_trf_rot02,
  bo.pext_transform_rot10  AS BOML_trf_rot10,  
  bo.pext_transform_rot11  AS BOML_trf_rot11,
  bo.pext_transform_rot12  AS BOML_trf_rot12,
  bo.pext_transform_rot20  AS BOML_trf_rot20,
  bo.pext_transform_rot21  AS BOML_trf_rot21, 
  bo.pext_transform_rot22  AS BOML_trf_rot22,
  bo.pext_transform_per0   AS BOML_trf_per0,
  bo.pext_transform_per1   AS BOML_trf_per1,
  bo.pext_transform_per2   AS BOML_trf_per2,
  bo.pext_transform_tra0   AS BOML_trf_tra0,
  bo.pext_transform_tra1   AS BOML_trf_tra1,
  bo.pext_transform_tra2   AS BOML_trf_tra2,
  bo.pext_transform_invscale AS BOML_trf_invscale,  
  bo.pref_designator      AS BOML_ref_designator,
  bo.rchild_itemu         AS BOML_child_itemu,
  bo.rchild_itemc         AS BOML_child_itemc,
  bo.poccurrence_name     AS BOML_occurre_name,
  bo.poccurrence_type     AS BOML_occurre_type,
  bo.porder_no            AS BOML_order_no
  
  
FROM
 infodba.POM_BACKPOINTER bp
 INNER JOIN infodba.PPSBOMVIEWREVISION bvr ON (bvr.puid = bp.to_uid)
 INNER JOIN infodba.PPSOCCURRENCE bo ON (bo.rparent_bvru = bvr.puid)
 INNER JOIN infodba.PITEMREVISION ir ON (ir.puid = bo.rchild_itemu)
 INNER JOIN infodba.PITEM i ON (i.puid = ir.ritems_tagu)

 LEFT JOIN infodba.PPSBOMVIEW bv on (bvr.rbom_viewu = bv.puid)
 LEFT JOIN infodba.PPSVIEWTYPE bvt on (bvt.puid = bv.rview_typeu)
WHERE
 bp.from_uid = :para_ir_puid
 AND upper(bvt.pname) in ('VIEW', 'CATIA_MULTI_MODEL', 'CATIA')
