daily pastebin goal
50%
SHARE
TWEET

nin

a guest May 16th, 2018 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE  FUNCTION Bestiban(acc varchar)
  2. RETURNS varchar AS $$
  3. DECLARE num numeric;
  4. DECLARE DC varchar(2);
  5. BEGIN
  6.     SELECT CAST(replace(acc, ' ', '')|| '******' AS numeric) INTO num;
  7.     SELECT LPAD(CAST(98 - MOD(num, 97) AS varchar(2)), 2, '0') INTO DC;
  8.     RETURN 'ES' || DC || replace(acc, ' ', '');
  9. END;
  10. $$ LANGUAGE plpgsql;
RAW Paste Data
Top