La procédure est très simple:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| CREATE OR REPLACE procedure dbo.deleteEast
(
v_ID varchar2,
v_Result OUT int ,
v_status varchar2 default '0',
v_tool varchar2 := NULL)
AS
vson varchar2(38):=v_ID;
vs varchar2(38);
vfather varchar2(38);
v_val DATE;
BEGIN
v_Result := -1;
while (1=1) loop
/* 1 step-forward*/
vs:=NULL;
select ID into vs from westtable where IDParentGroup=vson ;
if (vs is null) then
/* step-forward fails
-- 2 staff on deletion*/
select IDParentGroup into vfather from westtable where ID=vson;
delete from northtable where IDGroup = vson;
update quarktable SET IDGroup = NULL WHERE IDGroup = vson;
delete from northtable where ID = vson ;
if(vson=v_ID ) then
v_Result := 0;
exit;
end if;
vs:=NULL;
select ID into vs from westtable where IDParentGroup=vfather and vson<>ID;
if(vs is NULL)then
vson:=vfather; /* return to parent so on next step of the loop to be deleted */
end if ;
vson:=vs;
end if ;
vson:=vs;
end loop;
if v_Result <> 0 then
ROLLBACK ;
return;
else
commit;
IF (v_status <> '0')then
ChangeTool(v_tool,v_val);
Return;
end if;
return ;
end if; |
Pour le code C++ utilisant ADO, voici la variable en paramètre de la procédure
_variant_t varTemp_bStat = a_bStatus;
Puis on affecte juste ce _variant_t au Value d'un FieldPtr et c'est tout!!!
Et pourtant ça marche pas!
Partager