Error while compiling view I get the following error when i compile the view given below.
@f3n11:/home/satish/views/> db2 -td@ -f sat.vw
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0204N "SCHEMA1.TEST" is an undefined name. SQLSTATE=42704
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "so.sold_to_cust_num,
so.sold_to_cust_name" was
found following "lld_flag ) as select". Expected tokens may include:
"<space>". SQLSTATE=42601
--------the foll. is the view code..........
drop view schema1.test
@
create view schema1.test
(
sold_to_cust_num,
sold_to_cust_name,
cnt_email_adr,
cntry_code,
assrtmt_module_id,
dlvry_provider_name,
sap_sales_ord_num,
cnt_fname,
cnt_lname,
mod_date,
add_date,
sales_ord_billd_flag
)
as select
so.sold_to_cust_num,
so.sold_to_cust_name,
case c.cnt_email_adr
when exists(select 1 from schema1.cust_cnt_prtnr_func ccpf1 where
so.sold_to_cust_num=ccpf1.cust_num and
ccpf1.sap_cnt_prtnr_func_code='Z1')
then select cnt.cnt_email_adr from schema1.cust_cnt_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust_num=ccpf1.cust_num and
ccpf1.sap_cnt_prtnr_func_code='Z1' and
ccpf1.sap_cnt_id=cnt.sap_cnt_id
when exists(select 1 from schema1.cust_cnt_prtnr_func ccpf1 where
so.sold_to_cust_num=ccpf1.cust_num and
ccpf1.sap_cnt_prtnr_func_code='ZT')
then select cnt.cnt_email_adr from schema1.cust_cnt_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust_num=ccpf1.cust_num and
ccpf1.sap_cnt_prtnr_func_code='ZT' and
ccpf1.sap_cnt_id=cnt.sap_cnt_id
when exists(select 1 from schema1.cust_cnt_prtnr_func ccpf1 where
so.sold_to_cust_num=ccpf1.cust_num and
ccpf1.sap_cnt_prtnr_func_code='Y8')
then select cnt.cnt_email_adr from schema1.cust_cnt_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust_num=ccpf1.cust_num and
ccpf1.sap_cnt_prtnr_func_code='Y8' and
ccpf1.sap_cnt_id=cnt.sap_cnt_id
end,
cu.cntry_code,
ct.assrtmt_module_id,
cu.cust_name,
so.sap_sales_ord_num,
c.cnt_first_name,
c.cnt_last_name,
so.mod_date,
so.add_date,
soli.sales_ord_billd_flag
from
schema1.sales_ord so join schema1.sales_ord_line_item soli on
so.sap_sales_ord_num=soli.sap_sales_ord_num
join schema1.cust_cnt_prtnr_func ccpf on
so.sold_to_cust_num=ccpf.cust_num
join schema1.contact c on c.sap_cnt_id =ccpf.sap_cnt_id
join schema1.customer cu on c.cust_num=cu.cust_num
join schema1.ctrct_terms ct on so.sap_ctrct_num=ct.sap_ctrct_num
where so.line_of_bus_code='EM' and so.sap_sales_ord_num not in
(select sds.sap_doc_num
from schema1.sap_doc_stat sds join schema1.sap_doc_user_stat sdus
on sds.sap_doc_num=sds.sap_doc_num and
sds.stat_prfl='ZDPLORD'
and sdus.line_item_seq_num=0
and sdus.inact_flag=0
and (sdus.sap_doc_stat in('E0001','E0004','E0018','E0029','E0030') or
sds.ovrl_cred_stat='B')
)
and so.sap_sales_ord_num not in
(select sds.sap_doc_num
from schema1.sap_doc_stat sds join schema1.sap_doc_user_stat sdus
on sds.sap_doc_num=so.sap_sales_ord_num
and sds.stat_prfl='ZDPLORD'
and sdus.line_item_seq_num<>0
and sdus.inact_flag=0
and sdus.sap_doc_stat in ('E0001','E0002')
)
@ |