DBA Data[Home] [Help]

APPS.EDW_VBH_SETUP SQL Statements

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

Line: 9

    select warehouse_to_instance_link
    into p_db_link
    from edw_source_instances
    where instance_code=p_instance
    and warehouse_to_instance_link is not null
    and enabled_flag='Y';
Line: 23

PROCEDURE INSERT_INTO_EDW_SET_OF_BOOKS(
    p_status out nocopy boolean,
    p_errMsg out nocopy varchar2) AS
    l_instance_code edw_source_instances.instance_code%TYPE;
Line: 28

    l_insert_stmt     varchar2(20000);
Line: 30

    l_rows_inserted   integer:=0;
Line: 33

    select INSTANCE_CODE,WAREHOUSE_TO_INSTANCE_LINK
    from edw_source_instances
    where WAREHOUSE_TO_INSTANCE_LINK is not null
    and enabled_flag ='Y'
    order by instance_code;
Line: 41

    delete from edw_set_of_books;
Line: 42

    delete from edw_cons_set_of_books;
Line: 43

    delete from edw_equi_set_of_books;
Line: 44

    delete from edw_vbh_roots;
Line: 45

    delete from edw_segment_classes;
Line: 52

     l_insert_stmt:= 'insert into edw_set_of_books(EDW_SET_OF_BOOKS_ID,
        instance,
        SET_OF_BOOKS_ID,
        SET_OF_BOOKS_NAME ,
        CHART_OF_ACCOUNTS_ID,
        description,
        CREATION_DATE,
        CREATED_BY,
        LAST_UPDATE_DATE,
        LAST_UPDATED_BY ,
        LAST_UPDATE_LOGIN
     )
      select EDW_SET_OF_BOOKS_S.nextval,'''||l_instance_code||''',set_of_books_id,
      name,CHART_OF_ACCOUNTS_ID,description,
      sysdate,
      fnd_global.user_id,
      sysdate,
      fnd_global.user_id,
      fnd_global.login_id
      from gl_sets_of_books@'||l_instance_link
     ||' where CHART_OF_ACCOUNTS_ID in (select distinct STRUCTURE_NUM  from edw_flex_seg_mappings_v where instance_code=:b_instance_code)';
Line: 73

      DBMS_SQL.parse(l_cursor_id,l_insert_stmt,DBMS_SQL.V7);
Line: 75

      l_rows_inserted:=DBMS_SQL.execute(l_cursor_id);
Line: 85

end insert_into_edw_set_of_books;
Line: 87

procedure insert_source(p_status out nocopy boolean,p_errMsg out nocopy varchar2) is
  l_instance_link edw_source_instances.WAREHOUSE_TO_INSTANCE_LINK%TYPE;
Line: 90

  l_insert_stmt     varchar2(20000);
Line: 91

  l_delete_stmt     varchar2(200);
Line: 95

  select warehouse_to_instance_link, INSTANCE_CODE
  from   edw_source_instances
  where  WAREHOUSE_TO_INSTANCE_LINK is not null
  and enabled_flag='Y';
Line: 109

      l_delete_stmt:='delete from EDW_LOCAL_SET_OF_BOOKS@'||l_instance_link;
Line: 110

      execute immediate l_delete_stmt;
Line: 112

     l_insert_stmt:= 'insert into EDW_LOCAL_SET_OF_BOOKS@'||l_instance_link||'
       (EDW_SET_OF_BOOKS_ID,
        instance,
        SET_OF_BOOKS_ID,
        SET_OF_BOOKS_NAME ,
        CHART_OF_ACCOUNTS_ID,
        description,
        CREATION_DATE,
        CREATED_BY,
        LAST_UPDATE_DATE,
        LAST_UPDATED_BY ,
        LAST_UPDATE_LOGIN
        )
    select EDW_SET_OF_BOOKS_ID,
           instance,
           SET_OF_BOOKS_ID,
           SET_OF_BOOKS_NAME ,
           CHART_OF_ACCOUNTS_ID,
           description,
           CREATION_DATE,
           CREATED_BY,
           LAST_UPDATE_DATE,
           LAST_UPDATED_BY ,
           LAST_UPDATE_LOGIN
       from edw_set_of_books
       WHERE instance = ''' || l_instance_code || '''';
Line: 139

     execute immediate l_insert_stmt;
Line: 147

end insert_source;
Line: 150

