title: How to pass/call parameters (values) from Function to 'Select' stmt in SQL*Plus?
body: <p>I have a problem passing parameters from function that I created into SQL*Plus 'Select' statement in the 'Where' clause. However, it seems that whatever syntax I utilized is either incorrect or not to use at all in this 'Where' clause situation. </p>
  
  <p>Here is my function I created and it looks OK being compiled and ran good:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION SA_BILL_CNTRL_EXTRNL_FXN(p_client_code      VARCHAR2
                                                     ,p_bill_seq         VARCHAR2
                                                     ,p_bill_control_seq VARCHAR2)
    RETURN VARCHAR2 IS
    v_external_id      VARCHAR2(30);
    v_client_code      VARCHAR2(4) := p_client_code;
    v_bill_seq         NUMBER := to_number(p_bill_seq);
    v_bill_control_seq NUMBER := to_number(p_bill_control_seq);
    v_cnt              NUMBER;
  BEGIN
    SELECT COUNT(*)
    INTO v_cnt
    FROM BillControl@SQL_SAREP bc
    WHERE bc."ExternalID" IS NOT NULL
          AND bc."ExternalID" != ''
          AND bc."ClientCode" = p_client_code
          AND bc."BillControlSeq" = v_bill_control_seq
          AND bc."BillSeq" = v_bill_seq;
    IF v_cnt = 1 THEN
      SELECT bc."ExternalID"
      INTO v_external_id
      FROM BillControl@SQL_SAREP bc
      WHERE bc."ExternalID" IS NOT NULL
            AND bc."ExternalID" != ''
            AND bc."ClientCode" = p_client_code
            AND bc."BillControlSeq" = v_bill_control_seq
            AND bc."BillSeq" = v_bill_seq;
    ELSE
      v_external_id := NULL;
    END IF;
    RETURN v_external_id;
  END SA_BILL_CNTRL_EXTRNL_FNX;
  /
  </code></pre>
  
  <hr>
  
  <p>Also, when I used 'IN OUT' parameter in function it failed after running it.</p>
  
  <p>Now, here is the 'Select' statement I'm having difficulty passing parameters with:</p>
  
  <pre><code>SELECT NVL(TRIM(eb.CASE_NUM_REEVALUATED), TRIM(eb.CASE_NUM_DUPLICATED)) CaseNumReev
        ,gnc.BILL_CONTROL_SEQ
  FROM EPE_Bill eb NETWORK_CROSSWALK gnc
  WHERE substr(eb.MIC_BILL_ID, 5, 4) = SA_BILL_CNTRL_EXTRNL_FNX(p_client_code)
        AND gnc.BILL_CONTROL_SEQ = SA_BILL_CNTRL_EXTRNL_FNX(p_bill_seq) 
        AND (to_number(substr(eb.MIC_BILL_ID, 10, 10), '9999999999') = SA_BILL_CNTRL_EXTRNL_FNX(p_bill_control_seq) 
  GROUP BY CaseNumReev, gnc.BILL_CONTROL_SEQ;
  </code></pre>
  
  <p>For the last two days I was left myself thoroughly perflexed.
  With that, I would really appreciate if you help me with issue. </p>
  
  <p>Thanks again... </p>