DBA Data[Home] [Help]

APPS.AR_CMGT_WF_ENGINE SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 32

SELECT cr.credit_request_id,
       cr.source_name, cr.source_column1,
       cr.source_column2, cr.source_column3,
       cr.source_user_id,
       cr.source_resp_id,
       cr.source_resp_appln_id,
       cr.source_security_group_id,
       cr.source_org_id
FROM  ar_cmgt_credit_requests cr,
      ar_cmgt_case_folders cf
WHERE case_folder_id = p_cf_id
  and cr.credit_request_id = cf.credit_request_id;
Line: 133

        l_list.DELETE;
Line: 190

    SELECT data_point_id
    FROM   ar_cmgt_check_list_dtls
    WHERE  data_point_id between 10000  and 20000
    AND    check_list_id = p_check_list_id
    AND    required_flag = 'Y';
Line: 198

    SELECT distinct source_table_name
    FROM   ar_cmgt_dnb_elements_vl
    WHERE  source_table_name <> 'HZ_FINANCIAL_NUMBERS'   -- this table is accessed via hz_financial_reports
    and    data_element_id in (
            SELECT data_element_id
            FROM   ar_cmgt_dnb_mappings
            WHERE  data_point_id = l_data_point_id);
Line: 215

                SELECT  1
                INTO    cnt
                FROM    ar_cmgt_cf_dnb_dtls
                WHERE   case_folder_id = p_case_folder_id
                AND     source_table_name = c_dnb_source_table_rec.source_table_name;
Line: 254

            SELECT data_point_id, number_of_references
            FROM   ar_cmgt_check_list_dtls
            WHERE  check_list_id = p_check_list_id
            AND    data_point_id IN (86,87,88)
            AND    required_flag = 'Y';
Line: 269

                SELECT COUNT(*)
                INTO   l_cnt
                FROM   ar_cmgt_bank_ref_data
                WHERE  credit_request_id = p_credit_request_id;
Line: 283

                SELECT COUNT(*)
                INTO   l_cnt
                FROM   ar_cmgt_trade_ref_data
                WHERE  credit_request_id = p_credit_request_id;
Line: 297

                SELECT COUNT(*)
                INTO   l_cnt
                FROM   ar_cmgt_guarantor_data
                WHERE  credit_request_id = p_credit_request_id;
Line: 336

                SELECT check_list_id
                INTO   l_check_list_id
                FROM   ar_cmgt_case_folders
                WHERE  case_folder_id = p_case_folder_id
                AND    type = 'CASE';
Line: 355

            SELECT 1 into l_cnt
            FROM ar_cmgt_check_list_dtls a, ar_cmgt_cf_dtls b,
                 ar_cmgt_data_points_vl dp
            WHERE  a.check_list_id = l_check_list_id
            AND    b.case_folder_id = p_case_folder_id
            AND    a.data_point_id  = b.data_point_id
            AND    dp.data_point_id = a.data_point_id
            AND    dp.data_point_category not in ('AGING','INVOICE','DNB') -- Added 'DNB' for bug 8632968 in place of commented code below
            AND    a.required_flag = 'Y'
            --AND    a.data_point_id < 10000  -- Commented for bug 8632968
            and    b.data_point_value is null;
Line: 405

        SELECT c.resource_id, c.source_id --employee id
        FROM  jtf_rs_role_relations a,
              jtf_rs_roles_vl b,
              jtf_rs_resource_extns_vl c
        WHERE a.role_resource_type = 'RS_INDIVIDUAL'
        AND   a.role_resource_id = c.resource_id
        AND   a.role_id = b.role_id
        AND   b.role_code = 'CREDIT_ANALYST'
        AND   c.category = 'EMPLOYEE'
        AND   nvl(a.delete_flag,'N') <> 'Y';
Line: 480

            SELECT  employee_id
            INTO    l_employee_id
            FROM    FND_USER
            WHERE   user_name = wf_engine.context_text;
Line: 495

            SELECT c.resource_id
            INTO   l_resource_id
            FROM  jtf_rs_role_relations a,
                  jtf_rs_roles_vl b,
                  jtf_rs_resource_extns_vl c
            WHERE a.role_resource_type = 'RS_INDIVIDUAL'
            AND   a.role_resource_id = c.resource_id
            AND   a.role_id = b.role_id
            AND   b.role_code = 'CREDIT_ANALYST'
            AND   c.category = 'EMPLOYEE'
            AND   c.source_id = l_employee_id
            AND   nvl(a.delete_flag,'N') <> 'Y';
Line: 543

         mode is Transfer, then there is no need to update the fields as the
         same operation will be done by means of Entity Objects(EO). If the
         update happens at both the levels (EO and at this API),
         FND_RECORD_CHANGED_ERROR will be thrown
*/
        IF funcmode <> 'TRANSFER' THEN
		UPDATE ar_cmgt_credit_requests
		set    credit_analyst_id = l_resource_id,
		       last_update_date = sysdate,
		       last_updated_by = fnd_global.user_id,
		       last_update_login = fnd_global.login_id
		WHERE  credit_request_id = itemkey
		AND    credit_analyst_id IS NULL;
Line: 557

		UPDATE ar_cmgt_case_folders
		set    credit_analyst_id = l_resource_id,
		       last_updated = sysdate,
		       last_update_date = sysdate,
		       last_updated_by = fnd_global.user_id,
		       last_update_login = fnd_global.login_id
		WHERE  credit_request_id = itemkey
		AND    credit_analyst_id IS NULL;
Line: 692

    SELECT param_name
		FROM fun_rule_crit_params_b param,
		     fun_rule_objects_vl rule_object
		WHERE rule_object.rule_object_name = 'OCM_CREDIT_ANALYST_ASSGN'
		AND   rule_object.rule_object_id = param.rule_object_id
		AND   param.parameter_type = 'CUSTOM';
Line: 713

          SELECT parent.credit_request_id,
                 parent.credit_analyst_id
          INTO   l_parent_request_id,
                 l_parent_analyst_id
          FROM   ar_cmgt_credit_requests parent,
                 ar_cmgt_credit_requests child
          WHERE  child.credit_request_id = p_credit_request_id
          AND    child.parent_credit_request_id = parent.credit_request_id
          AND    child.credit_request_type = 'GUARANTOR';
Line: 765

		SELECT p.country,p.state, p.province,p.sic_code,p.party_name,
		       p.employees_total, c.credit_classification,
		       nvl(c.limit_amount,c.trx_amount), c.review_type,
		       nvl(c.limit_currency,c.trx_currency),
		       profclass.name, p.postal_code, p.state, p.party_id
		INTO   l_country, l_state, l_province, l_sic_code,
			   l_party_name, l_employees_total, l_credit_classification,
			   l_amount, l_review_type, l_currency,
			   l_profile_class_name, l_postal_code, l_state, l_party_id
		FROM   ar_cmgt_credit_requests c,
		       hz_parties p,
		       hz_cust_profile_classes profclass,
		       hz_customer_profiles prof
		WHERE  c.credit_request_id = p_credit_request_id
		AND    c.party_id = p.party_id
		AND    p.party_id  = prof.party_id
		AND    c.cust_account_id = decode(prof.cust_account_id,-1,-99,prof.cust_account_id)
		AND    c.site_use_id = nvl(prof.site_use_id,-99)
		AND	   prof.profile_class_id = profclass.profile_class_id;
Line: 903

                	SELECT a.CREDIT_ANALYST_ID
                	INTO   l_credit_analyst_id
                	FROM   hz_customer_profiles a, ar_cmgt_credit_requests b
                	WHERE  b.credit_request_id = itemkey
                	AND    a.party_id = b.party_id
                	AND    a.cust_account_id = decode(b.cust_account_id,-99,-1,b.cust_account_id)
                	AND    nvl(a.site_use_id,-99)  = nvl(b.site_use_id, -99);
Line: 924

                SELECT 'X'
                INTO   l_dummy
                FROM  jtf_rs_role_relations a,
                      jtf_rs_roles_vl b,
                      jtf_rs_resource_extns_vl c
                WHERE a.role_resource_type = 'RS_INDIVIDUAL'
                AND   a.role_resource_id = c.resource_id
                AND   c.resource_id = l_credit_analyst_id
                AND   a.role_id = b.role_id
                AND   b.role_code = 'CREDIT_ANALYST'
                AND   c.category = 'EMPLOYEE'
                AND   nvl(a.delete_flag,'N') <> 'Y';
Line: 953

                SELECT source_id
                INTO   l_employee_id
                FROM   jtf_rs_resource_extns_vl
                WHERE  resource_id = l_credit_analyst_id
                AND    category = 'EMPLOYEE';
Line: 968

            UPDATE ar_cmgt_credit_requests
                SET credit_analyst_id = l_credit_analyst_id,
                    last_update_date = sysdate,
                    last_updated_by = fnd_global.user_id,
                    last_update_login = fnd_global.login_id
            WHERE  credit_request_id = itemkey;
Line: 997

            update ar_cmgt_case_folders
                set credit_analyst_id = l_credit_analyst_id,
                    last_updated = sysdate,
                    last_update_date = sysdate,
                    last_updated_by = fnd_global.user_id,
                    last_update_login = fnd_global.login_id
            WHERE  case_folder_id  = l_case_folder_id;
Line: 1006

            update ar_cmgt_case_folders
                set credit_analyst_id = l_credit_analyst_id,
                    last_updated = sysdate,
                    last_update_date = sysdate,
                    last_updated_by = fnd_global.user_id,
                    last_update_login = fnd_global.login_id
            WHERE  credit_request_id  = itemkey
            AND    type = 'DATA';
Line: 1146

    SELECT credit_classification, party_id, cust_account_id, site_use_id
    INTO   l_credit_classification, l_party_id, l_cust_account_id, l_site_use_id
    FROM   ar_cmgt_credit_requests
    WHERE  credit_request_id = itemkey;
Line: 1157

        UPDATE ar_cmgt_credit_requests
          SET  credit_classification = l_credit_classification
          WHERE credit_request_id = itemkey;
Line: 1175

PROCEDURE UPDATE_CREDIT_REQ_TO_PROCESS (
    itemtype        in      varchar2,
    itemkey         in      varchar2,
    actid           in      number,
    funcmode        in      varchar2,
    resultout       out NOCOPY     varchar2) IS

BEGIN

    IF funcmode = 'RUN'
    THEN
        UPDATE ar_cmgt_credit_requests
        SET    status = 'IN_PROCESS',
               last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
        WHERE  credit_request_id = itemkey;
Line: 1197

PROCEDURE UPDATE_CREDIT_REQ_TO_SUBMIT (
    itemtype        in      varchar2,
    itemkey         in      varchar2,
    actid           in      number,
    funcmode        in      varchar2,
    resultout       out NOCOPY     varchar2) IS

BEGIN

    IF funcmode = 'RUN'
    THEN
        UPDATE ar_cmgt_credit_requests
        SET    status = 'SUBMIT',
               last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
        WHERE  credit_request_id = itemkey;
Line: 1219

PROCEDURE UPDATE_CASE_FOLDER_SUBMITTED (
    itemtype        in      varchar2,
    itemkey         in      varchar2,
    actid           in      number,
    funcmode        in      varchar2,
    resultout       out NOCOPY     varchar2) IS

    l_case_folder_id        ar_cmgt_case_folders.case_folder_id%type;
Line: 1237

        UPDATE ar_cmgt_case_folders
        SET    status = 'SUBMITTED',
               last_updated = sysdate,
               last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
        WHERE  case_folder_id = l_case_folder_id;
