title: Returning Single Value into Function for Calculation Preparation (SQL/PLSQL)
body: <p>I am having trouble with a particular function. What I am trying to do is retrieve a value using this function in order to have it prepared for another function that will perform my desired calculations. Tables involved are: CUSTOMERS_TBL(customer_id PK)  and ORDERS_TBL(order_no PK). I need to pull the 'wallet' value from CUSTOMERS and use that value for the 'wallet_bal' column that is part of the ORDERS_TBL. </p>
  
  <pre><code>CREATE OR REPLACE FUNCTION get_wallet_bal(f_id IN NUMBER)
      RETURN NUMBER 
      IS wallet_bal NUMBER(5,2);
  
  BEGIN
      SELECT wallet 
      INTO wallet_bal
      FROM customers
      WHERE f_id = customer_id;
      RETURN (wallet_bal);
  END;
  /
  </code></pre>
  
  <p>My function above retrieves the value I am looking for but instead of returning it into one row, it returns it into all 'wallet_bal' rows.</p>