procedure insert_cons_to_source(p_status out nocopy boolean,p_errMsg out nocopy varchar2) is
  l_instance_link edw_source_instances.WAREHOUSE_TO_INSTANCE_LINK%TYPE;
Line: 152

  l_insert_stmt     varchar2(20000);
Line: 153

  l_delete_stmt     varchar2(200);
Line: 154

  l_delete_cursor_id       integer;
Line: 155

  l_insert_cursor_id       integer;
Line: 156

  l_rows_deleted    integer:=0;
Line: 157

  l_rows_inserted   integer:=0;
Line: 161

  select WAREHOUSE_TO_INSTANCE_LINK
  from   edw_source_instances
  where  WAREHOUSE_TO_INSTANCE_LINK is not null
  and    enabled_flag ='Y';
Line: 175

      l_delete_cursor_id:=DBMS_SQL.OPEN_CURSOR;
Line: 176

      l_delete_stmt:='delete from EDW_LOCAL_CONS_SET_OF_BOOKS@'||l_instance_link;
Line: 177

      DBMS_SQL.parse(l_delete_cursor_id,l_delete_stmt,DBMS_SQL.V7);
Line: 178

      l_rows_deleted:=DBMS_SQL.execute(l_delete_cursor_id);
Line: 180

      DBMS_SQL.close_cursor(l_delete_cursor_id);
Line: 182

     l_insert_cursor_id:=DBMS_SQL.OPEN_CURSOR;
Line: 183

     l_insert_stmt:= 'insert into EDW_LOCAL_CONS_SET_OF_BOOKS@'||l_instance_link||'
       (child_EDW_SET_OF_BOOKS_ID,
        parent_edw_SET_OF_BOOKS_ID,
        consolidation_id,
        consolidation_NAME,
        CREATION_DATE,
        CREATED_BY,
        LAST_UPDATE_DATE,
        LAST_UPDATED_BY ,
        LAST_UPDATE_LOGIN
        )
    select child_EDW_SET_OF_BOOKS_ID,
           parent_edw_SET_OF_BOOKS_ID,
           consolidation_id,
           consolidation_NAME,
           CREATION_DATE,
           CREATED_BY,
           LAST_UPDATE_DATE,
           LAST_UPDATED_BY ,
           LAST_UPDATE_LOGIN
    from edw_cons_set_of_books';
Line: 204

   DBMS_SQL.parse(l_insert_cursor_id,l_insert_stmt,DBMS_SQL.V7);
Line: 205

   l_rows_inserted:=DBMS_SQL.execute(l_insert_cursor_id);
Line: 207

   DBMS_SQL.close_cursor(l_insert_cursor_id);
Line: 215

   end insert_cons_to_source;
Line: 218

procedure insert_equi_to_source(p_status out nocopy boolean, p_errMsg out nocopy varchar2) is
  l_instance_link edw_source_instances.WAREHOUSE_TO_INSTANCE_LINK%TYPE;
Line: 220

  l_insert_stmt     varchar2(20000);
Line: 221

  l_delete_stmt     varchar2(200);
Line: 222

  l_delete_cursor_id       integer;
Line: 223

  l_insert_cursor_id       integer;
Line: 224

  l_rows_deleted    integer:=0;
Line: 225

  l_rows_inserted   integer:=0;
Line: 229

  select WAREHOUSE_TO_INSTANCE_LINK
  from   edw_source_instances
  where  WAREHOUSE_TO_INSTANCE_LINK is not null
  and    enabled_flag='Y';
Line: 243

      l_delete_cursor_id:=DBMS_SQL.OPEN_CURSOR;
Line: 244

      l_delete_stmt:='delete from EDW_LOCAL_EQUI_SET_OF_BOOKS@'||l_instance_link;
Line: 245

      DBMS_SQL.parse(l_delete_cursor_id,l_delete_stmt,DBMS_SQL.V7);
Line: 246

      l_rows_deleted:=DBMS_SQL.execute(l_delete_cursor_id);
Line: 248

      DBMS_SQL.close_cursor(l_delete_cursor_id);
Line: 250

     l_insert_cursor_id:=DBMS_SQL.OPEN_CURSOR;
Line: 251

     l_insert_stmt:= 'insert into EDW_LOCAL_EQUI_SET_OF_BOOKS@'||l_instance_link||'
       (EDW_SET_OF_BOOKS_ID,
        equi_SET_OF_BOOKS_ID,
        CREATION_DATE,
        CREATED_BY,
        LAST_UPDATE_DATE,
        LAST_UPDATED_BY ,
        LAST_UPDATE_LOGIN
        )
    select EDW_SET_OF_BOOKS_ID,
           equi_SET_OF_BOOKS_ID,
           CREATION_DATE,
           CREATED_BY,
           LAST_UPDATE_DATE,
           LAST_UPDATED_BY ,
           LAST_UPDATE_LOGIN
    from edw_equi_set_of_books';
Line: 268

   DBMS_SQL.parse(l_insert_cursor_id,l_insert_stmt,DBMS_SQL.V7);
Line: 269

   l_rows_inserted:=DBMS_SQL.execute(l_insert_cursor_id);
Line: 271

   DBMS_SQL.close_cursor(l_insert_cursor_id);
Line: 279

 end insert_equi_to_source;
Line: 289

    l_select_stmt varchar2(2000);
Line: 290

    l_rows_selected number;
Line: 303

    l_select_stmt :=
      'select set_of_books_id, chart_of_accounts_id, description
       from gl_sets_of_books@'||p_db_link||'
       where name = :b_sob_name';
Line: 307

    dbms_sql.parse(l_cursor_id,l_select_stmt,dbms_sql.v7);
Line: 312

    l_rows_selected:= dbms_sql.execute(l_cursor_id);
Line: 347

       select dim_long_name
       into  p_wh_dimension_name
       from edw_dimensions_md_v
       where dim_name =(
         select DIMENSION_SHORT_NAME
         from edw_flex_seg_mappings_v
         where lower(instance_code)=lower(p_instance)
         and segment_name =p_segment_name
         and structure_num=p_coa_id);
Line: 379

    SELECT instance_code, warehouse_to_instance_link
    FROM   edw_source_instances
    WHERE  enabled_flag = 'Y';
Line: 402

	    DBMS_SQL.PARSE(cid, 'SELECT 1 FROM sys.dual@'||l_db_link, dbms_sql.native);
Line: 430

l_select_stmt     varchar2(20000);
Line: 432

l_rows_selected   integer:=0;
Line: 447

     l_select_stmt:=
     'select count(*)
      into :b_count
      from gl_consolidation@'||l_instance_link||'
      where from_ledger_id =:b_from_ledger_id
      and   to_ledger_id=:b_to_ledger_id';
Line: 453

     DBMS_SQL.parse(l_cursor_id,l_select_stmt,DBMS_SQL.V7);
Line: 459

     l_rows_selected:=DBMS_SQL.execute(l_cursor_id);
Line: 499

l_select_stmt     varchar2(20000);
Line: 501

l_rows_selected   integer:=0;
Line: 513

       l_select_stmt:=
             'select consolidation_id
              into :b_consolidation_id
              from gl_consolidation@'||l_instance_link||'
              where from_ledger_id =:b_from_ledger_id
              and   to_ledger_id=:b_to_ledger_id
              and name =:b_consolidation_name';
Line: 520

       DBMS_SQL.parse(l_cursor_id,l_select_stmt,DBMS_SQL.V7);
Line: 528

       l_rows_selected:=DBMS_SQL.execute(l_cursor_id);
Line: 559

     select edw_set_of_books_id,segment_name,
            root_value1,root_value2,root_value3,root_value4
     from edw_vbh_roots;
Line: 568

        select instance into l_instance
        from edw_set_of_books
        where edw_set_of_books_id= l_edw_sob_id;
Line: 641

  l_select_stmt varchar2(200);
Line: 648

    select parent_edw_set_of_books_id, child_edw_set_of_books_id,
           consolidation_id
    from edw_cons_set_of_books
    where child_edw_set_of_books_id
          in (select edw_set_of_books_id from edw_vbh_roots where segment_name=p_segment_name)
    and parent_edw_set_of_books_id=p_edw_sob_id;
Line: 659

    select from_f.value_set_id
    into l_from_value_set_id
    from edw_flex_seg_mappings_v from_f,edw_set_of_books from_b
    where from_b.edw_set_of_books_id=l_child_edw_sob_id
      and from_b.chart_of_accounts_id=from_f.structure_num
      and from_f.instance_code=p_instance
      and from_f.segment_name=p_segment_name;
Line: 667

    select to_f.value_set_id
    into l_to_value_set_id
    from edw_flex_seg_mappings_v to_f,edw_set_of_books to_b
    where to_b.edw_set_of_books_id=l_parent_edw_sob_id
      and to_b.chart_of_accounts_id=to_f.structure_num
      and to_f.instance_code=p_instance
      and to_f.segment_name=p_segment_name;