Line: 1303

       SELECT party_id, cust_account_id, site_use_id
       INTO   l_party_id, l_cust_acct_id, l_site_use_id
       FROM   ar_cmgt_credit_requests
       WHERE  credit_request_id = itemkey;
Line: 1328

            SELECT cust_account_profile_id
            INTO   l_cust_account_profile_id
            FROM   hz_customer_profiles
            WHERE  party_id = l_party_id
            AND    cust_account_id = -1
            AND    site_use_id IS NULL;
Line: 1435

            SELECT req.credit_classification, req.review_type,
                   nvl(req.limit_currency, trx_currency),
                   nvl(nvl(req.limit_amount,req.trx_amount),0),
                   req.case_folder_number, req.score_model_id, req.source_name,
                   req.application_number,
                   lkp1.meaning classification_meaning,
                   lkp2.meaning review_type_meaning,
                   requestor_id,
                   application_date,
                   req.party_id,
                   cust_account_id,
                   source_column1,
                   source_column2,
                   source_column3,
                   party.party_name,
                   party.party_number,
                   req.notes,
                   req.credit_request_type,
                   nvl(req.requestor_type, 'EMPLOYEE')
            INTO   l_credit_classification, l_review_type, l_currency,
                   l_amount_requested, l_case_folder_number, l_score_model_id,
                   l_source_name, l_application_number,
                   l_classification_meaning,
                   l_review_type_meaning,
                   l_requestor_id,
                   l_application_date,
                   l_party_id,
                   l_cust_account_id,
                   l_source_column1,
                   l_source_column2,
                   l_source_column3,
                   l_party_name,
                   l_party_number,
                   l_notes,
                   l_credit_request_type,
                   l_requestor_type
            FROM   ar_cmgt_credit_requests req,
                   ar_lookups lkp1,
                   ar_lookups lkp2,
                   hz_parties party
            WHERE  req.credit_request_id = itemkey
            AND    req.party_id = party.party_id
            AND    lkp1.lookup_type = 'AR_CMGT_CREDIT_CLASSIFICATION'
            AND    lkp1.lookup_code = req.credit_classification
            AND    lkp2.lookup_type = 'AR_CMGT_REVIEW_TYPE'
            AND    lkp2.lookup_code = req.review_type;
Line: 1483

                SELECT req.credit_classification, req.review_type, req.application_number,
                       req.score_model_id,
                       application_date,
                   	   req.party_id,
                   	   cust_account_id,
                   	   source_column1,
                   	   source_column2,
                   	   source_column3,
                   	   party.party_name,
                   	   party.party_number,
                   	   req.notes,
                   	   req.requestor_id,
                   	   req.source_name,
                   	   req.case_folder_number,
					   nvl(req.limit_currency, trx_currency),
                   	   nvl(nvl(req.limit_amount,req.trx_amount),0),
                   	   req.credit_request_type,
                   	   nvl(req.requestor_type, 'EMPLOYEE')
                INTO   l_credit_classification, l_review_type, l_application_number,
                       l_score_model_id,
                    	l_application_date,
                   		l_party_id,
                   		l_cust_account_id,
                   		l_source_column1,
                   		l_source_column2,
                   		l_source_column3,
                   		l_party_name,
                   	    l_party_number,
                   	    l_notes,
                   	    l_requestor_id,
                   	    l_source_name,
                   	    l_case_folder_number,
                   	    l_currency,
                   	    l_amount_requested,
                   	    l_credit_request_type,
                   	    l_requestor_type
                FROM   ar_cmgt_credit_requests req,
                	   hz_parties party
                WHERE  credit_request_id = itemkey
				AND    req.party_id = party.party_id;
Line: 1612

					SELECT user_name
					INTO   l_requestor_user_name
					FROM   fnd_user
					WHERE  user_id = l_requestor_id;
Line: 1658

        		SELECT ACCOUNT_NUMBER
        		INTO   l_account_number
        		FROM   hz_cust_accounts
				WHERE  cust_account_id = l_cust_account_id;
Line: 1681

            SELECT check_list_id, score_model_id
            INTO   l_check_list_id, l_score_model_id
            FROM   ar_cmgt_check_lists
            WHERE  submit_flag = 'Y'
            AND    credit_classification = l_credit_classification
            AND    review_type = l_review_type
	    AND    SYSDATE BETWEEN start_date and nvl(end_date,SYSDATE);
Line: 1731

        	--Update credit request table with checklistid
        	UPDATE ar_cmgt_credit_requests
        	set    check_list_id = l_check_list_id
        	WHERE  credit_request_id = itemkey;
Line: 1758

	  SELECT recommendation_value2
	  FROM ar_cmgt_cf_recommends
	  WHERE credit_recommendation = 'CREDIT_LIMIT'
	  AND credit_request_id = itemkey;
Line: 1764

	  SELECT recommendation_value2
	  FROM ar_cmgt_cf_recommends
	  WHERE credit_recommendation = 'TXN_CREDIT_LIMIT'
	  AND credit_request_id = itemkey;
Line: 1859

	SELECT trx_amount
	INTO   l_trx_amount
	FROM ar_cmgt_credit_requests
	WHERE credit_request_id = itemkey;
Line: 1878

                SELECT score_model_id
                INTO   l_score_model_id_1
                FROM   ar_cmgt_scores
                WHERE  score_model_id = l_score_model_id
                AND    submit_flag = 'Y'
                AND    TRUNC(sysdate) between TRUNC(start_date) and TRUNC(nvl(end_date,SYSDATE));
Line: 1927

            SELECT currency
            INTO   l_score_currency
            FROM   ar_cmgt_scores
            WHERE  score_model_id = l_score_model_id
            and    submit_flag = 'Y'
            and    TRUNC(nvl(end_date, SYSDATE)) >= TRUNC(sysdate)
            and    ((currency = l_limit_currency) OR (nvl(skip_currency_test_flag, 'N') = 'Y')); -- Added for bug 8600040
