Bonjour à tous !
Suis dans du Sql récursif ! 
Et j'aimerai bien ajouter une contrainte pour limiter les occasions de  boucle infinie. ..
Et je bute sur la contrainte - pour l'instant en commentaire - 
"Compo98_Pas_recursivite_infinie check(not exists(select * from toto))"
Le message est le suivant :
"La condition CHECK de la contrainte *N est incorrecte."
Suis en V5R4 (je veux dire l'AS...) 
Une idée ?
*****
create table compo98 (
composant dec(5, 0) not null references piece, 
compose dec(5, 0) not null references piece, 
note char(50), 
constraint Compo98_Pas_doublon_composant_compose unique(composant, compose), 
-- constraint Compo98_Pas_recursivite_infinie check(not exists(select * from toto));
constraint Compo98_Exemple_qui_marche check(composant < compose));
			
			
			
									
									
						Sql, contrainte check(not exists...
- 
				P.A. Milan
 - Messages : 2
 - Enregistré le : sam. 07 juin 2008, 09:25:42
 - Localisation : Paris, La Rochelle
 - Contact :
 
- 
				cmasse
 - Site Admin
 - Messages : 813
 - Enregistré le : mer. 14 févr. 2007, 18:00:03
 - Localisation : Nantes
 - Contact :
 
contrainte CHECK
Bonjour,
une contrainte de vérification (CHECK) ne peux contenir que la syntaxe d'un WHERE de SELECT pas le SELECT tout entier :
			
			
			
									
									une contrainte de vérification (CHECK) ne peux contenir que la syntaxe d'un WHERE de SELECT pas le SELECT tout entier :
Code : Tout sélectionner
- CHECK (DATLIV > DATCMD)
et non
- CHECK (Select * from fichier where DATLIV > DATCMD)
The check-condition is a search-condition except:
* It can only refer to columns of the table
* It cannot reference ROWID or DATALINK with FILE LINK CONTROL columns.
* It must not contain any of the following:
o Subqueries
o Aggregate functions
o Variables
o Parameter markers
o Sequence-references
o Complex expressions that contain LOBs (such as concatenation)
o OLAP specifications
o ROW CHANGE expressions
o Special registers
o User-defined functions other than functions that were implicitly generated with the creation of a distinct type
o The following built-in scalar functions:
ATAN2 DECRYPT_DB ENCRYPT_TDES RAND
CURDATE DIFFERENCE GENERATE_UNIQUE REPEAT
CURTIME DLURLCOMPLETE GETHINT REPLACE
DATAPARTITIONNAME DLURLPATH IDENTITY_VAL_LOCAL ROUND_TIMESTAMP
DATAPARTITIONNUM DLURLPATHONLY INSERT SOUNDEX
DAYNAME DLURLSCHEME MONTHNAME TIMESTAMP_FORMAT
DBPARTITIONNAME DLURLSERVER MONTHS_BETWEEN TIMESTAMPDIFF
DECRYPT_BINARY DLVALUE NEXT_DAY TRUNC_TIMESTAMP
DECRYPT_BIT ENCRYPT_AES NOW VARCHAR_FORMAT
DECRYPT_CHAR ENCRYPT_RC2 RAISE_ERROR WEEK_ISO
Christian Massé (Volubis.fr)
						- 
				P.A. Milan
 - Messages : 2
 - Enregistré le : sam. 07 juin 2008, 09:25:42
 - Localisation : Paris, La Rochelle
 - Contact :
 
(sans texte)
Merci Christian !