DBA Data[Home] [Help]

APPS.ASG_DOWNLOAD SQL Statements

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

Line: 43

    l_qry := 'select '||l_pkstr||' from asg_delete_queue where qid = :1';
Line: 59

    l_qry := 'select client_id,pub_item,access_id,dml_type, '||
             ' transaction_id,null pk_val,sysdate synch_time '||
             ' from asg_system_dirty_queue '||
             ' where download_flag=''Y'' and client_id=asg_base.get_user_name'||
             ' and transaction_id = asg_base.get_current_tranid '||
             ' and dml_type <> 0 '||
             ' and pub_item in ( select item_id from asg_pub_item '||
             ' where nvl(enable_download_events,''N'') = ''Y''  )'||
             ' UNION ALL '||
             ' select client_id,pub_item,access_id,dml_type, '||
             ' transaction_id , asg_download.get_pk(pub_item,sdq.qid) pk_val, '||
             ' sysdate synch_time '||
             ' from asg_system_dirty_queue sdq,asg_delete_queue dq '||
             ' where download_flag=''Y'' and client_id=asg_base.get_user_name'||
             ' and transaction_id = asg_base.get_current_tranid '||
             ' and dml_type = 0 '||
             ' and pub_item in ( select item_id from asg_pub_item '||
             ' where nvl(enable_download_events,''N'') = ''Y''  ) '||
             ' and sdq.qid=dq.qid ';
Line: 78

    select count(*) into l_ct
    from asg_system_dirty_queue
    where download_flag='Y'
    and client_id = asg_base.get_user_name
    and transaction_id = asg_base.get_current_tranid
    and pub_item in
    ( select item_id from asg_pub_item
      where nvl(enable_download_events,'N') = 'Y');
Line: 95

      select asg_events_s.nextval into l_seq from dual;
Line: 122

    l_qry := 'select client_id,pub_item,access_id,dml_type, '||
             ' transaction_id last_tran_id,asg_base.get_current_tranid '||
             ' curr_tran_id ,null pk_val,sysdate synch_time '||
             ' from asg_system_dirty_queue '||
             ' where download_flag=''Y'' and client_id=asg_base.get_user_name'||
             ' and transaction_id <= asg_base.get_last_tranid '||
             ' and dml_type <> 0 '||
             ' and pub_item in ( select item_id from asg_pub_item '||
             ' where nvl(enable_download_events,''N'') = ''Y''  )'||
             ' UNION ALL '||
             ' select client_id,pub_item,access_id,dml_type, '||
             ' transaction_id last_tran_id,asg_base.get_current_tranid '||
             ' curr_tran_id, asg_download.get_pk(pub_item,sdq.qid) pk_val, '||
             ' sysdate synch_time '||
             ' from asg_system_dirty_queue sdq,asg_delete_queue dq '||
             ' where download_flag=''Y'' and client_id=asg_base.get_user_name'||
             ' and transaction_id <= asg_base.get_last_tranid '||
             ' and dml_type = 0 '||
             ' and pub_item in ( select item_id from asg_pub_item '||
             ' where nvl(enable_download_events,''N'') = ''Y''  )'||
             ' and sdq.qid=dq.qid ';
Line: 143

    select count(*) into l_ct
    from asg_system_dirty_queue
    where download_flag='Y'
    and client_id = asg_base.get_user_name
    and transaction_id <= asg_base.get_last_tranid
    and pub_item in
    ( select item_id from asg_pub_item
      where nvl(enable_download_events,'N') = 'Y');
Line: 160

      select asg_events_s.nextval into l_seq from dual;
Line: 269

    l_query := 'SELECT COUNT(*) FROM '||CONS_SCHEMA||'.'||'c$pub_list_q '
               ||' WHERE comp_ref <> ''Y''';
Line: 283

  /** Function to Capture the PK of a Deleted Record
   *  in asg_delete_queue */
  FUNCTION storeDeletedPK ( p_pub_item     IN VARCHAR2,
                            p_accessList   IN access_list,
                            p_qidList      IN qid_list
                           ) RETURN BOOLEAN IS

    l_pk_list       VARCHAR2(500);
Line: 307

    log ('Function storeDeletedPK');
