1493:
1494: END;
1495:
1496: /* 6335440 - this procedure did not work prior to this bug.
1497: The reason was that the financial data (ar_cmgt_financial_data)
1498: had cust_acct_site_id in the site_use_id field. Additionally,
1499: prior to this bug, the procedure relied on completely un-indexed
1500: joins and multiple reads of the ar_cmgt_financial_data table
1501: which (for production data) would bave performed awful.
1496: /* 6335440 - this procedure did not work prior to this bug.
1497: The reason was that the financial data (ar_cmgt_financial_data)
1498: had cust_acct_site_id in the site_use_id field. Additionally,
1499: prior to this bug, the procedure relied on completely un-indexed
1500: joins and multiple reads of the ar_cmgt_financial_data table
1501: which (for production data) would bave performed awful.
1502:
1503: To correct these issues, we did the following:
1504:
1503: To correct these issues, we did the following:
1504:
1505: o revised initial select to fetch cust_acct_site_id
1506: instead of site_use_id. This is used to correctly
1507: join to the errant ar_cmgt_financial_data table.
1508:
1509: o revised second select to only join to
1510: ar_cmgt_financial_data once (was joining twice)
1511:
1506: instead of site_use_id. This is used to correctly
1507: join to the errant ar_cmgt_financial_data table.
1508:
1509: o revised second select to only join to
1510: ar_cmgt_financial_data once (was joining twice)
1511:
1512: o Added index ar_cmgt_financial_data_n2 that contains following:
1513: 1) party_id
1514: 2) reporting_currency
1508:
1509: o revised second select to only join to
1510: ar_cmgt_financial_data once (was joining twice)
1511:
1512: o Added index ar_cmgt_financial_data_n2 that contains following:
1513: 1) party_id
1514: 2) reporting_currency
1515: 3) cust_account_id
1516: 4) site_use_id
1527: p_mode IN VARCHAR2,
1528: p_resultout OUT NOCOPY VARCHAR2,
1529: p_errmsg OUT NOCOPY VARCHAR2) IS
1530:
1531: l_reporting_currency ar_cmgt_financial_data.reporting_currency%type;
1532: l_monetary_unit ar_cmgt_financial_data.monetary_unit%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1528: p_resultout OUT NOCOPY VARCHAR2,
1529: p_errmsg OUT NOCOPY VARCHAR2) IS
1530:
1531: l_reporting_currency ar_cmgt_financial_data.reporting_currency%type;
1532: l_monetary_unit ar_cmgt_financial_data.monetary_unit%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1529: p_errmsg OUT NOCOPY VARCHAR2) IS
1530:
1531: l_reporting_currency ar_cmgt_financial_data.reporting_currency%type;
1532: l_monetary_unit ar_cmgt_financial_data.monetary_unit%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1530:
1531: l_reporting_currency ar_cmgt_financial_data.reporting_currency%type;
1532: l_monetary_unit ar_cmgt_financial_data.monetary_unit%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1531: l_reporting_currency ar_cmgt_financial_data.reporting_currency%type;
1532: l_monetary_unit ar_cmgt_financial_data.monetary_unit%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1532: l_monetary_unit ar_cmgt_financial_data.monetary_unit%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1533: l_curr_fin_st_date ar_cmgt_financial_data.curr_fin_st_date%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1534: l_reporting_period ar_cmgt_financial_data.reporting_period%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1535: l_cash ar_cmgt_financial_data.cash%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1536: l_net_receivables ar_cmgt_financial_data.net_receivables%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1537: l_inventories ar_cmgt_financial_data.inventories%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1538: l_other_cur_assets ar_cmgt_financial_data.other_cur_assets%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1539: l_total_cur_assets ar_cmgt_financial_data.total_cur_assets%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1540: l_net_fixed_assets ar_cmgt_financial_data.net_fixed_assets%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1541: l_other_non_cur_assets ar_cmgt_financial_data.net_fixed_assets%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1542: l_total_assets ar_cmgt_financial_data.total_assets%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1543: l_accounts_payable ar_cmgt_financial_data.accounts_payable%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1544: l_short_term_debt ar_cmgt_financial_data.short_term_debt%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1545: l_other_cur_liabilities ar_cmgt_financial_data.other_cur_liabilities%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1546: l_total_cur_liabilities ar_cmgt_financial_data.total_cur_liabilities%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1547: l_long_term_debt ar_cmgt_financial_data.long_term_debt%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1548: l_other_non_cur_liabilities ar_cmgt_financial_data.other_non_cur_liabilities%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1549: l_total_liabilities ar_cmgt_financial_data.total_liabilities%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1550: l_stockholder_equity ar_cmgt_financial_data.stockholder_equity%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1551: l_total_liabilities_equity ar_cmgt_financial_data.total_liabilities_equity%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1552: l_revenue ar_cmgt_financial_data.revenue%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1553: l_cost_of_goods_sold ar_cmgt_financial_data.cost_of_goods_sold%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1554: l_sga_expenses ar_cmgt_financial_data.sga_expenses%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1562: l_earnings_per_share ar_cmgt_financial_data.earnings_per_share%type;
1555: l_operating_income ar_cmgt_financial_data.operating_income%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1562: l_earnings_per_share ar_cmgt_financial_data.earnings_per_share%type;
1563: l_financial_data_id ar_cmgt_financial_data.financial_data_id%type;
1556: l_operating_margin ar_cmgt_financial_data.operating_margin%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1562: l_earnings_per_share ar_cmgt_financial_data.earnings_per_share%type;
1563: l_financial_data_id ar_cmgt_financial_data.financial_data_id%type;
1564: l_party_id ar_cmgt_case_folders.party_id%type;
1557: l_non_operating_income ar_cmgt_financial_data.non_operating_income%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1562: l_earnings_per_share ar_cmgt_financial_data.earnings_per_share%type;
1563: l_financial_data_id ar_cmgt_financial_data.financial_data_id%type;
1564: l_party_id ar_cmgt_case_folders.party_id%type;
1565: l_cust_account_id ar_cmgt_case_folders.cust_account_id%type;
1558: l_non_operating_expenses ar_cmgt_financial_data.non_operating_expenses%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1562: l_earnings_per_share ar_cmgt_financial_data.earnings_per_share%type;
1563: l_financial_data_id ar_cmgt_financial_data.financial_data_id%type;
1564: l_party_id ar_cmgt_case_folders.party_id%type;
1565: l_cust_account_id ar_cmgt_case_folders.cust_account_id%type;
1566: l_site_use_id ar_cmgt_case_folders.site_use_id%type;
1559: l_pre_tax_net_income ar_cmgt_financial_data.pre_tax_net_income%type;
1560: l_income_taxes ar_cmgt_financial_data.income_taxes%type;
1561: l_net_income ar_cmgt_financial_data.net_income%type;
1562: l_earnings_per_share ar_cmgt_financial_data.earnings_per_share%type;
1563: l_financial_data_id ar_cmgt_financial_data.financial_data_id%type;
1564: l_party_id ar_cmgt_case_folders.party_id%type;
1565: l_cust_account_id ar_cmgt_case_folders.cust_account_id%type;
1566: l_site_use_id ar_cmgt_case_folders.site_use_id%type;
1567: l_limit_currency ar_cmgt_case_folders.limit_currency%type;
1604: financial_data_id on the maximum date that matches
1605: the parameters (currency,party,customer,site).
1606:
1607: This sql has same result as predecessor only it
1608: reduces the number of reads on ar_cmgt_financial_data
1609: to a single read */
1610:
1611: SELECT to_number(
1612: substr(
1614: ltrim(to_char(financial_data_id,
1615: '0999999999999999999999')))
1616: ,9))
1617: INTO l_financial_data_id
1618: FROM ar_cmgt_financial_data
1619: WHERE reporting_currency = l_limit_currency
1620: AND party_id = l_party_id
1621: AND cust_account_id = l_cust_account_id
1622: AND site_use_id = l_site_use_id;
1627: WHEN TOO_MANY_ROWS THEN
1628: NULL;
1629: WHEN OTHERS THEN
1630: p_resultout := 1;
1631: p_errmsg := 'Error while getting max data from ar_cmgt_financial_data '||
1632: ' SqlError '|| sqlerrm;
1633: ar_cmgt_util.wf_debug(p_case_folder_id, p_errmsg);
1634: return;
1635:
1699: l_pre_tax_net_income ,
1700: l_income_taxes ,
1701: l_net_income ,
1702: l_earnings_per_share
1703: FROM ar_cmgt_financial_data
1704: WHERE financial_data_id = l_financial_data_id;
1705:
1706: EXCEPTION
1707: WHEN NO_DATA_FOUND THEN
1709: WHEN TOO_MANY_ROWS THEN
1710: NULL;
1711: WHEN OTHERS THEN
1712: p_resultout := 1;
1713: p_errmsg := 'Error while getting records from ar_cmgt_financial_data '||
1714: ' SqlError '|| sqlerrm;
1715: ar_cmgt_util.wf_debug(p_case_folder_id, p_errmsg);
1716: return;
1717: