Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALTER TABLE comptes DROP CONSTRAINT IF EXISTS comptes_bic_check;
- ALTER TABLE comptes ADD CONSTRAINT comptes_bic_check CHECK (bic::text ~* '[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?'::text);
- COMMENT ON COLUMN comptes.bic IS 'pattern [A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?';
- -- pour retrouver les comptes bancaires dont le bic n'est pas valide. il ne peut pas être nul !
- -- select * from comptes where bic !~* '([A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?)';
- ALTER TABLE comptes DROP CONSTRAINT IF EXISTS comptes_check;
- ALTER TABLE comptes ADD CONSTRAINT comptes_check CHECK (((((((((iban1::text || iban2::text) || iban3::text) || iban4::text) || iban5::text) || iban6::text) || iban7::text) || iban8::text) || iban9::text) ~* '^([A-Za-z]{2}[0-9]{2})(?=(?:[A-Za-z0-9]){9,30}$)((?:[A-Za-z0-9]{3,5}){2,6})([A-Za-z0-9]{1,3})?$'::text);
- COMMENT ON COLUMN comptes.iban1 IS 'pattern ^([A-Za-z]{2}[0-9]{2})(?=(?:[A-Za-z0-9]){9,30}$)((?:[A-Za-z0-9]{3,5}){2,6})([A-Za-z0-9]{1,3})?$';
- -- pour retrouver les comptes bancaires dont l'iban n'est pas valide. il ne peut pas être nul !
- -- select codecol, codeadr, letype, iban1 || iban2 || iban3 || iban4 || iban5 || iban6 || iban7 || iban8 || iban9 as iban from comptes where iban1 || iban2 || iban3 || iban4 || iban5 || iban6 || iban7 || iban8 || iban9 !~* '^([A-Za-z]{2}[0-9]{2})(?=(?:[A-Za-z0-9]){9,30}$)((?:[A-Za-z0-9]{3,5}){2,6})([A-Za-z0-9]{1,3})?$';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement