title: Converting number into word using length PL/SQL
body: <p>I am converting number into word with own code using length function. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION num_to_words (NUM IN NUMBER)
  RETURN VARCHAR2
  IS
  
  v_length NUMBER;
  v_words VARCHAR2(100);
  word_1 VARCHAR2(100);
  
  BEGIN
  word_1 := 'HUNDRED';
  v_length := LENGTH(NUM);
  
  IF v_length = 3
  THEN v_words := SUBSTR(TO_CHAR(TO_DATE(NUM,'J'),'JSP'),1,3) ||' '|| word_1;
  END IF;
  
  RETURN(v_words);
  END;
  </code></pre>
  
  <p>Problem is when I enter "100", it successfully converts into "ONE HUNDRED".</p>
  
  <p>How can I implement the code for converting "101" into "ONE HUNDRED ONE".</p>