Line: 326

    l_dml := 'SELECT base_owner, base_object_name, access_owner, access_name '||
             ' FROM asg_pub_item WHERE name=:1';
Line: 334

      DBMS_SQL.PARSE (l_cur_id, 'INSERT INTO asg_delete_queue '
                                || '(qid, creation_date, created_by, '
                                || 'last_update_date, last_updated_by '
                                || l_att_col_list
                                || ') SELECT :1, sysdate, '
                                || '1, sysdate, 1, '||l_pk_list
                                || ' FROM '||l_base_owner||'.'||l_base_object
                                || ' WHERE access_id = :2', DBMS_SQL.v7);
Line: 343

      DBMS_SQL.PARSE (l_cur_id, 'INSERT INTO asg_delete_queue '
                                || ' (qid, creation_date, '
                                || 'created_by, last_update_date, '
                                || 'last_updated_by '||l_att_col_list
                                || ') SELECT :1, sysdate, '
                                || '1, sysdate, 1, '||l_pk_list
                                || ' FROM '||l_access_owner||'.'||l_access_name
                                || ' WHERE access_id = :2', DBMS_SQL.v7);
Line: 359

    log ('END Function storeDeletedPK');
Line: 366

  END storeDeletedPK;
Line: 369

  /** Function to Capture the PK of a Deleted Record
   *  in asg_delete_queue given the PK List */
  FUNCTION storeDeletedPK ( p_pub_item     IN VARCHAR2,
                            p_qid          IN NUMBER,
                            p_pkvalList    IN pk_list
                           ) RETURN BOOLEAN IS

    l_att_col_list  VARCHAR2(500);
Line: 383

    log ('Function storeDeletedPK - with PK Values Given');
Line: 394

      l_dml := 'INSERT INTO asg_delete_queue (qid, creation_date, '
               || 'created_by, last_update_date, last_updated_by '
               || l_att_col_list || ') VALUES '
               || ' ( ' || p_qid || ', sysdate, 1, sysdate, 1 '||l_pk_val_list
               || ')';
Line: 403

    log ('END Function storeDeletedPK - with PK Values Given');
Line: 410

  END storeDeletedPK;
Line: 413

  /** Function to store the PK of a Deleted Record
   *  in asg_delete_queue - For Reject Record */
  FUNCTION storeDeletedPK ( p_pub_item     IN VARCHAR2,
                            p_client_name  IN VARCHAR2,
                            p_tran_id      IN NUMBER,
                            p_seq_no       IN NUMBER,
                            p_qid          IN NUMBER
                           ) RETURN BOOLEAN IS

    l_pk_list       VARCHAR2(500);
Line: 433

    log ('Function storeDeletedPK - Reject Record');
Line: 444

    l_dml := 'SELECT inq_owner, inq_name FROM asg_pub_item '||
             ' WHERE name=:1';
Line: 457

    l_dml := 'INSERT INTO asg_delete_queue (qid, creation_date, '
            || 'created_by, last_update_date, last_updated_by '||l_att_col_list
            || ') SELECT :1, sysdate, '
            || '1, sysdate, 1, '||l_pk_list
            || ' FROM '||l_inq_owner||'.'||l_inq_name
            || ' WHERE clid$$cs = :2 AND TRANID$$ = :3 AND seqno$$ = :4';
Line: 465

    log ('END Function storeDeletedPK - Reject Record');
Line: 472

  END storeDeletedPK;
Line: 492

    IF (insert_sdq(p_pub_item,p_user_name) AND
        is_exists(p_user_name,p_pub_item,p_seq_no,'D'))
    THEN
      INSERT INTO asg_system_dirty_queue (
        qid, creation_date, created_by, last_update_date, last_updated_by,
        pub_item, access_id, client_id, transaction_id
        , dml_type, download_flag)
      VALUES (
        asg_system_dirty_queue_s.nextval, SYSDATE, 1, SYSDATE, 1,
        p_pub_item, p_seq_no, p_user_name, NULL , 0, NULL)
      RETURNING qid INTO l_qid;
Line: 504

      l_rc := storeDeletedPK(p_pub_item, p_user_name, p_tran_id,
                           p_seq_no, l_qid);
