title: Call a function within a trigger in pl/sql
body: <p>I've searched through the Internet for some resource providing me with an example of how to call a function I've created from within a trigger in PL/SQL.</p>
  
  <p>I've made a function called <code>get_balance</code> that looks like this:</p>
  
  <pre><code>create or replace function get_balance(p_custno in number)
  return number
  as
  v_balance account.balance%type;
  begin
  select balance 
  into v_balance
  from account
  where custno = p_custno;
  return v_balance;
  end;
  /
  </code></pre>
  
  <p>Now I want to call this function from within a trigger to check the balance before a withdrawal. I tried to do it as follows but I think it's totally wrong:</p>
  
  <pre><code>create or replace trigger bifer_withdrawal
  before insert on withdrawal
  for each row
  begin
  if get_balance(p_custno) &lt;= amount then
  raise_application_error(-20001, 'Not enough money in account!');
  end if;
  end;
  /
  </code></pre>
  
  <p>Could someone please provide a newbie with an example of how to call a function from within a trigger?</p>