Line: 676

    l_select_stmt:='select count(*) from edw_cons_mapping_v@'||l_db_link||
                   ' where FROM_VALUE_SET_ID=:b_from_value_set_id and to_value_set_id=:b_to_value_set_id and consolidation_id=:b_consolidation_id';
Line: 678

      dbms_sql.parse(l_cursor_id, l_select_stmt,dbms_sql.v7);
Line: 692

        l_select_stmt:='select count(*) from edw_vbh_roots where edw_set_of_books_id=:b_problem_sob_id and root_value'||p_hierarchy_no||' is not null and segment_name =:b_segment_name';
Line: 694

      dbms_sql.parse(l_cursor_id, l_select_stmt,dbms_sql.v7);
Line: 714

    select parent_edw_set_of_books_id,child_edw_set_of_books_id,consolidation_id
    from edw_cons_set_of_books
    where parent_edw_set_of_books_id in (select edw_set_of_books_id from edw_vbh_roots where segment_name=p_segment_name)
    and child_edw_set_of_books_id =p_edw_sob_id;
Line: 721

    select from_f.value_set_id
    into l_from_value_set_id
    from edw_flex_seg_mappings_v from_f,edw_set_of_books from_b
    where from_b.edw_set_of_books_id=l_child_edw_sob_id
      and from_b.chart_of_accounts_id=from_f.structure_num
      and from_f.instance_code=p_instance
      and from_f.segment_name=p_segment_name;
Line: 729

    select to_f.value_set_id
    into l_to_value_set_id
    from edw_flex_seg_mappings_v to_f,edw_set_of_books to_b
    where to_b.edw_set_of_books_id=l_parent_edw_sob_id
      and to_b.chart_of_accounts_id=to_f.structure_num
      and to_f.instance_code=p_instance
      and to_f.segment_name=p_segment_name;
Line: 738

    l_select_stmt:='select count(*) from edw_cons_mapping_v@'||l_db_link||
                   ' where FROM_VALUE_SET_ID=:b_from_value_set_id and to_value_set_id=:b_to_value_set_id and consolidation_id=:b_consolidation_id';
Line: 741

      dbms_sql.parse(l_cursor_id, l_select_stmt,dbms_sql.v7);
Line: 754

        l_select_stmt:='select count(*) from edw_vbh_roots where edw_set_of_books_id=:b_problem_sob_id and root_value'||p_hierarchy_no||' is not null and segment_name=:b_segment_name';
Line: 756

      dbms_sql.parse(l_cursor_id, l_select_stmt,dbms_sql.v7);
Line: 793

	l_stmt := 'select SET_OF_BOOKS_ID from edw_set_of_books where SET_OF_BOOKS_ID = '|| p_set_of_books_id;
Line: 813

 procedure insert_set_of_books(
			p_status out nocopy	 BOOLEAN,
			p_errMsg out nocopy	 VARCHAR2,
			p_edw_set_of_books_id	 NUMBER,
			p_instance		 VARCHAR2,
		        p_set_of_books_id	 NUMBER,
			p_set_of_books_name	 VARCHAR2,
			p_chart_of_accounts_id	 NUMBER,
			p_description		 VARCHAR2,
			p_creation_date		 DATE,
			p_created_by		 NUMBER,
			p_last_update_date	 DATE,
			p_last_updated_by	 NUMBER ,
			p_last_update_login	 NUMBER) as

    l_insert_stmt     varchar2(20000);
Line: 832

	l_insert_stmt:= 'insert into edw_set_of_books(EDW_SET_OF_BOOKS_ID,instance,
        SET_OF_BOOKS_ID,
        SET_OF_BOOKS_NAME ,
        CHART_OF_ACCOUNTS_ID,
        description,
        CREATION_DATE,
        CREATED_BY,
        LAST_UPDATE_DATE,
        LAST_UPDATED_BY ,
        LAST_UPDATE_LOGIN
        )values('||p_edw_set_of_books_id ||','''|| p_instance||''','
		 ||p_set_of_books_id||','''||p_set_of_books_name||''','
		||p_chart_of_accounts_id||','''
		||p_description||''' ,'''
		||p_creation_date||''','
		||p_created_by||','''
		||p_last_update_date||''','
		||p_last_updated_by||','
		||p_last_update_login||')';
Line: 852

      execute immediate l_insert_stmt;
Line: 860

end insert_set_of_books;