Line: 1973

        delete ar_cmgt_case_folders
            WHERE case_folder_id = case_folder_id;
Line: 1975

        delete ar_cmgt_cf_dtls
            WHERE case_folder_id = case_folder_id;
Line: 2011

    l_case_folder_date		ar_cmgt_case_folders.last_updated%type;
Line: 2019

            SELECT  credit_classification, review_type,
                    cust_account_id, party_id, site_use_id, nvl(limit_currency,trx_currency),
                    source_org_id, case_folder_number
            INTO    l_credit_classification, l_review_type, l_cust_account_id,
                    l_party_id, l_cust_acct_site_id, l_trx_currency, l_org_id,
                    l_case_folder_number
            FROM    ar_cmgt_credit_requests
            WHERE   credit_request_id = itemkey;
Line: 2101

			SELECT case_folder_number, last_updated
			INTO   l_case_folder_number, l_case_folder_date
			FROM   ar_cmgt_case_folders
			WHERE  case_folder_id = l_case_folder_id;
Line: 2221

        SELECT score_model_id
        INTO   l_score_model_id_1
        FROM   ar_cmgt_scores
        WHERE  score_model_id = l_score_model_id
        AND    submit_flag = 'Y'
        AND    TRUNC(sysdate) between TRUNC(start_date) and TRUNC(nvl(end_date,SYSDATE));
Line: 2235

        SELECT auto_rules_id
        INTO   l_auto_rules_id
        FROM   ar_cmgt_auto_rules
        WHERE  score_model_id = l_score_model_id
        AND    submit_flag = 'Y'
        AND    TRUNC(sysdate) between TRUNC(start_date) and TRUNC(nvl(end_date,SYSDATE));
Line: 2302

        SELECT currency
        INTO  l_trans_currency
		FROM ar_cmgt_scores
		where score_model_id = (SELECT score_model_id
                        		FROM ar_cmgt_case_folders
                        		WHERE case_folder_id = l_case_folder_id);
Line: 2310

        SELECT  override_checklist_flag, skip_approval_flag
        INTO   l_override_checklist, l_skip_approval
        FROM   ar_cmgt_auto_rule_dtls
        WHERE  auto_rules_id = l_auto_rules_id
        AND    l_score between credit_score_low and credit_score_high
        AND    currency = l_trans_currency;	-- Fixed for bug 9871620
Line: 2423

    	select distinct  data_point_id
    	from ar_cmgt_score_dtls
    	where score_model_id= l_score_model_id;
Line: 2451

            SELECT nvl(null_zero_flag,'N')
            INTO   l_null_zero_flag
            FROM   ar_cmgt_scores
            WHERE  score_model_id = l_score_model_id;
Line: 2470

            SELECT RETURN_DATA_TYPE, data_point_code
            INTO   l_data_point_type, l_data_point_code
            FROM   AR_CMGT_SCORABLE_DATA_POINTS_V
            WHERE  DATA_POINT_ID = dp_id_collec_rec.data_point_id;
Line: 2498

	    			SELECT  case1.data_point_value, case1.data_point_id
            		INTO    l_data_point_value, l_data_point_id
            		FROM    ar_cmgt_score_dtls score,
                    		ar_cmgt_cf_dtls case1
            		WHERE   score.score_model_id = l_score_model_id
            		AND     case1.case_folder_id = l_case_folder_id
            		AND     score.data_point_id  = case1.data_point_id
            		AND     score.data_point_id = dp_id_collec_rec.data_point_id
            		AND     case1.data_point_value IS NULL;
Line: 2548

	SELECT recommendation_value2
	FROM ar_cmgt_cf_recommends
	WHERE credit_recommendation = 'CREDIT_LIMIT'
	AND credit_request_id = itemkey;
Line: 2554

	SELECT recommendation_value2
	FROM ar_cmgt_cf_recommends
	WHERE credit_recommendation = 'TXN_CREDIT_LIMIT'
	AND credit_request_id = itemkey;
Line: 2624

procedure UPDATE_RECOMMENDATION
        ( p_party_id                IN      NUMBER,
          p_cust_account_id         IN      NUMBER,
          p_site_use_id             IN      NUMBER default null,
          p_credit_recommendation   IN      VARCHAR2,
          p_reco_value1             IN      VARCHAR2,
          p_reco_value2             IN      VARCHAR2) IS

    l_sql_statement                 VARCHAR2(2000);
Line: 2641

                        ' UPDATE hz_customer_profiles ' ||
                        ' set credit_classification = :1 ,'||
                        ' last_update_date = sysdate ,'||
                        ' last_updated_by = fnd_global.user_id, '||
                        ' last_update_login = fnd_global.login_id '||
                        ' where party_id = :2 '||
                        ' and cust_account_id = :3 '||
                        ' and site_use_id IS NULL' ;
Line: 2656

                        ' UPDATE hz_customer_profiles ' ||
                        ' set credit_classification = :1, '||
                        ' last_update_date = sysdate ,'||
                        ' last_updated_by = fnd_global.user_id, '||
                        ' last_update_login = fnd_global.login_id '||
                        ' where party_id = :2 '||
                        ' and cust_account_id = :3 '||
                        ' and site_use_id = :4 ';
Line: 2674

                    UPDATE  hz_cust_profile_amts
                        set trx_credit_limit = p_reco_value2,
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id IS NULL )
                    AND      currency_code = p_reco_value1;
Line: 2688

                    UPDATE  hz_cust_profile_amts
                        set trx_credit_limit = p_reco_value2,
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id = p_site_use_id )
                    AND      currency_code = p_reco_value1;
Line: 2705

                    UPDATE  hz_cust_profile_amts
                        set overall_credit_limit = p_reco_value2,
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id IS NULL )
                    AND      currency_code = p_reco_value1;
