Hello,
can you please help me to limit number of characters of this query?
OTM restricts amount of fields to 2000 characters, so I need to condense following query.
Can you please give me a tip how I can use the postal codes which are repeating?
Thank you so much!
select v1.order_release_gid
from OTM_TM_NNL_OR_PLANNING v1, otm_planning_mv v2
where v1.or_sloc = 'GTS.TM_NNL1_C_OFMR_ZZ'
and v1.order_release_gid = v2.order_release_gid
AND ((((trunc(v1.or_epd) <= trunc(current_date + v1.sl_ofs) AND
(trunc(v1.or_lpd) >= trunc(current_date + v1.sl_ofs))) OR
(trunc(v1.or_lpd) <= trunc(current_date + v1.sl_ofs)) OR
(trunc(v1.or_ldd) <= trunc(current_date + v1.sl_ofs + 2))) AND
((((v2.country_code3_gid = 'GR' and
substr(v2.postal_code, 0, 2) not in
('16',
'06',
'07',
'13',
'26',
'30',
'34',
'83',
'84',
'09',
'11',
'12',
'24',
'31',
'32',
'33',
'40',
'46',
'47',
'48',
'64',
'65',
'66',
'81',
'82')) OR
(v1.dl_ctr = 'GR' andv2.country_code3_gid != 'JP')) OR
v1.dl_ctrIN('CN', 'HK', 'JP') ORv1.dl_ctr = 'DK'))) OR
(((trunc(v1.or_epd) <= trunc(current_date + v1.sl_ofs) AND
(trunc(v1.or_lpd) >= trunc(current_date + v1.sl_ofs))) OR
(trunc(v1.or_lpd) <= trunc(current_date + v1.sl_ofs)) OR
(trunc(v1.or_ldd) <= trunc(current_date + v1.sl_ofs + 3))) AND
v1.dl_ctr = 'CR' andv1.dl_pc4 = '6690' and exists
(select 'o'
from location_refnum lr
where lr.location_gid = or_dloc
andlr.location_refnum_qual_gid = 'OTM_OTOMAC_ID'
andlr.location_refnum_valuein('787351', '97801'))) OR
(((trunc(or_epd) <= trunc(current_date + sl_ofs) AND
(trunc(or_lpd) >= trunc(current_date + sl_ofs))) OR
(trunc(or_lpd) <= trunc(current_date + sl_ofs)) OR
(trunc(or_ldd) <= trunc(current_date + sl_ofs + 3))) AND
(dl_ctr = 'SP')) OR
(((trunc(or_epd) <= trunc(current_date + sl_ofs) AND
(trunc(or_lpd) >= trunc(current_date + sl_ofs))) OR
(trunc(or_lpd) <= trunc(current_date + sl_ofs)) OR
(trunc(or_ldd) <= trunc(current_date + sl_ofs + 7))) AND
(dl_ctr = 'GC')) OR
((((trunc(v1.or_epd) <= trunc(current_date + v1.sl_ofs) AND
(trunc(v1.or_lpd) >= trunc(current_date + v1.sl_ofs))) OR
(trunc(v1.or_lpd) <= trunc(current_date + v1.sl_ofs)) OR
(trunc(v1.or_ldd) <= trunc(current_date + v1.sl_ofs + 3))) AND
(v2.country_code3_gid = 'GR' andsubstr(v2.postal_code, 0, 2) in
('16',
'06',
'07',
'13',
'26',
'30',
'34',
'83',
'84',
'09',
'11',
'12',
'24',
'31',
'32',
'33',
'40',
'46',
'47',
'48',
'64',
'65',
'66',
'81',
'82'))) or
(v1.dl_ctr = 'GR' andv2.country_code3_gid != 'JP') OR
v1.dl_ctrIN('CN', 'HK', 'JP') ORv1.dl_ctr = 'DK'))
can you please help me to limit number of characters of this query?
OTM restricts amount of fields to 2000 characters, so I need to condense following query.
Can you please give me a tip how I can use the postal codes which are repeating?
Thank you so much!
select v1.order_release_gid
from OTM_TM_NNL_OR_PLANNING v1, otm_planning_mv v2
where v1.or_sloc = 'GTS.TM_NNL1_C_OFMR_ZZ'
and v1.order_release_gid = v2.order_release_gid
AND ((((trunc(v1.or_epd) <= trunc(current_date + v1.sl_ofs) AND
(trunc(v1.or_lpd) >= trunc(current_date + v1.sl_ofs))) OR
(trunc(v1.or_lpd) <= trunc(current_date + v1.sl_ofs)) OR
(trunc(v1.or_ldd) <= trunc(current_date + v1.sl_ofs + 2))) AND
((((v2.country_code3_gid = 'GR' and
substr(v2.postal_code, 0, 2) not in
('16',
'06',
'07',
'13',
'26',
'30',
'34',
'83',
'84',
'09',
'11',
'12',
'24',
'31',
'32',
'33',
'40',
'46',
'47',
'48',
'64',
'65',
'66',
'81',
'82')) OR
(v1.dl_ctr = 'GR' andv2.country_code3_gid != 'JP')) OR
v1.dl_ctrIN('CN', 'HK', 'JP') ORv1.dl_ctr = 'DK'))) OR
(((trunc(v1.or_epd) <= trunc(current_date + v1.sl_ofs) AND
(trunc(v1.or_lpd) >= trunc(current_date + v1.sl_ofs))) OR
(trunc(v1.or_lpd) <= trunc(current_date + v1.sl_ofs)) OR
(trunc(v1.or_ldd) <= trunc(current_date + v1.sl_ofs + 3))) AND
v1.dl_ctr = 'CR' andv1.dl_pc4 = '6690' and exists
(select 'o'
from location_refnum lr
where lr.location_gid = or_dloc
andlr.location_refnum_qual_gid = 'OTM_OTOMAC_ID'
andlr.location_refnum_valuein('787351', '97801'))) OR
(((trunc(or_epd) <= trunc(current_date + sl_ofs) AND
(trunc(or_lpd) >= trunc(current_date + sl_ofs))) OR
(trunc(or_lpd) <= trunc(current_date + sl_ofs)) OR
(trunc(or_ldd) <= trunc(current_date + sl_ofs + 3))) AND
(dl_ctr = 'SP')) OR
(((trunc(or_epd) <= trunc(current_date + sl_ofs) AND
(trunc(or_lpd) >= trunc(current_date + sl_ofs))) OR
(trunc(or_lpd) <= trunc(current_date + sl_ofs)) OR
(trunc(or_ldd) <= trunc(current_date + sl_ofs + 7))) AND
(dl_ctr = 'GC')) OR
((((trunc(v1.or_epd) <= trunc(current_date + v1.sl_ofs) AND
(trunc(v1.or_lpd) >= trunc(current_date + v1.sl_ofs))) OR
(trunc(v1.or_lpd) <= trunc(current_date + v1.sl_ofs)) OR
(trunc(v1.or_ldd) <= trunc(current_date + v1.sl_ofs + 3))) AND
(v2.country_code3_gid = 'GR' andsubstr(v2.postal_code, 0, 2) in
('16',
'06',
'07',
'13',
'26',
'30',
'34',
'83',
'84',
'09',
'11',
'12',
'24',
'31',
'32',
'33',
'40',
'46',
'47',
'48',
'64',
'65',
'66',
'81',
'82'))) or
(v1.dl_ctr = 'GR' andv2.country_code3_gid != 'JP') OR
v1.dl_ctrIN('CN', 'HK', 'JP') ORv1.dl_ctr = 'DK'))