Dim strDBDesc As String
strDBDesc = "(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = ##)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ##)))"
cn.Open "Provider=OraOLEDB.Oracle;Data Source=" & strDBDesc & ";User ID=##;Password=##;"
query1 = ""
query1 = ERM.Sheets("query").Range("A10")
query1 = Replace(query1, "v_job_name", v_field1)
'Set OraDynaSet = objdatabase.DBCreateDynaset(query1, 0&)
Dim OraDynaSet As ADODB.Recordset
Set OraDynaSet = CreateObject("ADODB.Recordset")
OraDynaSet.ActiveConnection = cn
OraDynaSet.Open query1, cn, adOpenStatic
Я получаю сообщение об ошибке, поскольку команда ORA-00933 sql не завершена должным образом
Сообщение об ошибке
Запрос1
select
job_name,Status
from (
select Distinct a.job_name,
a.description description,Decode (job_type,98,'Box',99,'Command Job',102,'File watcher job',job_type) job_type,
substr(decode(d.status,1,'Running',
3,'Starting',
4,'Success',
5,'Failed',
6,'Terminated',
7,'On Ice',
8,'Inactive',
9,'Activated',
11,'On Hold',
12,'Que Wait',
d.status),1,9) status,
a.mach_name,a.owner,g.command,g.std_err_file,g.std_out_file,f.days_of_week,f.start_times,f.start_mins,f.run_calendar,f.max_run_alarm,profile
from AEDBADMIN.ujo_job a,
AEDBADMIN.ujo_job_runs c,
AEDBADMIN.ujo_job_status d,
(select joid,max(STARTIME) startime,
max(endtime) endtime
from AEDBADMIN.ujo_job_runs group by joid) e,
AEDBADMIN.ujo_command_job g,
AEDBADMIN.ujo_sched_info f
where a.joid = c.joid(+)
and a.joid = d.joid(+)
and a.joid = e.joid(+)
and a.joid = f.joid(+)
and a.joid = g.joid(+)
and (c.startime = e.startime or c.startime is null)
and job_name ='v_job_name'// job name replaces
and a.is_active =1
);