title: PL/SQL convert string to number
body: <p>I want to convert a string to numbers for a checksum. The string consists of  universityCode || ' ' || countryCode || ' ' || studentNumber.</p>
  
  <p>An example string could be:</p>
  
  <blockquote>
    <p>TUE NL 123456789</p>
  </blockquote>
  
  <p>I have to convert this sample string to numbers, and tried this with the TO_NUMBER function, but I keep getting an error.</p>
  
  <p>This is my code to create (or replace) a function in PL/SQL:</p>
  
  <pre><code>-- Een functie om een International Student Identification Number (ISIN) te genereren
  CREATE OR REPLACE FUNCTION generateISIN(
    countryCode Country.Code%TYPE,
    universityCode University.Code%TYPE,
    studentNumber VARCHAR2
  )
  RETURN VARCHAR2
  AS
    newStudentNumber VARCHAR2(50) := '';
  BEGIN
  -- Zorgen voor de goede waarde voordat we de checksum beginnen
  newStudentNumber := universityCode || ' ' || countryCode || ' ' || studentNumber;
  -- newStudentNumber omzetten naar enkel getallen
  newStudentNumber := TO_NUMBER(newStudentNumber);
  -- Spaties weghalen in newStudentNumber
  newStudentNumber := TRIM(' ' FROM newStudentNumber);
    RETURN newStudentNumber;
  END;
  /
  </code></pre>
  
  <p>Could someone help me with my problem? Thanks a lot in advance!</p>