Validating IBAN in PL/SQL

iban format
what is checksum in iban
what are iban check digits
iban checker
how to find iban number
account number is not in proper iban format
test iban number
check validation

I'm trying to find some ready-to-use code (yes, I mean teh codez) to validate an IBAN account number in PL/SQL.

Does anyone know about some samples? I think someone should have already implemented that...

Thanks

This one is surely not copyrighted:

declare
as_iban varchar2(34);
ln_iban number(36, 0);
begin
    as_iban := 'enter your IBAN here';

    ln_iban := to_number(substr(as_iban, 5));
    ln_iban := ln_iban * 100 + (ascii(substr(as_iban, 1, 1)) - 55);
    ln_iban := ln_iban * 100 + (ascii(substr(as_iban, 2, 1)) - 55);
    ln_iban := ln_iban * 100 + to_number(substr(as_iban, 3, 2));
    ln_iban := ln_iban mod 97;

    if ln_iban is null or ln_iban <> 1 then 
        raise_application_error(-2e4, 'invalid IBAN: ' || as_iban);
    end if; 
end;
/

BICPlusIBAN Validation Method Definitions (SWIFT Integration , The SWIFT OTD Library provides the following validation methods for BICPlusIBAN: Deriving the BIC from the IBAN: This validation method is used to derive the� Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

Function returns 1 if IBAN is correct and 0 if it's not correct

CREATE OR REPLACE 

    FUNCTION fn_CheckIBAN(
      pIBAN IN VARCHAR2
    ) RETURN INTEGER IS
      lResult     INTEGER;
      IBAN        VARCHAR2(256);
      IBAN_Digits VARCHAR2(256);
      l_mod       NUMBER;
      lTmp        VARCHAR2(8);
      lSCnt       INTEGER := 5;
      i           INTEGER := 1;

---

      FUNCTION fn_GetIBANDigits RETURN VARCHAR2 AS
        lChar   VARCHAR2(1);
        lNumber INTEGER;
        lString VARCHAR2(255);
      BEGIN
        FOR i IN 1..LENGTH(IBAN) LOOP
          lChar := SUBSTR(IBAN, i, 1);
          BEGIN
            lNumber := ASCII(lChar);
            IF lNumber > 47 AND lNumber < 58 THEN
              -- It's number 0 ... 9
              lString := lString || TO_CHAR(lNumber - 48);
            ELSE
              lString := lString || TO_CHAR(lNumber - 55);
            END IF;
          END;
        END LOOP;
        RETURN lString;
      END fn_GetIBANDigits;

---

     BEGIN
      IBAN := SUBSTR(pIBAN, 5) || SUBSTR(pIBAN, 1, 4);

      IBAN_Digits := fn_GetIBANDigits;

      LOOP
        lTmp := SUBSTR(IBAN_Digits, i, lSCnt);
        EXIT WHEN lTmp IS NULL;

        IF l_mod IS NULL THEN
          l_mod := MOD( TO_NUMBER(lTmp), 97);
        ELSE
          l_mod := MOD(TO_NUMBER( TO_CHAR(l_mod) || lTmp), 97);
        END IF;

        i := i + lSCnt;
      END LOOP;

      IF l_mod = 1 THEN
        lResult := 1;
      ELSE
        lResult := 0;
      END IF;

      RETURN(lResult);
    END fn_CheckIBAN;

PLSQL package to convert BBAN to IBAN, thanks Mart! � GitHub, END;. -- validate checksum. RETURN is731ChecksumValid (l_bban);. END;. /**. * Returns IBAN bank code from BBAN account number. * @param string $bban. Validation Method Descriptions; Not Null. Checks if an item's value in session state is null. For example, you could validate that the user enters a value in a field by creating an item validation and then selecting the validation method Item Not Null.

A swift Googling throws up an implementation by Alexandre Rodichevski. It's copyrighted so I'm not sure whether it's legal to use it. Anyway, find it here.

API to validate a IBAN in Oracle Apps R12 , It can be used to validate whether the given bank account number is an IBAN number or not. It was very helpful for us in the current project. Banking : PL SQL package for generate and check account type of IBAN 1. First download package and install it PKG_IBAN 2. Function Iban_key_generate:

my modification

CREATE OR REPLACE FUNCTION MOHF.fn_CheckIBAN(
      pIBAN IN VARCHAR2
    ) RETURN varchar2 IS
      lResult     INTEGER;
      IBAN        VARCHAR2(256);
      IBAN_Digits VARCHAR2(256);
      l_mod       NUMBER;
      lTmp        VARCHAR2(8);
      lSCnt       INTEGER := 5;
      i           INTEGER := 1;

---
FUNCTION fn_GetIBANDigits RETURN VARCHAR2 AS
        lChar   VARCHAR2(1);
        lNumber INTEGER;
        lString VARCHAR2(255);
      BEGIN
        FOR i IN 1..LENGTH(IBAN) LOOP
          lChar := SUBSTR(IBAN, i, 1);
          BEGIN
            lNumber := ASCII(lChar);
            IF lNumber > 47 AND lNumber < 58 THEN
              -- It's number 0 ... 9
              lString := lString || TO_CHAR(lNumber - 48);
            ELSE
              lString := lString || TO_CHAR(lNumber - 55);
            END IF;
          END;
        END LOOP;
        RETURN lString; 
        exception  when others then return ( null);
      END fn_GetIBANDigits;

---

     BEGIN
      IBAN := SUBSTR(pIBAN, 5) || SUBSTR(pIBAN, 1, 4);

      IBAN_Digits := fn_GetIBANDigits;

      LOOP
        lTmp := SUBSTR(IBAN_Digits, i, lSCnt);
        EXIT WHEN lTmp IS NULL;

        IF l_mod IS NULL THEN
          l_mod := MOD( TO_NUMBER(lTmp), 97);
        ELSE
          l_mod := MOD(TO_NUMBER( TO_CHAR(l_mod) || lTmp), 97);
        END IF;

        i := i + lSCnt;
      END LOOP;

      IF l_mod = 1 THEN
        lResult := 1;
      ELSE
        lResult := 0;
      END IF;

      RETURN(lResult);
      exception  when others then return ( IBAN); 
    END fn_CheckIBAN;
/

IBAN - international standard for bank account number, IBAN validation algorithm; Examples of IBAN validation; IBAN validating program It is available also the version of the program in PL/SQL di Oracle. The article� iban. Score 2. Posts 1. oracle. Score 2. Posts 1. plsql. Score 2. Posts 1. Top posts (1) All Questions Answers. Votes Newest. 2 Validating IBAN in PL/SQL Sep 26 '13

IBAN Checker: Validate & Check IBAN Number for Errors, IBAN ( International Bank Account Number ) validation through control digits is used as an effective way of reducing failed transactions when processing� A number of different processes that can be used to make sure your data validates against your business rules. This article discusses how you can use database 'check constraints' to validate your data within the SQL Server database engine.

IBAN, Validate the following fictitious IBAN: GB82 WEST 1234 5698 7654 32 MU:30, MC:27, MD:24, ME:22, NL:18, NO:15, PK:24, PS:29, PL:28 EverSQL will tune your SQL queries instantly and automatically. Analyze MySQL slow query log files, visualize slow logs and optimize the slow SQL queries.

IBAN – international standard for bank account number, It is available also in the version of the program in Oracle PL/SQL. Examples of IBAN validation; IBAN validating program; Resources� Validating XML with XML Schema using PL/SQL Hello, I have XSD file and a example XML file. Using pl/sql how I can validate the example XML is valid for XSD file? Thanks in advance. Bakul Message was edited by: bakuleshHave you looked at this documentation, Transforming and Validating XMLType D

Comments
  • Welcome to Stack Overflow! Rather than only post a block of code, please explain why this code solves the problem posed. Without an explanation, this is not an answer.
  • Dead link please fix :)
  • @GOXR3PLUS - which is why StackOverflow frowns on "link-only" responses. As the thread has an accepted answer I'm just going to delete this.
  • You may want to highlight exactly what differentiates your answer from the previous one.