我开始用PL/SQL进行开发,我使用的是Oracle 10g的版本,并且有一个看似简单的问题。
PL/SQL 客户端中的相同代码运行良好,查询运行没有错误。但是当我通过 SQL *PLUS 运行时,他向我显示以下错误;
(select campagne_id,
*
第 13 行出现错误:ORA-00933:SQL 命令未正确结束
下面你可以看到代码,如果有人有建议,请发给我。
set underline off
set NEWP NONE
set feed off
set heads off
set hea off
set verify off
set trims on
set pagesize 50000
set linesize 32767
spool /home/dsadm/br/sh_synchro/data/elison/report_usa.csv
select 'CAMPAIGN_ID'||chr(9)||'CAMPAIGN_NAME'||chr(9)||'SEND_DATE'||chr(9)||'MESSAGE'||chr(9)||'SUBJECT'||chr(9)||'SELECTED'||chr(9)||'OPENS_NB'||chr(9)||'OPENED_P'||chr(9)||'TOTAL_CLICKS'||chr(9)||'CLICK_THROUGHS_NB'||chr(9)||'CLICK_THROUGH'||chr(9)||'ACTION_CLICKS' FROM DUAL;
select t1.campanha_id ||chr(9)|| t1.name||chr(9)|| t1.dateenvio||chr(9)|| t1.subject||chr(9)|| t1.nb_selected||chr(9)|| t1.nb_opened||chr(9)|| trunc(t3.opened_p, 2)||chr(9)|| t1.nb_total_click||chr(9)||t3.clickthrough||chr(9)||trunc(t3.clickthrough_p, 2)||chr(9)||t2.clickes
from (select rc.nb_selected,`RC.NB_OPENED NB_OPENED,
RC.NB_TOTAL_CLICK NB_TOTAL_CLICK,
c.name NAME,
c.dateenvoi DATEENVIO,
m.subject SUBJECT,
c.campagne_id CAMPANHA_ID
FROM report_campagne rc, campagne c, message m
WHERE c.campagne_id = rc.campagne_id
and c.ctype=0
and m.message_id = c.message_id
and c.campagne_id=1926832) t1,
(select sum(nb_clicks) as clickes, l.campaign_id as campanha_id
from url u, report_camp_link l
where u.url_id = l.link_id
and u.type = 3
and u.client_id = 1101001556
and l.campaign_id in
(select campagne_id
from campagne
where client_id = 1101001556
and ctype=0
and campagne_id=1926832)
group by l.campaign_id) t2,(select campagne_id,
sum(decode(r.status, 1, 1, 2, 1, 3, 1, 0)) opens,
case
when (sum(decode(r.status, 0, 1, 1, 1, 2, 1, 3, 1, 0))) > 0 then
(sum(decode(r.status, 1, 1, 2, 1, 3, 1, 0)) /
sum(decode(r.status, 0, 1, 1, 1, 2, 1, 3, 1, 0))) * 100
else
0
end opened_p,
sum(r.regular_click_nb) total_clicks,
sum(decode(r.status, 2, 1, 3, 1, 0)) clickthrough,
case
when (sum(decode(r.status, 0, 1, 1, 1, 2, 1, 3, 1, 0))) > 0 then
(sum(decode(r.status, 2, 1, 3, 1, 0)) /
sum(decode(r.status, 0, 1, 1, 1, 2, 1, 3, 1, 0))) * 100
else
0
end clickthrough_p
from worldnetdaily_report r
where CAMPAGNE_ID in
(select campagne_id
from campagne
where client_id = 1101001556
and ctype=0
and campagne_id=1926832)
group by campagne_id) t3`where t1.campanha_id = t2.CAMPANHA_ID
and t2.campanha_id = t3.campagne_id(+)
and t3.campagne_id = t1.campanha_id(+);
spool on
quit`