ECC Lease Contracts, Lease Contract Quote Details, SQL1

Description
Columns: Contract Number, Quote Number, Effective From, Line Number, Asset Number, Asset Quantity, Quote Quantity, Amount, Contract Id, Qtp Code ...
Imported from ECC
SELECT * FROM
( SELECT                  CONTRACT_NUMBER,
                          to_char(QUOTE_NUMBER) QUOTE_NUMBER,
                          qte_sts.meaning QUOTE_STATUS,
                          EFFECTIVE_FROM,
                          LINE_NUMBER,
                          ASSET_NUMBER,
                          ASSET_QUANTITY,
                          QUOTE_QUANTITY,
                          AMOUNT,
                         -- UNBILLED_RECEIVABLES,  bug 30785670
                        --  RESIDUAL_VALUE,
                          CONTRACT_ID,
                          QTP_CODE,
                          QRS_CODE,
                          QLT_CODE,
                          CURRENCY_CODE,
                          CURRENCY_CONVERSION_RATE,
                          CURRENCY_CONVERSION_TYPE,
                          CURRENCY_CONVERSION_DATE,
                          ltype.meaning line_type,
                          qtype.meaning quote_type,
                          qres.meaning  quote_reason,
                          spec_id ecc_spec_id,
                          ltype.language language_code,
                          khr_sts.meaning contract_status,
                          oaq.gl_account,
                          oaq.formula_name,
                          oaq.formula_value,
                          oaq.gl_acct_description,
                          stream_code,
                          stream_type_purpose,
                          stream_value,
                          subledger_value,
                          remaining_balance,
                          org_id,
                          ledger_name,
                          ledger_currency ,
                          qtl_sts.meaning quote_line_status
   FROM okl_ecc_arcon_quotes oaq,
        fnd_lookup_values    ltype,
        fnd_lookup_values    qtype,
        fnd_lookup_values    qres,
        fnd_lookup_values    qte_sts,
        fnd_lookup_values    qtl_sts,
        okc_statuses_tl           khr_sts--,
       -- okl_strm_type_tl     sty_tl
    where ltype.lookup_type = 'OKL_QUOTE_LINE_TYPE'
    and   ltype.lookup_code = oaq.qlt_code
    and   qtype.lookup_type = 'OKL_QUOTE_TYPE'
    and   qtype.lookup_code = oaq.qtp_code
    and   qres.lookup_type = 'OKL_QUOTE_REASON'
    and   qres.lookup_code = oaq.qrs_code
    and   ltype.language = qtype.language
    and   qtype.language = qres.language
    and   qte_sts.lookup_code = oaq.quote_status
    and   qte_sts.lookup_type = 'OKL_QUOTE_STATUS'
    and   qte_sts.language = ltype.language
    and   qtl_sts.lookup_code = oaq.quote_line_status
    and   qtl_sts.lookup_type = 'OKL_QUOTE_STATUS'
    and   qtl_sts.language = ltype.language
    and   khr_sts.code = oaq.contract_status
    and   khr_sts.language= qte_sts.language
    and   qres.language in('US')
   -- and   oaq.stream_code = sty_tl.name
    and   processing_status_flag ='N')
  PIVOT
         (MAX(line_type) AS line_type,
          MAX(quote_type) AS quote_type,
          MAX(quote_reason) AS quote_reason,
          MAX(quote_status) as quote_status,
          MAX(contract_status) as contract_status,
          MAX(quote_line_status) as quote_line_status
          --MAX(stream_description) AS stream_description
          for language_code in ('US' "US"))