我嘗試用白色的大型SQL查詢是這樣的:嘗試使用大型SQL查詢
insert into R7810TEST
(select 1111111 , 111111 , 1111111 ,'ORG' ,R401.ZIHUI_BAAL_POLISA ,8990 ,'ID' ,R401.ZIHUI_M_RASHI , R401.M_POLISA ,R440.M_SOCHEN , 201507 ,'ORG' , R401.ZIHUI_BAAL_POLISA ,'RTP' , 'CUR' , '1', '*' ,0 ,10000.00 ,0.00 , 0.00 , 0.00, 0.00, 0.00 , 0.00,0.00, 0.00 , r430.hf_oved_tagmulim_45 ,r430.hf_mavid_tagmulim , r430.hf_mavid_pizuim_mukar , 0.00, r430.hf_mavid_chelef, r430.hf_oved_shonot, r430.hf_mavid_shonot , r430.hf_oved_tagmulim_47 ,'MNG', 0.00 , 0.00 ,0.00 ,0.00 , '*' , to_date ('20150701', 'yyyymmdd'), R401.ZIHUI_BAAL_POLISA, r400.sug_polisa, to_date ('20150701', 'yyyymmdd'),'CHI', '12' , 0, 0 ,'0', to_date ('19000101', 'yyyymmdd')
from r400 R400 ,r401 R401 ,r430 r430 ,r440 r440
where r400.m_polisa = r401.m_polisa
and r401.m_polisa = r430.m_polisa
and r430.m_polisa= r440.m_polisa
and r401.tr_rishum in (select max(aa.tr_rishum) from r401 aa where aa.m_polisa = r401.m_polisa)
and r430.tr_rishum in (select max(aa.tr_rishum) from r430 aa where aa.m_polisa = r430.m_polisa)
and r440.tr_rishum in (select max(aa.tr_rishum) from r440 aa where aa.m_polisa = r440.m_polisa)
and r401.status_rashi = 10
--and r401.status_rashi in (30,35)
----and r401.status_rashi in (90)
--and r401.status_rashi = 20
and r400.sug_polisa in ('1','3','5','7')
and r400.sug_hishtatfut <>0
and r400.sug_hazmada <>0
and r400.m_polisa IN (XXXXX));
而且我從SQL例外,我通過Excel中使用Oracle和VBA,我認爲這太大字符串,所以它不工作,並且sql成爲查詢的一部分。我該如何在vba代碼中使用此查詢?
你需要告訴我們你得到了什麼錯誤。這個查詢不是太大。 –
刪除圓括號,'insert into R7810TEST select ...'。 – jarlh
:描述:「ORA-00907:缺少右括號」:字符串:但是如果我在qurey上如此行動,所以不是所有的qurey在嚴格的內部,並且是sql認爲缺少右括號 – Tzahi