Bonjour ;
Mes amis j’ai crié une table qui s’appelle « identification » comporte les champs : numéro, nom, prénom, né le, adresse,…..
Et je veux lancer une recherche phonétique en utilisant « Soundex » à condition que le résultat sera affiché dans un autre forms qui s’appel « rechercher ». J’ai tenté de mettre ce programme mais ça ne marche pas et le résultat final affiche tous les enregistrements.
SVP donnez-moi votre aide pour trouver la solution et je vous notez que je suis débutant.
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
declare
	bs varchar2(200);
	b varchar2(30);
	I varchar2(30);
	nom varchar2(30);
           prenom varchar2(30);
begin
	if: identification .nom is null then
		message ('le champs nom est vide');
		Raise Form_Trigger_Failure;
	end if;
		if: identification .Ne_LE is null then
		message ('le champ Ne le est vide');
		Raise Form_Trigger_Failure;
	end if;
if:system.record_status='INSERT' then
bs:=' numéro='||' identification. numéro ';
Set_block_property('rechercher',default_where,re);
go_block('rechercher');
execute_query;
b:=get_block_property ('rechercher',Query_hits);
	I :='(upper(prenom) like ''%'||prenom||'%'' and upper(nom) like ''%'||nom||'%'') or 
(soundex(prenom)=soundex('''||prenom||''') and soundex(nom)=soundex('''||nom||''')) or 
(upper(prenom) like ''%'||nom||'%'' and upper(nom) like ''%'||prenom||'%'') or 
(soundex(prenom)=soundex('''||nom||''') and soundex(nom)=soundex('''||prenom||'''))';
end if;
if n='1'then
	go_block(' identification');
commit_form;
next_record;
previous_record;
else
	bs:='(Ne_LE='''||to_char (:identification.Ne_LE, 'DD-MON-YYYY')||''' and nom = '''||: identification.nom||''')';
	bs:=bs||' or (Ne_LE= '''||to_char (:identification.Ne_LE-1,'DD-MON-YYYY')||'''and nom = '''||: identification.nom||''')';
	bs:=bs||' or (Ne_LE= '''||to_char (:identification.Ne_LE+1,'DD-MON-YYYY')||'''and nom = '''||: identification.nom||''')';
	set_block_property('rechercher',default_where,re);
	execute_query;
b:=get_block_property('rechercher',query_hits);
if to_number (n)=0 then
		go_block(' identification');
		commit_form;
		next_record;
		previous_record;
end if;
end if;
end;