title: Calling a function within a procedure
body: <p>I apologize ahead of time for the probably basic question.  I am student and it is crunch time!</p>
  
  <p>I am using Oracle 10g Express.</p>
  
  <p>I created a function:</p>
  
  <pre><code>create or replace FUNCTION test_glaccounts_description
  (
  account_description_param VARCHAR2
  ) 
  RETURN NUMBER
  AS
    description_dup_var NUMBER;
  BEGIN
    SELECT 1
    INTO description_dup_var
    FROM general_ledger_accounts
    WHERE account_description = account_description_param;
  
    RETURN description_dup_var;  
    EXCEPTION 
      WHEN NO_DATA_FOUND THEN
      RETURN 0;
  END;
  </code></pre>
  
  <p>And would like to use that function in a procedure.
  I've tried:</p>
  
  <pre><code>PROCEDURE insert_gla_with_test
  (
    account_number_param  NUMBER,
    account_description_param VARCHAR2
  )
   AS
  BEGIN 
    IF test_glaccounts_description = 1 THEN
    INSERT INTO  general_ledger_accounts
    VALUES (account_number_param, account_description_param);
    ELSE raise_application_error (-20001, 'Duplicate account description');
    END IF;
  END;
  </code></pre>
  
  <p>But it doesn't like the "test_gla_accounts" line.....what am I doing wrong?
  To my understanding, the function returns a value of 1 or 0, in the procedure, if the function returned a 1, I would like the param fields added to the table.  If the function returned a 0, I would like the procedure to raise the error. </p>