Wednesday, 15 January 2020

Function to Get GL Code Segment1 for the Organization ID

FUNCTION get_account_segment1 (p_org_id IN NUMBER) RETURN VARCHAR2  AS
  l_segment1 VARCHAR2 (25);
BEGIN
  SELECT gcc.segment1 INTO l_segment1
    FROM financials_system_params_all fsp,gl_ledgers gsb, gl_code_combinations gcc
   WHERE fsp.org_id = p_org_id
     AND fsp.set_of_books_id = gsb.ledger_id
     AND gsb.chart_of_accounts_id = gcc.chart_of_accounts_id
     AND fsp.accts_pay_code_combination_id = gcc.code_combination_id;
  RETURN (l_segment1);
EXCEPTION WHEN OTHERS THEN RETURN ('00'); 
END;

No comments:

Post a Comment