title: ORA-00907: missing right parenthesis tips in Order by
body: <p>missing right parenthesis tips in Order by !!</p>
  
  <p>i want to get last  amn_unit_pric_rial from sal_sale_fct
  per  shp.DAT_CALCULATE, shp.COD_PROD_SAPRB
  from shp_inventory_fct
  if  row is not found in sal_sale_fct
  return a last price from  last date in sal_sale_fct</p>
  
  <pre><code>select shp.DAT_CALCULATE,
        shp.COD_PROD_SAPRB,     
            (select sal.amn_unit_pric_rial
                    from sal_sale_fct sal 
                   where rownum = 1
                     and shp.cod_prod_saprb = sal.saprb_cod_prod_saprb
                     and shp.dat_calculate &lt;= sal.dat_ord_ordhe
                     order by sal.dat_ord_ordhe
                     ) price
    From shp_inventory_fct shp
  </code></pre>