Line: 2719

                    UPDATE  hz_cust_profile_amts
                        set overall_credit_limit = p_reco_value2,
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id = p_site_use_id )
                    AND      currency_code = p_reco_value1;
Line: 2736

                    UPDATE  hz_customer_profiles
                        set credit_hold = 'Y',
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE party_id = p_party_id
                      AND cust_account_id = p_cust_account_id
                      AND site_use_id IS NULL;
Line: 2746

                    UPDATE  hz_customer_profiles
                        set credit_hold = 'Y',
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE party_id = p_party_id
                      AND cust_account_id = p_cust_account_id
                      AND site_use_id = p_site_use_id;
Line: 2760

                    UPDATE  hz_customer_profiles
                        set credit_hold = 'N',
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE party_id = p_party_id
                      AND cust_account_id = p_cust_account_id
                      AND site_use_id IS NULL;
Line: 2770

                    UPDATE  hz_customer_profiles
                        set credit_hold = 'N',
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE party_id = p_party_id
                      AND cust_account_id = p_cust_account_id
                      AND site_use_id = p_site_use_id;
Line: 2783

                    UPDATE  hz_cust_profile_amts
                        set overall_credit_limit = (overall_credit_limit +
                                    ( overall_credit_limit * p_reco_value2/100)),
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id IS NULL )
                    AND      currency_code = p_reco_value1;
Line: 2798

                    UPDATE  hz_cust_profile_amts
                        set overall_credit_limit = (overall_credit_limit +
                                    ( overall_credit_limit * p_reco_value2/100)),
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id = p_site_use_id )
                    AND      currency_code = p_reco_value1;
Line: 2816

                    UPDATE  hz_cust_profile_amts
                        set trx_credit_limit = (trx_credit_limit +
                                    ( trx_credit_limit * p_reco_value2/100)),
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id IS NULL )
                    AND      currency_code = p_reco_value1;
Line: 2831

                    UPDATE  hz_cust_profile_amts
                        set trx_credit_limit = (trx_credit_limit +
                                    ( trx_credit_limit * p_reco_value2/100)),
                            last_update_date = sysdate,
                            last_updated_by = fnd_global.user_id,
                            last_update_login = fnd_global.login_id
                    WHERE   cust_account_profile_id = (
                                    select cust_account_profile_id
                                    from hz_customer_profiles
                                    WHERE  party_id = p_party_id
                                    AND    cust_account_id = p_cust_account_id
                                    AND    site_use_id = p_site_use_id )
                    AND      currency_code = p_reco_value1;
Line: 2856

    insert_failure                  EXCEPTION;
Line: 2874

        SELECT a.credit_recommendation, a.recommendation_value1,
               a.recommendation_value2
        FROM   ar_cmgt_auto_recommends a, ar_cmgt_auto_rule_dtls b
        WHERE  a.auto_rule_details_id = b.auto_rule_details_id
        AND    l_score between b.credit_score_low and b.credit_score_high
        AND    a.credit_type = l_credit_type
        AND    b.auto_rules_id = l_auto_rules_id;
Line: 2885

        SELECT CREDIT_TYPE, credit_request_type
        INTO   l_credit_type, l_credit_request_type
        FROM   ar_cmgt_credit_requests
        WHERE  credit_request_id = itemkey;
Line: 2937

               raise insert_failure;
Line: 2951

        WHEN insert_failure THEN
                wf_core.context('AR_CMGT_WF_ENGINE','GENERATE_RECOMMENDATION',itemtype,
                            itemkey,
                            'Error while inserting into ar_cmgt_cf_recommends',
                            sqlerrm);
Line: 3041

procedure UPDATE_AME_APPROVE(
	itemtype		in 	varchar2,
	itemkey			in	varchar2,
	actid			in	number,
	funcmode		in	varchar2,
	resultout		out NOCOPY	varchar2) IS

    l_case_folder_id number;
Line: 3057

	  SELECT recommendation_value2
	  FROM ar_cmgt_cf_recommends
	  WHERE credit_recommendation = 'CREDIT_LIMIT'
	  AND credit_request_id = itemkey;
Line: 3063

	  SELECT recommendation_value2
	  FROM ar_cmgt_cf_recommends
	  WHERE credit_recommendation = 'TXN_CREDIT_LIMIT'
	  AND credit_request_id = itemkey;
Line: 3084

       ame_api.updateApprovalStatus2(applicationIdIn => 222,
                                     transactionIdIn => l_case_folder_id,
                                     approvalStatusIn => AME_UTIL.approvedStatus,
                                     approverPersonIdIn => l_approver_id,
                                     transactionTypeIn => 'ARCMGTAP');
Line: 3121

procedure UPDATE_AME_REJECT(
	itemtype		in 	varchar2,
	itemkey			in	varchar2,
	actid			in	number,
	funcmode		in	varchar2,
	resultout		out NOCOPY	varchar2) IS

    l_case_folder_id number;
Line: 3139

       ame_api.updateApprovalStatus2(applicationIdIn => 222,
                                     transactionIdIn => l_case_folder_id,
                                     approvalStatusIn => AME_UTIL.rejectStatus,
                                     approverPersonIdIn => l_approver_id,
                                     transactionTypeIn => 'ARCMGTAP');
Line: 3144

      Update ar_cmgt_cf_recommends
            set status = 'R',
                last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
        WHERE case_folder_id = l_case_folder_id;
Line: 3151

      Update ar_cmgt_case_folders
            set status = 'CLOSED',
                last_updated = sysdate,
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
      WHERE  case_folder_id = l_case_folder_id;
Line: 3159

      Update ar_cmgt_credit_requests
            set status = 'PROCESSED',
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
        WHERE  credit_request_id = itemkey;
