title: how to apply and condition only if the parameter is not null in plsql
body: <pre><code>procedure get_documents
  (pi_id in varchar2,
  -- Inside Outside param
   pi_entry_pemit in varchar2,
   po_resultSet out sys_refcursor)
  is
  begin
  OPEN po_resultSet FOR
  select typ.description,
  typ.attch_type,
  typ.code_sp_type,
  from vtr_t_doc_atch_type_master typ,
  vtr_t_doc_atch_job_mapping jmap
  where typ.active = 'Y'
  if(pi_entry_pemit is not null)
  {
    --then add this 'and' operatior condition
  and jmap. inside_outside_type = pi_entry_pemit
  }
  </code></pre>
  
  <p>So how do I add the <code>AND</code> operator only if the passed parameter is not NULL??</p>