Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1.  
  2. ALTER TABLE comptes DROP CONSTRAINT IF EXISTS comptes_bic_check;
  3. 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);
  4. COMMENT ON COLUMN comptes.bic IS 'pattern [A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?';
  5.  
  6. -- pour retrouver les comptes bancaires dont le bic n'est pas valide. il ne peut pas être nul !
  7. -- select * from comptes where bic !~* '([A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?)';
  8.  
  9. ALTER TABLE comptes DROP CONSTRAINT IF EXISTS comptes_check;
  10. 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);
  11. 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})?$';
  12.  
  13. -- pour retrouver les comptes bancaires dont l'iban n'est pas valide. il ne peut pas être nul !
  14. -- 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