Line: 536

    IF (insert_sdq(p_pub_item,p_username) AND
        is_exists(p_username,p_pub_item,p_accessid,p_dml))
    THEN
      INSERT INTO asg_system_dirty_queue (
        qid, creation_date, created_by, last_update_date, last_updated_by,
        pub_item, access_id, client_id, transaction_id
        , dml_type, download_flag)
      VALUES (
        asg_system_dirty_queue_s.nextval, SYSDATE, 1, SYSDATE, 1,
        p_pub_item, p_accessid, p_username, NULL ,
        DECODE(p_dml,'D',0,'I',1,'U',2), NULL)
      RETURNING qid INTO l_qid;
Line: 552

        l_rc := storeDeletedPK(p_pub_item, l_accesslist, l_qidlist);
Line: 610

    IF (insert_sdq(p_pub_item,p_username) AND
        is_exists(p_username,p_pub_item,p_accessid,p_dml))
    THEN
      INSERT INTO asg_system_dirty_queue (
        qid, creation_date, created_by, last_update_date, last_updated_by,
        pub_item, access_id, client_id, transaction_id
        , dml_type, download_flag)
      VALUES (
        asg_system_dirty_queue_s.nextval, SYSDATE, 1, SYSDATE, 1,
        p_pub_item, p_accessid, p_username, NULL ,
        DECODE(p_dml,'D',0,'I',1,'U',2), NULL)
      RETURNING qid INTO l_qid;
Line: 625

        l_rc := storeDeletedPK(p_pub_item, l_qid, p_pkvalues);
Line: 695

      IF (insert_sdq(p_pub_item,p_username_list(i))
          AND is_exists(p_username_list(i),p_pub_item,
	                p_accessList(i),p_dmlList(i)))
      THEN
        l_tmp_access_list(l_ctr) := p_accessList(i);
Line: 711

        INSERT INTO asg_system_dirty_queue (
         qid, creation_date, created_by, last_update_date, last_updated_by,
         pub_item, access_id, client_id, transaction_id
         , dml_type, download_flag)
        VALUES (
         asg_system_dirty_queue_s.nextval, SYSDATE, 1, SYSDATE, 1,
         p_pub_item, l_tmp_access_list(i), l_tmp_username_list(i),
         NULL , DECODE(l_tmp_dml_list(i),'D',0,'I',1,'U',2), NULL)
        RETURNING qid BULK COLLECT INTO l_qid_comp_list;
Line: 732

      l_rc := storeDeletedPK(p_pub_item, l_accesslist, l_qid_pruned_list);
Line: 831

      IF ( insert_sdq(p_pub_item,p_username_list(i)) AND
           is_exists(p_username_list(i),p_pub_item,p_accessList(i),p_dml_type))
      THEN
        l_tmp_access_list(l_ctr) := p_accessList(i);
Line: 844

        INSERT INTO asg_system_dirty_queue (
         qid, creation_date, created_by, last_update_date, last_updated_by,
         pub_item, access_id, client_id, transaction_id
         , dml_type, download_flag)
        VALUES (
         asg_system_dirty_queue_s.nextval, SYSDATE, 1, SYSDATE, 1,
         p_pub_item, l_tmp_access_list(i), l_tmp_username_list(i),
         NULL , DECODE(p_dml_type,'D',0,'I',1,'U',2), NULL)
        RETURNING qid BULK COLLECT INTO l_qid_list;
Line: 854

        l_rc := storeDeletedPK(p_pub_item, l_tmp_access_list, l_qid_list);
Line: 957

	  IF( insert_sdq(p_pub_item,l_mobile_user) AND
	      is_exists(l_mobile_user,p_pub_item,p_accessList(k),p_dml_type))
	  THEN
	    l_tmp_access_list(l_ctr) := p_accessList(k);
Line: 970

          INSERT INTO asg_system_dirty_queue (
            qid, creation_date, created_by, last_update_date, last_updated_by,
            pub_item, access_id, client_id, transaction_id
            , dml_type, download_flag)
          VALUES (
            asg_system_dirty_queue_s.nextval, SYSDATE, 1, SYSDATE, 1,
            p_pub_item, l_tmp_access_list(j), l_mobile_user, NULL ,
            DECODE(p_dml_type,'D',0,'I',1,'U',2), NULL)
          RETURNING qid BULK COLLECT INTO l_qid_list;
