, also möchte ich eine gespeicherte Prozedur (Oracle) in C# aufrufen, aber ich weiß nicht die genaue Syntax, und außerdem weiß ich nicht, ob es Parameter benötigt oder nicht, weil diese Prozedur nimmt die Parameter und weist sie automatisch zu, welcher Parameter sollte ich ihr übergeben?Aufruf einer gespeicherten Oracle-Prozedur in C#
unten ist die gespeicherte Prozedur
create or replace procedure p_delete_tt_duration_10min is
new_status varchar2(50);
status varchar2(20);
p_tkt varchar2(50);
cursor prt_cursor is
SELECT a.id,
a.ticketno,
to_number(a.outagedurationmin),
a.fault_occur_time,
a.auto_clear_time
FROM pmp_bpm_troubleticket a
WHERE a.fault_id IS NOT NULL
AND a.fault_occur_time IS NOT NULL
--and a.generatedby = 'Automatic'
AND ((a.tt_type IN ('Cell/Sector Down',
'3G Cell Down Alarm',
'4G Cell Down Alarm') AND
to_number(a.outagedurationmin) < 18) OR
(a.tt_type IN ('Site Down',
'NodeB Down Alarm',
'ENodeB Down Alarm',
'TRX/Equipment Faulty',
'Processing Problem',
'GPRS Down',
'Media disconnect',
'Hardware Fault',
'Link Down') and
to_number(a.outagedurationmin) < 10))
AND a.fault_occur_time >= '2017-04-01 00:00:00' order by to_number(a.outagedurationmin) desc;
begin
for prt_temp in prt_cursor loop
p_tkt := prt_temp.id;
delete from wf_assignment t
where t.assignment_id in
(select id from wf_dai_ban_task a where a.primary_key = p_tkt);
commit;
delete from wf_dai_ban_task a where a.primary_key = p_tkt;
commit;
delete from wf_yi_ban_task a where a.primary_key = p_tkt;
commit;
delete from pmp_bpm_task_expand_info a where a.primary_key = p_tkt;
commit;
delete from PMP_BPM_CC_LIST a where a.primarykey = p_tkt;
commit;
delete FROM PMP_BPM_TROUBLETICKET_PROCESS D
WHERE D.ACTIVITYID IN (SELECT W.ID
FROM PMP_BPM_TROUBLETICKET_ACTIVITY W
WHERE W.PRIMARYKEY = p_tkt);
commit;
delete from PMP_BPM_TROUBLETICKET_ACTIVITY a
where a.primarykey = p_tkt;
commit;
delete from PMP_BPM_TROUBLETICKET a where a.id = p_tkt;
commit;
end loop;
end;
Vielen Dank im Voraus.
schreiben Warum machen Sie löschen nach jedem COMMIT? Die meisten Löschbefehle sollten besser über eine Foreign Key Constraint ausgeführt werden. Und die Schleife ist auch nicht erforderlich. –
Ihr Verfahren nimmt keinen Parameter an! –
@WernfriedDomscheit es ist nicht meine Prozedur, ich möchte diese vordefinierte Prozedur nur in C# – Bilal