Line: 3193

        SELECT credit_recommendation, recommendation_value1,
               recommendation_value2
        FROM   ar_cmgt_cf_recommends
        WHERE  case_folder_id = l_case_folder_id
        AND    credit_type    = l_credit_type;
Line: 3210

            SELECT party_id, decode(cust_account_id,-99,-1,cust_account_id),
                   decode(site_use_id,-99,null,site_use_id), credit_type
            INTO   l_party_id, l_cust_account_id, l_site_use_id, l_credit_type
            FROM   ar_cmgt_credit_requests
            WHERE  credit_request_id = itemkey;
Line: 3240

               UPDATE_RECOMMENDATION
                    ( p_party_id                => l_party_id,
                      p_cust_account_id         => l_cust_account_id,
                      p_site_use_id             => l_site_use_id,
                      p_credit_recommendation   => c_reco_rec.credit_recommendation,
                      p_reco_value1             => c_reco_rec.recommendation_value1,
                      p_reco_value2             => l_amount);
Line: 3248

               UPDATE_RECOMMENDATION
                    ( p_party_id                => l_party_id,
                      p_cust_account_id         => l_cust_account_id,
                      p_site_use_id             => l_site_use_id,
                      p_credit_recommendation   => c_reco_rec.credit_recommendation,
                      p_reco_value1             => c_reco_rec.recommendation_value1,
                      p_reco_value2             => trunc(c_reco_rec.recommendation_value2));
Line: 3348

                SELECT recommendation_value1,RECOMMENDATION_ID
                INTO l_dayz,l_reco_id
                FROM ar_cmgt_cf_recommends
                WHERE CASE_FOLDER_ID = l_case_folder_id
                AND credit_recommendation = 'AUTHORIZE_APPEAL';
Line: 3374

	 --update number of days in ar_cmgt_cf_recommends

               UPDATE AR_CMGT_CF_RECOMMENDS
               SET RECOMMENDATION_VALUE2 = fnd_date.DATE_TO_CANONICAL(trunc(sysdate) + to_number(trunc(l_dayz))),
	       last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
               WHERE RECOMMENDATION_ID = l_reco_id;
Line: 3403

                  UPDATE hz_customer_profiles
                  SET REVIEW_CYCLE = c_reco_rec.recommendation_value1,
                      NEXT_CREDIT_REVIEW_DATE =
                      DECODE(c_reco_rec.recommendation_value1,
                                 'YEARLY',     (l_last_revw_date + 365),
                                 'HALF_YEARLY',(l_last_revw_date + 180),
                                 'QUARTERLY',  (l_last_revw_date + 90),
                                 'MONTHLY',    (l_last_revw_date + 30),
                                 'WEEKLY',     (l_last_revw_date + 7),
                                                l_last_revw_date + 1),
                      LAST_CREDIT_REVIEW_DATE = l_last_revw_date,
                      last_update_date = sysdate,
                      last_updated_by = fnd_global.user_id,
                      last_update_login = fnd_global.login_id
                   WHERE  party_id = l_party_id
	           AND cust_account_id =  l_cust_account_id
	           AND  ((l_site_use_id IS NULL AND site_use_id IS NULL) OR
                          site_use_id = l_site_use_id);
Line: 3424

                  debug(SQL%ROWCOUNT || ' hz_customer_rofiles row(s) updated.');
Line: 3431

        Update ar_cmgt_cf_recommends
            set status = 'I',
                last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
        WHERE case_folder_id = l_case_folder_id;
Line: 3438

        Update ar_cmgt_case_folders
            set status = 'CLOSED',
                last_updated = sysdate,
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
        WHERE  case_folder_id = l_case_folder_id;
Line: 3446

        Update ar_cmgt_credit_requests
            set status = 'PROCESSED',
                last_update_date = sysdate,
               last_updated_by = fnd_global.user_id,
               last_update_login = fnd_global.login_id
        WHERE  credit_request_id = itemkey;
Line: 3489

	SELECT recommendation_value2
	FROM ar_cmgt_cf_recommends
	WHERE credit_recommendation = 'CREDIT_LIMIT'
	AND credit_request_id = itemkey;
Line: 3495

	SELECT recommendation_value2
	FROM ar_cmgt_cf_recommends
	WHERE credit_recommendation = 'TXN_CREDIT_LIMIT'
	AND credit_request_id = itemkey;
Line: 3532

            SELECT party_id, decode(cust_account_id,-99,-1,cust_account_id),
                   decode(site_use_id,-99,null,site_use_id)
            INTO   l_party_id, l_cust_account_id, l_site_use_id
            FROM   ar_cmgt_credit_requests
            WHERE  credit_request_id = itemkey;
Line: 3548

      /* Update the risk factor data point value */

        BEGIN
            SELECT DECODE(to_number(NVL(cfd.data_point_value,'1')),0,1,NVL(cfd.data_point_value,'1'))
            INTO   l_exposure
            FROM   ar_cmgt_cf_dtls cfd
            WHERE  cfd.case_folder_id = l_case_folder_id
            AND    cfd.data_point_id = 34;
Line: 3563

            SELECT nvl(overall_credit_limit,0)
            INTO   l_credit_limit
            FROM   hz_cust_profile_amts hzp
            WHERE  cust_account_profile_id = (
                       SELECT cust_account_profile_id
                          FROM hz_customer_profiles
                          WHERE party_id = l_party_id
                          AND   cust_account_id = l_cust_account_id
                          AND  ( site_use_id IS NULL
                                 OR site_use_id =  l_site_use_id))
            AND   currency_code = l_limit_currency;
Line: 3581

        AR_CMGT_CONTROLS.UPDATE_CASE_FOLDER_DETAILS (
                    p_case_folder_id        =>  l_case_folder_id,
                    p_data_point_id         =>  182,
                    p_data_point_value      =>  l_risk_factor,
                    p_score                 =>  NULL,
                    p_errmsg                =>  l_errmsg,
                    p_resultout             =>  l_resultout);