Line: 980

          l_rc := storeDeletedPK(p_pub_item, l_tmp_access_list, l_qid_list);
Line: 1077

    EXECUTE IMMEDIATE 'SELECT primary_key_column, base_owner, base_object_name '
                      || ' FROM ASG_PUB_ITEM WHERE name = :pi '
                      INTO l_pk_list, l_base_owner, l_base_object_name
                      USING upper(p_pub_item);
Line: 1086

    l_dml := 'SELECT column_name, data_type FROM all_tab_columns '
             || ' WHERE owner = :1 AND table_name = :2  '
             || ' AND COLUMN_NAME = :3';
Line: 1144

    l_dml := 'SELECT a.name, a.comp_ref, b.online_query ' ||
             'FROM ' || CONS_SCHEMA || '.c$pub_list_q a, asg_pub_item b ' ||
             'WHERE a.name = b.name ' ||
             'ORDER by online_query desc, comp_ref desc';
Line: 1289

      l_tmpqry := 'select qid from asg_system_dirty_queue where client_id='''||
                   p_clientid|| ''' and  dml_type=0 and ' ||
                 ' pub_item in ('||l_complete_ref_pub_items||')';
Line: 1293

      l_tmpqry := 'select qid from asg_system_dirty_queue where '||
                  'client_id = :1 and  dml_type=0 and ' ||
                 ' pub_item in ('||l_complete_ref_pub_items||')';
Line: 1308

      l_tmpqry := 'delete from asg_system_dirty_queue where client_id= :1 ' ||
                  ' and pub_item in ('||l_complete_ref_pub_items||')';
Line: 1316

        delete from asg_system_dirty_queue
	where client_id = p_clientid
	and pub_item = l_complete_ref_pub_items_lst(i);
Line: 1322

      log(' After Delete SDQ : '||to_char(sysdate,'dd-mon-yyyy hh24:mi:ss'));
Line: 1325

        DBMS_SQL.PARSE (l_cur, 'DELETE FROM asg_delete_queue '
                             || ' WHERE qid in (:2)', DBMS_SQL.v7);
Line: 1333

      log(' After Delete delQ : '||to_char(sysdate,'dd-mon-yyyy hh24:mi:ss'));
Line: 1345

      l_dml := 'SELECT DISTINCT pub_item FROM asg_system_dirty_queue '
               || ' WHERE client_id='''||p_clientid
               ||''' AND (transaction_id IS NULL '
               || ' OR transaction_id > '||p_last_tranid
               ||') AND pub_item IN ('||l_incr_ref_pub_items||')';
Line: 1351

      l_dml := 'SELECT DISTINCT pub_item FROM asg_system_dirty_queue '
               || ' WHERE client_id= :1 AND (transaction_id IS NULL '
               || ' OR transaction_id > :2 ) '
	       || ' AND pub_item IN ('||l_incr_ref_pub_items||')';
Line: 1393

	l_dml := 'UPDATE asg_system_dirty_queue SET '
                 || ' transaction_id = :1, download_flag=NULL, '
                 || ' last_update_date = sysdate '
                 || ' WHERE client_id = :2 AND ( transaction_id IS NULL '
                 || ' OR transaction_id > :3 ) AND '
                 || ' pub_item IN ( :4 )';
Line: 1405

	  update asg_system_dirty_queue
	  set transaction_id = p_curr_tranid,
	  download_flag = null,
	  last_update_date = sysdate
	  where client_id = p_clientid
	  and ( transaction_id is null or transaction_id > p_last_tranid )
	  and pub_item = l_changed_pub_items_lst(j);
Line: 1421

        UPDATE ASG_SYSTEM_DIRTY_QUEUE
        SET download_flag = 'Y'
        WHERE qid IN (select qid from ASG_SDQ_UPDATE_V );
Line: 1430

    /** Insert the complete refresh pubitems into the dirty queue */
    IF ( l_compref_list.COUNT > 0 ) THEN
      log('    Before Complete Refresh Insert: '||
          to_char(sysdate,'dd-mon-yyyy hh24:mi:ss'));
Line: 1436

        SELECT base_owner, base_object_name,
               NVL(QUERY_ACCESS_TABLE, 'N'), ACCESS_TABLE_PREDICATE_LIST,
               access_owner, access_name
        INTO l_base_owner, l_base_object, l_query_access, l_predicate_list,
             l_access_owner, l_access_name
        FROM asg_pub_item WHERE name=l_compref_list(i);
Line: 1446

          l_dml := 'INSERT INTO asg_system_dirty_queue ( ' ||
                   'qid, creation_date, created_by, last_update_date,' ||
                   'last_updated_by, pub_item, access_id, client_id, ' ||
                   'transaction_id, dml_type, download_flag) '||
                   ' SELECT asg_system_dirty_queue_s.nextval, SYSDATE, 1, ' ||
                   ' SYSDATE, 1, :1, ' ||
                   ' uniqpiv.access_id, ' ||
                   ' :2, :3, ' ||
                   ' 1, ''Y'' FROM (SELECT DISTINCT ACCESS_ID FROM ' ||
                   l_base_owner ||'.' ||l_base_object ||
                   ' ) uniqpiv';
Line: 1460

          l_dml := 'INSERT INTO asg_system_dirty_queue ( ' ||
                   'qid, creation_date, created_by, last_update_date,' ||
                   'last_updated_by, pub_item, access_id, client_id, ' ||
                   'transaction_id, dml_type, download_flag) '||
                   ' SELECT asg_system_dirty_queue_s.nextval, SYSDATE, 1, ' ||
                   ' SYSDATE, 1, :1, ' ||
                   ' uniqacc.access_id, ' ||
                   ' :2, :3, ' ||
                   ' 1, ''Y'' FROM (SELECT DISTINCT ACCESS_ID FROM ' ||
                   l_access_owner || '.' || l_access_name;
Line: 1483

      log('    After Complete Refresh Insert: '||
          to_char(sysdate,'dd-mon-yyyy hh24:mi:ss'));
Line: 1487

    /** Delete pub items which are not in l_changed_pub_items
      * , l_complete_ref_pub_items AND l_online_item_list */
    IF ( l_webtogo_list IS NULL ) THEN

      l_dml := 'DELETE FROM '||CONS_SCHEMA||'.c$pub_list_q ' ||

               'WHERE name in (select name from asg_pub_item)';
Line: 1497

      l_dml := 'DELETE FROM '||CONS_SCHEMA||'.c$pub_list_q '

               || ' WHERE name NOT IN (' || l_webtogo_list || ') AND ' ||

               ' name in (select name from asg_pub_item)';
Line: 1530

      DELETE FROM asg_system_dirty_queue
      WHERE client_id = g_clientid AND
            transaction_id IS NOT NULL;
Line: 1534

      select nvl(fnd_profile.value_specific('ASG_ENABLE_DELIVERY_EVENTS'),'N')
      into l_prof_value from dual;
Line: 1551

      /* Clean the Delete Queue */
      DELETE FROM asg_delete_queue
      WHERE qid IN (SELECT qid
                    FROM asg_system_dirty_queue
                    WHERE client_id =  g_clientid AND
                    transaction_id <= g_last_tranid );
Line: 1558

      DELETE FROM asg_system_dirty_queue
      WHERE client_id = g_clientid  AND
            transaction_id <= g_last_tranid;
Line: 1578

     /* Clean the Delete Queue */
     log('PurgeSDQ for '||p_clientid);
Line: 1580

     DELETE FROM asg_delete_queue
     WHERE qid IN (SELECT qid
                   FROM asg_system_dirty_queue
                   WHERE client_id = p_clientid);
Line: 1586

     DELETE FROM asg_system_dirty_queue
     WHERE client_id = p_clientid;
Line: 1614

      SELECT  user_name
      FROM    asg_user
      WHERE   user_id = p_userid
      AND     ENABLED ='Y';
Line: 1810

	   SELECT nvl(value,'N') INTO g_purge_log_enabled
	   FROM asg_config WHERE name='ENABLE_PURGE_LOGGING';
Line: 1825

  takes a user name and deletes all duplicate records for that user
  from SDQ and DQ
  */
  PROCEDURE delete_duplicate_records(l_user_name varchar2)
  is
  l_dml		VARCHAR2(1000);
Line: 1835

    l_dml := 'Delete /*+ INDEX(asg_delete_queue ASG_DELETE_QUEUE_U1) */ from '||
             ' asg_delete_queue where qid in '||
             ' ( Select qid from  '||
	     '   ( select qid, pub_item, access_id, dml_type, '||
	     '     count(*) over (partition by pub_item, access_id, dml_type)'||
	     '     as total_rows, '||
	     '     min(qid) over (partition by pub_item, access_id, dml_type)'||
	     '     as min_qid '||
	     '     from asg_system_dirty_queue  where client_id = :1  AND '||
	     '     TRANSACTION_ID IS NULL and download_flag is null '||
	     '   ) '||
	     ' where qid <> min_qid and total_rows >1 )';
Line: 1849

   /* log_concprogram('Removed '||l_count||' duplicate rows from Delete queue '||
                    ' for user : '||l_user_name,
		    'asg_download',
		    FND_LOG.LEVEL_STATEMENT);*/
Line: 1854

    l_dml := 'Delete /*+ INDEX(asg_system_dirty_queue ASG_SYSTEM_DIRTY_QUEUE_U1) */ from asg_system_dirty_queue where qid in '||
             ' ( Select qid from  '||
	     '   ( select qid, pub_item, access_id, dml_type, '||
	     '     count(*) over (partition by pub_item, access_id, dml_type)'||
	     '     as total_rows, '||
	     '     min(qid) over (partition by pub_item, access_id, dml_type)'||
	     '     as min_qid '||
	     '     from asg_system_dirty_queue  where client_id = :1  AND '||
	     '     TRANSACTION_ID IS NULL and download_flag is null '||
	     '   ) '||
	     ' where qid <> min_qid and total_rows >1 )';
Line: 1879

  END delete_duplicate_records;
Line: 1882

  takes a user name and inserts records for each publication subscribed
  by the user into asg_purge_sdq
  */
  PROCEDURE set_user_first_synch(l_user_name varchar2)
  is
  PRAGMA autonomous_transaction;
Line: 1893

    INSERT INTO asg_purge_sdq(user_name,pub_name,creation_date,created_by,
    last_update_date,last_updated_by )
    ( SELECT user_name,pub_name ,sysdate,1,sysdate,1
      FROM asg_user_pub_resps
      WHERE user_name = l_user_name
      AND pub_name IN
      (select name  from asg_pub  where nvl(custom,'N') =  'N' )
     );
Line: 1915

  takes a user name and inserts records for each publication subscribed
  by the user into asg_purge_sdq
  */
  PROCEDURE set_user_first_synch_pub(l_user_name varchar2,l_pub_name varchar2)
  is
  PRAGMA autonomous_transaction;
Line: 1926

    SELECT COUNT(*) INTO l_count
    FROM asg_purge_sdq
    WHERE user_name = l_user_name
    AND   pub_name  = l_pub_name;
Line: 1932

      INSERT INTO asg_purge_sdq(user_name,pub_name,creation_date,created_by,
      last_update_date,last_updated_by)
      VALUES (l_user_name,l_pub_name,sysdate,1,sysdate,1);
Line: 1953

  PROCEDURE delete_Sdq( P_status OUT NOCOPY VARCHAR2,
			P_message OUT NOCOPY VARCHAR2)
  IS

    l_user_id		NUMBER;
Line: 1967

       SELECT user_name,pub_name
       FROM asg_user_pub_resps
       WHERE trunc( sysdate - NVL(synch_date,to_date('1', 'J')) )
       > l_dormancy_period
       AND pub_name IN ( SELECT NAME FROM asg_pub WHERE nvl(custom,'N') = 'N' )
       and user_name > l_last_processed
       and user_name <=l_last_user
       ORDER BY user_name;
Line: 1980

       SELECT value FROM asg_config
       WHERE name='ASG_SDQ_PURGE_LAST_USER';
Line: 1985

       SELECT value FROM asg_config
       WHERE NAME='ASG_SDQ_PURGE_LAST_DUPDEL';
Line: 1990

       SELECT user_name FROM
       (
        SELECT user_name FROM asg_user
        WHERE user_name > l_last_processed
	and user_name not in
	( select distinct user_name
	  from asg_purge_sdq where TRANSACTION_ID IS  NULL )
	ORDER BY user_name
        ) WHERE ROWNUM <= l_max_num;
Line: 2003

      SELECT user_name FROM (
      SELECT ROWNUM pos,user_name FROM
      (
        SELECT DISTINCT user_name
	FROM asg_user_pub_resps
	WHERE  user_name > l_last_processed
	AND TRUNC( SYSDATE - NVL(synch_date,TO_DATE('1', 'J')) )
	> l_dormancy_period
	ORDER BY user_name
      )
      ) WHERE pos = l_num_users;
Line: 2018

    SELECT COUNT(*) FROM (
      SELECT ROWNUM pos,user_name FROM
      (
        SELECT DISTINCT user_name
	FROM asg_user_pub_resps
	WHERE  user_name > l_last_processed
	AND TRUNC( SYSDATE - NVL(synch_date,TO_DATE('1', 'J')) )
	> l_dormancy_period
	ORDER BY user_name
      ) );
Line: 2055

    delete from asg_conf_info
    where (sysdate-creation_date) >l_purge_conf_interval;
Line: 2114

   SELECT SYSDATE INTO l_date FROM dual;
Line: 2115

   log_concprogram('Starting to delete duplicate records : '||
                   to_char(l_date,'dd-mon-yyyy hh24:mi:ss'),
		   'asg_download',FND_LOG.LEVEL_STATEMENT);
Line: 2123

      SELECT SYSDATE INTO l_date FROM dual;
Line: 2127

      delete_duplicate_records(l_user_name);
Line: 2131

   UPDATE asg_config SET value=nvl(l_last_user,value)
   WHERE NAME='ASG_SDQ_PURGE_LAST_DUPDEL';
Line: 2135

   SELECT SYSDATE INTO l_date FROM dual;
Line: 2206

        DELETE /*+ INDEX(asg_delete_queue ASG_DELETE_QUEUE_U1) */ FROM
	asg_delete_queue
	WHERE qid IN
	( SELECT qid
	  FROM asg_system_dirty_queue
	  WHERE client_id = l_dormant_rec.user_name
	  AND pub_item in
	  (SELECT item_id FROM asg_pub_item
	   WHERE pub_name=l_dormant_rec.pub_name));
Line: 2221

	DELETE FROM asg_system_dirty_queue
	WHERE client_id = l_dormant_rec.user_name
	AND pub_item in
	(SELECT item_id FROM asg_pub_item
	 WHERE pub_name=l_dormant_rec.pub_name);
Line: 2230

	DELETE FROM asg_complete_refresh
	WHERE user_name = l_dormant_rec.user_name
	AND publication_item IN
	(SELECT item_id FROM asg_pub_item
	 WHERE pub_name = l_dormant_rec.pub_name);
Line: 2236

	DELETE FROM asg_purge_sdq
	WHERE user_name = l_dormant_rec.user_name
	AND pub_name = l_dormant_rec.pub_name;
Line: 2240

	/* change this .. has to insert for current publicatino..*/
	set_user_first_synch_pub(l_dormant_rec.user_name,
	                         l_dormant_rec.pub_name);
Line: 2252

    UPDATE asg_config
    SET value = nvl(l_last_user,value)
    WHERE NAME ='ASG_SDQ_PURGE_LAST_USER';
Line: 2257

    UPDATE jtm_con_request_data
    SET last_run_date = SYSDATE
    WHERE package_name = 'ASG_DOWNLOAD'
    AND procedure_name = 'DELETE_SDQ';
Line: 2266

     p_message := 'Purging asg_system_dirty_queue and asg_delete_queue completed successfully.';
Line: 2274

  END delete_Sdq;
Line: 2277

  function to verify whether record shd be inserted into SDQ or not
  return values :
  If it returns "false" then the record need not be inserted into SDQ ..
  it may be that:
	1. records for the pub item or the corresponding publication
	   exists in asg_complete_refresh or asg_purge_sdq
  If the return value is "true" then record is inserted.
  --
  */

  FUNCTION insert_sdq(p_pub_item varchar2,p_user_name varchar2) RETURN boolean
  IS
    CURSOR c_pub_name(l_pub_item varchar2)
    IS
      SELECT pub_name FROM asg_pub_item WHERE item_id = p_pub_item;
Line: 2294

      SELECT user_name FROM asg_complete_refresh
      WHERE user_name = l_un AND publication_item = l_pi
      AND synch_completed = 'N';
Line: 2299

      SELECT user_name FROM asg_purge_Sdq
      WHERE user_name = l_un
      AND pub_name = l_pub
      AND transaction_id IS null;
Line: 2330

  END insert_sdq;
Line: 2336

  if record exists then "false" - so need not be inserted again
  if record doesn't exist then "true" - insert into SDQ
  */
  FUNCTION is_exists(p_clientid varchar2, p_pub_item varchar2,
		     p_access_id number,p_dml_type char)
		     RETURN boolean
  IS
   CURSOR c_is_exists_in_sdq(p_clientid varchar2, p_pub_item varchar2,
			     p_access_id number,p_dml_type varchar2)
   IS
     SELECT client_id FROM asg_system_dirty_queue
     WHERE client_id = p_clientid AND pub_item = p_pub_item
     AND access_id = p_access_id
     AND dml_type = DECODE(p_dml_type,'D',0,'I',1,'U',2)
     AND transaction_id IS NULL AND download_flag IS null;
Line: 2365

  PROCEDURE delete_synch_history( P_status OUT NOCOPY VARCHAR2,
				  P_message OUT NOCOPY VARCHAR2)
  IS
    l_purge_interval NUMBER ;
Line: 2395

      /*l_qry := 'delete from '||CONS_SCHEMA||'.'||'c$sync_history where '
	       ||' (sysdate-start_time) > '||l_purge_interval||' ';
Line: 2402

      log_concprogram('Deleted '||l_row_count||' row(s)',
		      'asg_download',
		      FND_LOG.LEVEL_STATEMENT);
Line: 2409

      l_qry := 'SELECT session_id ' ||
             'FROM ' || CONS_SCHEMA || '.' || 'c$sync_history ' ||
             'WHERE start_time < (trunc(sysdate) - ' || l_purge_interval || ')';
Line: 2416

            l_purge_session_data.delete;
Line: 2425

             l_qry := 'delete from '||CONS_SCHEMA||'.'||'c$sync_history where ' || ' session_id = :1 ';
Line: 2440

      log_concprogram('Deleted '||l_row_count||' row(s)',
		           'asg_download',
                   FND_LOG.LEVEL_STATEMENT);
Line: 2447

      UPDATE jtm_con_request_data
      SET last_run_date = SYSDATE
      WHERE package_name = 'ASG_DOWNLOAD'
      AND procedure_name = 'DELETE_SYNCH_HISTORY';
Line: 2463

  END delete_synch_history;
Line: 2471

      select user_name,user_id,resource_id from asg_user where
      enabled='Y' and nvl(DISABLE_USER_SYNCH,'N') = 'N';
Line: 2476

      select user_name from fnd_user where user_id = p_user_id;
Line: 2482

      select user_id from fnd_user where user_name = p_user_name;
Line: 2485

      select user_name from jtf_rs_resource_extns
      where resource_id = p_res_id
      and  ( trunc(END_DATE_ACTIVE) is null
      or trunc(END_DATE_ACTIVE) > trunc(sysdate) );
Line: 2503

        update asg_user
        set DISABLE_USER_SYNCH='Y',DISABLE_SYNCH_ERROR = l_err_msg
        where user_name = l_asg_user_rec.user_name;
Line: 2513

        update asg_user
        set DISABLE_USER_SYNCH='Y',DISABLE_SYNCH_ERROR = l_err_msg
        where user_name = l_asg_user_rec.user_name;
Line: 2526

          update asg_user set DISABLE_USER_SYNCH='Y',DISABLE_SYNCH_ERROR = l_err_msg
          where user_name = l_asg_user_rec.user_name;
Line: 2541

        update asg_user
        set DISABLE_USER_SYNCH='Y',DISABLE_SYNCH_ERROR = l_err_msg
        where user_name = l_asg_user_rec.user_name;
Line: 2549

        update asg_user
        set DISABLE_USER_SYNCH='Y',DISABLE_SYNCH_ERROR = l_err_msg
        where user_name = l_asg_user_rec.user_name;