CREATE OR REPLACE VIEW public.vw_bi_dim_book AS
 SELECT 0 AS "intBookId",
    ''::character varying AS "Book Code",
    'Undefined Book'::character varying AS "Book Name",
    '-'::character varying AS "Book Year"
UNION ALL
 SELECT adv.id AS "intBookId",
    adv.code AS "Book Code",
    adv.name AS "Book Name",
    "right"((adv.name)::text, 4) AS "Book Year"
   FROM (analytic_dimension ad
     JOIN analytic_dimension_value adv ON ((ad.id = adv.dimension)))
  WHERE ((ad.code)::text = 'book'::text);;