Line: 3591

        	SELECT a.parent_credit_request_id
        	INTO   l_parent_credit_request_id
        	FROM   ar_cmgt_credit_requests a, ar_cmgt_credit_requests b
        	WHERE  a.credit_request_id = itemkey
			AND    a.parent_credit_request_id = b.credit_request_id
			AND    b.status <> 'PROCESSED';
Line: 3630

    SELECT CREDIT_RECOMMENDATION,RECOMMENDATION_ID
    FROM AR_CMGT_CF_RECOMMENDS
    WHERE CREDIT_REQUEST_ID = itemkey;
Line: 3635

    select case_folder_id
    INTO   l_case_folder_id
    FROM   ar_cmgt_case_folders
    WHERE  credit_request_id = itemkey
    and    type = 'CASE';
Line: 3654

PROCEDURE UPDATE_SKIP_APPROVAL_FLAG (
	itemtype		in 	varchar2,
	itemkey			in	varchar2,
	actid			in	number,
	funcmode		in	varchar2,
	resultout		out NOCOPY	varchar2) IS

    l_failure_function      VARCHAR2(60);
Line: 3678

PROCEDURE UPDATE_CF_TO_CREATE (
	itemtype		in 	varchar2,
	itemkey			in	varchar2,
	actid			in	number,
	funcmode		in	varchar2,
	resultout		out NOCOPY	varchar2) IS

    l_case_folder_id        ar_cmgt_case_folders.case_folder_id%type;
Line: 3692

    UPDATE ar_cmgt_case_folders
        set status = 'CREATED',
            last_updated = sysdate,
            last_update_date = sysdate,
            last_updated_by = fnd_global.user_id,
            last_update_login = fnd_global.login_id
    WHERE case_folder_id = l_case_folder_id;
Line: 3703

PROCEDURE update_credit_analyst_info(p_itemkey			IN	VARCHAR2,
                                     p_credit_analyst_id IN VARCHAR2) IS
  l_credit_analyst_id        NUMBER(15);
Line: 3712

  SELECT credit_analyst_id, original_credit_analyst_id,
         previous_credit_analyst_id, case_folder_number
  FROM
         ar_cmgt_case_folders
  WHERE  credit_request_id = p_itemkey
  AND    type = 'CASE';
Line: 3728

     UPDATE ar_cmgt_case_folders
     SET original_credit_analyst_id = l_credit_analyst_id,
         previous_credit_analyst_id = l_credit_analyst_id
     WHERE case_folder_number = l_case_folder_number;
Line: 3734

       UPDATE ar_cmgt_case_folders
       SET original_credit_analyst_id = NULL,
           previous_credit_analyst_id = NULL
       WHERE case_folder_number = l_case_folder_number;
Line: 3739

       UPDATE ar_cmgt_case_folders
       SET previous_credit_analyst_id = l_credit_analyst_id
       WHERE case_folder_number = l_case_folder_number;
Line: 3745

END update_credit_analyst_info;
Line: 3748

/* This procedure is used tyo update a particular
 ** workflow item attribute, for eg. credit_analyst_id */
PROCEDURE UPDATE_WF_ATTRIBUTE (
	p_itemkey			IN		VARCHAR2,
    p_attribute_type    IN      VARCHAR2,
	p_attribute_name	IN		VARCHAR2,
	p_attribute_value	IN		VARCHAR2 ) IS

	l_person_id             per_people_f.person_id%type;
Line: 3763

	SELECT wfn.notification_id, wfs.assigned_user
	FROM wf_item_activity_statuses wfs, wf_notifications wfn
	WHERE wfs.item_type = 'ARCMGTAP'
	AND  wfs.item_key = p_itemkey
	AND  wfs.notification_id is not null
	AND  wfs.notification_id = wfn.notification_id
	AND  wfn.status = 'OPEN';
Line: 3818

      update_credit_analyst_info(p_itemkey			 => p_itemkey,
                                 p_credit_analyst_id => p_attribute_value);
Line: 3823

END UPDATE_WF_ATTRIBUTE;
Line: 3840

     		SELECT r.credit_request_id, r.credit_request_type, r.status
     		INTO   l_credit_request_id, l_credit_request_type, l_status
     		FROM   ar_cmgt_credit_requests r
     		WHERE  r.parent_credit_request_id = itemkey
			AND    r.status <> 'PROCESSED';
Line: 3878

   		SELECT 'Y'
        FROM ar_cmgt_cf_recommends
		WHERE CASE_FOLDER_ID=l_case_folder_id;
Line: 3940

        	SELECT 'X'
        	INTO   l_flag
        	FROM   ar_cmgt_cf_recommends cf, ar_cmgt_credit_requests req
        	WHERE  req.credit_request_id = itemkey
        	AND    req.credit_request_id = cf.credit_request_id
        	AND    req.cust_account_id = -99
        	AND    req.site_use_id = -99
        	AND    cf.credit_recommendation = 'CUST_HOLD';
Line: 4037

    insert_failure                  EXCEPTION;
Line: 4058

        SELECT credit_request_type
        INTO   l_credit_request_type
        FROM   ar_cmgt_credit_requests
        WHERE  credit_request_id = itemkey;
Line: 4091

			SELECT PARENT_CREDIT_REQUEST_ID
			INTO l_parent_creq_id
			FROM AR_CMGT_CREDIT_REQUESTS
			WHERE CREDIT_REQUEST_ID = itemkey;
Line: 4108

       		SELECT CASE_FOLDER_ID
       		INTO l_parent_cf_id
       		FROM AR_CMGT_CASE_FOLDERS
       		WHERE CREDIT_REQUEST_ID = l_parent_creq_id
       		and type = 'CASE';
