title: How do I determine if a PL/SQL parameter value was defaulted?
body: <p>Suppose I have a PL/SQL stored procedure as follows:</p>
  
  <pre><code>PROCEDURE do_something(foo VARCHAR2 DEFAULT NULL) IS
  BEGIN
      /* Do something */
  END;
  </code></pre>
  
  <p>Now, suppose <code>do_something</code> is invoked two different ways:</p>
  
  <pre><code>/* Scenario 1: The 'foo' parameter defaults to NULL */
  do_something();
  
  /* Scenario 2: The 'foo' parameter is explicitly set to NULL */
  do_something(foo =&gt; NULL)
  </code></pre>
  
  <p>How can I define the <code>do_something</code> procedure to determine which scenario is calling it?</p>
  
  <p>Edit: Clarifying my intentions for this procedure:</p>
  
  <pre><code>FUNCTION find_customer(name VARCHAR2 DEFAULT NULL, number VARCHAR2 DEFAULT NULL) RETURN NUMBER IS
  BEGIN
      /* Query the "customer" table using only those parameters provided */
  END;
  </code></pre>
  
  <p>Below are example uses of this procedure with the associated SQL clauses desired:</p>
  
  <pre><code>/* SELECT * FROM customer WHERE customer.name = 'Sam' */
  find_customer(name =&gt; 'Sam')
  
  /* SELECT * FROM customer WHERE customer.name = 'Sam' AND customer.number = '1588Z' */
  find_customer(name =&gt; 'Sam', number =&gt; '1588Z')
  
  /* SELECT * FROM customer WHERE customer.name = 'Sam' AND customer.number IS NULL */
  find_customer(name =&gt; 'Sam', number =&gt; NULL)
  
  /* SELECT * FROM customer WHERE customer.name IS NULL */
  find_customer(name =&gt; NULL)
  
  /* SELECT * FROM customer WHERE customer.name IS NULL AND customer.number IS NULL */
  find_customer(name =&gt; NULL, number =&gt; NULL)
  </code></pre>