title: ORA-00907: missing right parenthesis -- Strange
body: <p>I'm getting the error " ORA-00907: missing right parenthesis" but I've checked and all the parenthesis are there, so I'm stumped.</p>
  
  <p>Am getting this error while using Select Statement. Please help. I need to use the Between to_date also to fetch the data between two particular dates.</p>
  
  <pre><code>select
  
   DT.ARRIVAL||','||
   DT.LOCATION_CODE||','|| nvl (decode (
                                   DT.OWNER_FLAG, 'R', 'B', 'M', 'B',
                                DT.OWNER_FLAG), 'B') OWNER_FLAG,
   DT.RECEIPT||','||
   PP.BILL_NUMBER||','||
   DT.TRANSPORT_MODE||','||
   substr (TRANSPORT_NAME,1,20)
                 , TRANSPORT_TYPE||','||
   PP.PRODUCT||','||
   AP.PRODUCT_NAME||','||
   AP.PRODUCT_QTY||','||
   AP.PRODUCT_QTY_Units||','||
   DT.INSPECTOR||','||
   AP.PRODUCT_NO||','||
   AP.PRODUCT_FLAG||','||
   PP.BILL_STATUS
   from BILL_PARCEL PP,
   PRODUCT DT,
   SUPPORT AP,
   TRANSPORT V
   where PP.BILL_NUMBER = DT.BILL_NUMBER
   and  PP.BILL_NUMBER = AP.BILL_NUMBER
   and DT.BILL_NUMBER = AP.BILL_NUMBER
   and AP.YEAR = DT.YEAR
   and PP.YEAR = DT.YEAR
   and PP.PRODUCT_NAME= AP.PRODUCT_NAME
   and PP.YEAR = 2017 and DT.YEAR = 2017 and AP.YEAR=2017
   and nvl(AP.BILL_STATUS,'0') not in ('D','I','R')
   and V.TRANSPORT_ID = DT.VESS_ID
   and   TRANSPORT_MODE != 'X'
   and (  (DT.ARRIVAL        between 
   to_date(to_char(&amp;C_FROM_DATE,'DD-MON-YY'),'DD-MON-RR')
                         and     
   to_date(to_char(&amp;C_TO_DATE,'DD-MON-YY'),'DD-MON-RR')
   and nvl(AP.BILL_STATUS,'0') in ('U','S')
          )
   or ( TRANSFER_END between 
   to_date(to_char(&amp;C_FROM_DATE,'DD-MON-YY') ,'DD-MON-RR')
                         and     
   to_date(to_char(&amp;C_TO_DATE,'DD-MON-YY'),'DD-MON-RR')
   and nvl(AP.BILL_STATUS,'0') in ('P','C','A')
          )
        )
   order by decode (AP.BILL_STATUS, 'U', DT.ARRIVAL
                                ,'S', DT.ARRIVAL
                                    , TRANSFER_DATE)
  ,decode (TRANSPORT_MODE,'B','1','T','2','P','3',TRANSPORT_MODE);
  </code></pre>