Line: 4350

            SELECT req.credit_classification, req.review_type,
                   nvl(req.limit_currency, trx_currency),
                   nvl(nvl(req.limit_amount,req.trx_amount),0),
                   req.case_folder_number, req.score_model_id, req.source_name,
                   req.application_number,
                   lkp1.meaning classification_meaning,
                   lkp2.meaning review_type_meaning,
                   requestor_id,
                   application_date,
                   req.party_id,
                   cust_account_id,
                   source_column1,
                   source_column2,
                   source_column3,
                   party.party_name,
                   party.party_number,
                   req.notes,
                   nvl(req.requestor_type, 'EMPLOYEE')
            INTO   l_credit_classification, l_review_type, l_currency,
                   l_amount_requested, l_case_folder_number, l_score_model_id,
                   l_source_name, l_application_number,
                   l_classification_meaning,
                   l_review_type_meaning,
                   l_requestor_id,
                   l_application_date,
                   l_party_id,
                   l_cust_account_id,
                   l_source_column1,
                   l_source_column2,
                   l_source_column3,
                   l_party_name,
                   l_party_number,
                   l_notes,
                   l_requestor_type
            FROM   ar_cmgt_credit_requests req,
                   ar_lookups lkp1,
                   ar_lookups lkp2,
                   hz_parties party
            WHERE  req.credit_request_id = itemkey
            AND    req.party_id = party.party_id
            AND    lkp1.lookup_type = 'AR_CMGT_CREDIT_CLASSIFICATION'
            AND    lkp1.lookup_code = req.credit_classification
            AND    lkp2.lookup_type = 'AR_CMGT_REVIEW_TYPE'
            AND    lkp2.lookup_code = req.review_type;
Line: 4396

                SELECT req.credit_classification, req.review_type, req.application_number,
                       req.score_model_id,
                       application_date,
                   	   req.party_id,
                   	   cust_account_id,
                   	   source_column1,
                   	   source_column2,
                   	   source_column3,
                   	   party.party_name,
                   	   party.party_number,
                   	   req.notes,
                   	   req.requestor_id,
                   	   req.source_name,
                   	   req.case_folder_number,
					   nvl(req.limit_currency, trx_currency),
                   	   nvl(nvl(req.limit_amount,req.trx_amount),0),
                   	   nvl(req.requestor_type, 'EMPLOYEE')
                INTO   l_credit_classification, l_review_type, l_application_number,
                       l_score_model_id,
                    	l_application_date,
                   		l_party_id,
                   		l_cust_account_id,
                   		l_source_column1,
                   		l_source_column2,
                   		l_source_column3,
                   		l_party_name,
                   	    l_party_number,
                   	    l_notes,
                   	    l_requestor_id,
                   	    l_source_name,
                   	    l_case_folder_number,
                   	    l_currency,
                   	    l_amount_requested,
                   	    l_requestor_type
                FROM   ar_cmgt_credit_requests req,
                	   hz_parties party
                WHERE  credit_request_id = itemkey
				AND    req.party_id = party.party_id;
Line: 4520

					SELECT user_name
					INTO   l_requestor_user_name
					FROM   fnd_user
					WHERE  user_id = l_requestor_id;
Line: 4549

        		SELECT ACCOUNT_NUMBER
        		INTO   l_account_number
        		FROM   hz_cust_accounts
				WHERE  cust_account_id = l_cust_account_id;
Line: 4573

        		SELECT case_folder_id, case_folder_number, check_list_id, score_model_id,
        			   limit_currency, creation_date_time
				INTO   l_case_folder_id, l_case_folder_number, l_check_list_id, l_score_model_id,
					   l_limit_currency, l_creation_date_time
				FROM   ar_cmgt_case_folders
				WHERE  credit_request_id = itemkey
				AND    type = 'CASE';
Line: 4658

    select sc.data_point_id, dp.data_point_code
    from ar_cmgt_score_dtls sc, ar_cmgt_data_points_vl dp
    where sc.score_model_id= l_score_model_id
    AND   sc.data_point_id = dp.data_point_id
    AND   dp.data_point_code = 'OCM_EXTERNAL_SCORE';
Line: 4712

            UPDATE ar_cmgt_case_folders
      		SET request_id = l_request_id,
	    		status = 'IN_PROCESS',
	    		last_update_date = sysdate,
	    		last_updated_by = fnd_global.user_id,
	    		last_update_login = fnd_global.login_id
      		WHERE case_folder_id = l_case_folder_id;
Line: 4747

        insert_failure                  EXCEPTION;
Line: 4753

        SELECT sum(nvl(SCORE,0))
        FROM AR_CMGT_CF_DTLS
        WHERE CASE_FOLDER_ID=p_cf_id;
Line: 4760

        SELECT cf.score_model_id,cr.credit_type
        from ar_cmgt_case_folders cf,ar_cmgt_credit_requests cr
        where case_folder_id=p_cf_id
        and cr.credit_request_id=cf.credit_request_id;
Line: 4769

        SELECT auto_rules_id
		FROM ar_cmgt_auto_rules
		WHERE score_model_id=l_score_model_id
		AND Trunc(SYSDATE) BETWEEN Trunc(start_date) AND Trunc(Nvl(end_date,SYSDATE))
        AND submit_flag='Y';
Line: 4778

		SELECT a.credit_recommendation, a.recommendation_value1,
				a.recommendation_value2
		FROM   ar_cmgt_auto_recommends a, ar_cmgt_auto_rule_dtls b
		WHERE  a.auto_rule_details_id = b.auto_rule_details_id
		AND    l_score between b.credit_score_low and b.credit_score_high
		AND    a.credit_type = l_credit_type
        AND    b.auto_rules_id = l_auto_rules_id;
Line: 4858

    		 UPDATE ar_cmgt_case_folders
      		SET request_id = p_request_id,
	    		status = 'IN_PROCESS',
	    		last_update_date = sysdate,
	    		last_updated_by = fnd_global.user_id
      		WHERE case_folder_id = p_case_folder_id;