Bonjour,

Je doit créer 2 proc une en sybase et une en oracle.
J'utilise la fonction case en oracle et ca fonctionne par contre en sybase sa bloque

pour oracle je fait
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
create or replace
procedure WEB_CSWEB_VILPORNET
 
IS
 
TypeInsert VARCHAR(70);
 
BEGIN
	--recupere la valeur de WEB_ALIM_VILPORNET pour connaiter le mode d'alimentation de la table WEB_VILPORNET
	select nvl(max(INIVAL),'VOIEILOT') into TypeInsert
	from WEB_INI where ININAME='WEB_ALIM_VILPORNET';
 
	case TypeInsert
		when 'GEOCODAGE' THEN 
			execute immediate('insert into web.web_vilpornet
								select codine,copos6,cmuabn,null
								from abo.xpbartp2 t
								where exists (select 1 from vnd.si05 s 
                                      where s.ccoins = t.ccoins)');
		when 'SPEC_FS' then 
			execute immediate('insert into web.web_vilpornet 
								select codine,copos6,cmuabn,null 
								from abo.xpbartp2 t 
								where exists (select 1 from abo.voieilot v 
                                      where v.voiins = codine 
                                      and voicodilo = ''I100'')');
		when 'VOIEILOT' then
			execute IMMEDIATE ('insert into web.web_vilpornet
                select codine,copos6,cmuabn,null 
								from abo.xpbartp2 t
								where exists (select 1 from abo.voieilot v 
                                      where v.voiins = codine)');
    WHEN 'SPEC_NM' THEN
      execute immediate ('insert into web.web_vilpornet
                select codine,copos6,cmuabn,null 
                from abo.xpbartp2 t
                where exists (select 1 from abo.voieilot v 
                                      where v.voiins = codine)');
      execute immediate ('insert into web.web_vilpornet
                select codine,copos6,cmuabn,null 
                from abo.XPBARTP2
                where substr(CODINE,1,6) IN (''006999'', ''083137'', ''020033'', ''006088'', ''020004'')
                and substr (codine,7,1) in (''X'', ''E'') ');
    /*pour toute autre valeur dans la table WEB_INI execution de la meme insertion que pour VOIEILOT
    ceci pour prévoir en cas de changement*/
		ELSE 
			execute IMMEDIATE ('insert into web.web_vilpornet
								select codine,copos6,cmuabn,null 
								from abo.xpbartp2 t
								where exists (select 1 from abo.voieilot v 
                                      where v.voiins = codine)');
	end case;
	commit;
end;
mais en sybase si je met ce code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
use web
 
/*declare @nomobj varchar(255)
if exists(select 1 from sysobjects where upper(name)=upper('WEB_CSWEB_VILPORNET') and type='P')
      begin
      select @nomobj=name  from sysobjects where upper(name)=upper('WEB_CSWEB_VILPORNET') and type='P'
      execute('drop procedure ' + @nomobj)
      end
go*/
 
create proc WEB_CSWEB_VILPORNET
 
as
 
declare @TypeInsert VARCHAR(70)
 
--recupere la valeur de WEB_ALIM_VILPORNET pour connaitre le mode d'alimentation de la table WEB_VILPORNET
select @TypeInsert=isnull(INIVAL,'VOIEILOT') 
from WEB_INI where ININAME='WEB_ALIM_VILPORNET'
 
select case @TypeInsert
	when 'GEOCODAGE' THEN 
		execute('insert into web..web_vilpornet
					select codine,copos6,cmuabn,null
					from abo..xpbartp2 t
					where exists (select 1 from vnd..si05 s 
											where s.ccoins = t.ccoins)')
	when 'SPEC_FS' then 
		execute('insert into web..web_vilpornet 
					select codine,copos6,cmuabn,null 
					from abo..xpbartp2 t 
					where exists (select 1 from abo..voieilot v 
											where v.voiins = codine 
											and voicodilo = ''I100'')')
	when 'VOIEILOT'
		execute('insert into web..web_vilpornet
					select codine,copos6,cmuabn,null 
					from abo..xpbartp2 t
					where exists (select 1 from abo..voieilot v 
											where v.voiins = codine)')
	WHEN 'SPEC_NM' THEN
		execute('insert into web..web_vilpornet
					select codine,copos6,cmuabn,null 
					from abo..xpbartp2 t
					where exists (select 1 from abo..voieilot v 
											where v.voiins = codine)')
		execute('insert into web..web_vilpornet
					select codine,copos6,cmuabn,null 
					from abo..XPBARTP2
					where substr(CODINE,1,6) IN (''006999'', ''083137'', ''020033'', ''006088'', ''020004'')
					and substr (codine,7,1) in (''X'', ''E'') ')
	/*pour toute autre valeur dans la table WEB_INI execution de la meme insertion que pour VOIEILOT
	ceci pour prévoir en cas de changement*/
	ELSE 
		execute('insert into web..web_vilpornet
					select codine,copos6,cmuabn,null 
					from abo..xpbartp2 t
					where exists (select 1 from abo..voieilot v 
											where v.voiins = codine)')
end
go
et la j'ai des erreurs à la compile car il n'aime pas ma fonction execute.

est ce que quelqu'un à une idée
Merci