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.TE ST" 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_cus t_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_nu m,
sold_to_cust_na me,
cnt_email_adr,
cntry_code,
assrtmt_module_ id,
dlvry_provider_ name,
sap_sales_ord_n um,
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_cn t_prtnr_func ccpf1 where
so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Z1')
then select cnt.cnt_email_a dr from schema1.cust_cn t_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Z1' and
ccpf1.sap_cnt_i d=cnt.sap_cnt_i d
when exists(select 1 from schema1.cust_cn t_prtnr_func ccpf1 where
so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'ZT')
then select cnt.cnt_email_a dr from schema1.cust_cn t_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'ZT' and
ccpf1.sap_cnt_i d=cnt.sap_cnt_i d
when exists(select 1 from schema1.cust_cn t_prtnr_func ccpf1 where
so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Y8')
then select cnt.cnt_email_a dr from schema1.cust_cn t_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Y8' and
ccpf1.sap_cnt_i d=cnt.sap_cnt_i d
end,
cu.cntry_code,
ct.assrtmt_modu le_id,
cu.cust_name,
so.sap_sales_or d_num,
c.cnt_first_nam e,
c.cnt_last_name ,
so.mod_date,
so.add_date,
soli.sales_ord_ billd_flag
from
schema1.sales_o rd so join schema1.sales_o rd_line_item soli on
so.sap_sales_or d_num=soli.sap_ sales_ord_num
join schema1.cust_cn t_prtnr_func ccpf on
so.sold_to_cust _num=ccpf.cust_ num
join schema1.contact c on c.sap_cnt_id =ccpf.sap_cnt_i d
join schema1.custome r cu on c.cust_num=cu.c ust_num
join schema1.ctrct_t erms ct on so.sap_ctrct_nu m=ct.sap_ctrct_ num
where so.line_of_bus_ code='EM' and so.sap_sales_or d_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_nu m and
sds.stat_prfl=' ZDPLORD'
and sdus.line_item_ seq_num=0
and sdus.inact_flag =0
and (sdus.sap_doc_s tat in('E0001','E00 04','E0018','E0 029','E0030') or
sds.ovrl_cred_s tat='B')
)
and so.sap_sales_or d_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_o rd_num
and sds.stat_prfl=' ZDPLORD'
and sdus.line_item_ seq_num<>0
and sdus.inact_flag =0
and sdus.sap_doc_st at in ('E0001','E0002 ')
)
@
@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.TE ST" 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_cus t_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_nu m,
sold_to_cust_na me,
cnt_email_adr,
cntry_code,
assrtmt_module_ id,
dlvry_provider_ name,
sap_sales_ord_n um,
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_cn t_prtnr_func ccpf1 where
so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Z1')
then select cnt.cnt_email_a dr from schema1.cust_cn t_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Z1' and
ccpf1.sap_cnt_i d=cnt.sap_cnt_i d
when exists(select 1 from schema1.cust_cn t_prtnr_func ccpf1 where
so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'ZT')
then select cnt.cnt_email_a dr from schema1.cust_cn t_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'ZT' and
ccpf1.sap_cnt_i d=cnt.sap_cnt_i d
when exists(select 1 from schema1.cust_cn t_prtnr_func ccpf1 where
so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Y8')
then select cnt.cnt_email_a dr from schema1.cust_cn t_prtnr_func
ccpf1,
schema1.contact cnt where so.sold_to_cust _num=ccpf1.cust _num and
ccpf1.sap_cnt_p rtnr_func_code= 'Y8' and
ccpf1.sap_cnt_i d=cnt.sap_cnt_i d
end,
cu.cntry_code,
ct.assrtmt_modu le_id,
cu.cust_name,
so.sap_sales_or d_num,
c.cnt_first_nam e,
c.cnt_last_name ,
so.mod_date,
so.add_date,
soli.sales_ord_ billd_flag
from
schema1.sales_o rd so join schema1.sales_o rd_line_item soli on
so.sap_sales_or d_num=soli.sap_ sales_ord_num
join schema1.cust_cn t_prtnr_func ccpf on
so.sold_to_cust _num=ccpf.cust_ num
join schema1.contact c on c.sap_cnt_id =ccpf.sap_cnt_i d
join schema1.custome r cu on c.cust_num=cu.c ust_num
join schema1.ctrct_t erms ct on so.sap_ctrct_nu m=ct.sap_ctrct_ num
where so.line_of_bus_ code='EM' and so.sap_sales_or d_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_nu m and
sds.stat_prfl=' ZDPLORD'
and sdus.line_item_ seq_num=0
and sdus.inact_flag =0
and (sdus.sap_doc_s tat in('E0001','E00 04','E0018','E0 029','E0030') or
sds.ovrl_cred_s tat='B')
)
and so.sap_sales_or d_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_o rd_num
and sds.stat_prfl=' ZDPLORD'
and sdus.line_item_ seq_num<>0
and sdus.inact_flag =0
and sdus.sap_doc_st at in ('E0001','E0002 ')
)
@
Comment