17,382
社区成员




CREATE OR REPLACE VIEW sales_mal_price_query (NAME,
vendorid,
short,
cost_unitprice,
face,
glue,
release,
thickness,
barcode,
mc_color_text
)
AS
SELECT a.NAME, a.vendorid, b.short, g.cost_unitprice,
a.face || c.mc_face_text AS face,
a.glue || d.mc_glue_text AS glue,
a.release || e.mc_release_text AS release, a.thickness, a.barcode,
f.mc_color_text
FROM material.material a,
sales.vendor b,
material.mc_face c,
material.mc_glue d,
material.mc_release e,
material.mc_color f,
(SELECT MAX (x.cost_unitprice) cost_unitprice, y.barcode
FROM material.all_material_price_range x,
material.material y
WHERE x.barcode(+) = y.barcode
GROUP BY y.barcode) g
WHERE DECODE (:p_vendorid, NULL, '1', a.vendorid) =
DECODE (:p_vendorid,
NULL, '1',
:p_vendorid
)
AND DECODE (:p_face, NULL, '1', a.face) =
DECODE (:p_face,
NULL, '1',
:p_face
)
AND DECODE (:p_glue, NULL, '1', a.glue) =
DECODE (:p_glue,
NULL, '1',
:p_glue
)
AND DECODE (:p_release, NULL, '1', a.release) =
DECODE (:p_release,
NULL, '1',
:p_release
)
AND DECODE (:p_name, NULL, '1', a.NAME) LIKE
'%' || DECODE (:p_name, NULL, '1', :p_name)
|| '%'
AND a.vendorid = b.vendorid
AND a.face = c.mc_face_code
AND a.glue = d.mc_glue_code
AND a.release = e.mc_release_code
AND a.color1 || a.color2 = f.color1 || f.color2
AND a.barcode = g.barcode
ORDER BY barcode