DBA Data[Home] [Help]

APPS.AMS_LIST_RUNNING_TOTAL_PVT SQL Statements

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

Line: 37

   SELECT to_number(SUBSTR(version_text, 1, instr(version_text, '|') -1) ),
    to_number( SUBSTR(version_text, instr(version_text, '|')         + 1) )
     INTO db_version_major,
      db_version_minor
     FROM
    (SELECT SUBSTR(REPLACE(REPLACE(version, '.', '|'), ',', '|'), 1, instr(REPLACE(REPLACE(version, '.', '|'), ',', '|'), '|', 1, 2) -1) version_text
       FROM v$instance
    );
Line: 67

  select owner from sys.all_tables
  where table_name = c_view_name;
Line: 82

            UPDATE ams_query_template_all
            SET recalc_table_status    = 'IN_PROGRESS',
                mv_available_flag      = 'N',
                request_id             = l_request_id,
                LAST_UPDATE_DATE       = SYSDATE,
                LAST_UPDATED_BY        = FND_GLOBAL.USER_ID,
                LAST_UPDATE_LOGIN      = FND_GLOBAL.CONC_LOGIN_ID,
                PROGRAM_APPLICATION_ID = FND_GLOBAL.PROG_APPL_ID,
                PROGRAM_UPDATE_DATE    = SYSDATE
            WHERE template_id = p_template_id;
Line: 93

            UPDATE ams_query_template_all
            SET recalc_table_status    = 'DRAFT',
                mv_available_flag      = 'N',
                LAST_UPDATE_DATE       = SYSDATE,
                LAST_UPDATED_BY        = FND_GLOBAL.USER_ID
            WHERE template_id = p_template_id;
Line: 126

l_insert_string           VARCHAR2(32767);
Line: 127

l_select_string           VARCHAR2(32767);
Line: 172

SELECT  distinct non_variant_value, query_alias_id
  from AMS_QUERY_COND_DISP_STRUCT_vl
where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
  and query_alias_id is not null;
Line: 178

select count(*) from (SELECT  distinct non_variant_value, query_alias_id
  from AMS_QUERY_COND_DISP_STRUCT_vl
where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
  and query_alias_id is not null) total_records;
Line: 184

select distinct alias2.query_alias_id,alias2.source_object_name, alias2.master_source_type_flag,alias2.source_object_pk_field,
alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id;
Line: 201

select distinct alias2.query_alias_id,alias2.source_object_name, alias2.master_source_type_flag,alias2.source_object_pk_field,
alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id
 and alias2.source_object_name like 'HZ_%';
Line: 219

select count(*) from (
select distinct alias2.query_alias_id,alias2.source_object_name, alias2.master_source_type_flag,alias2.source_object_pk_field,
alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id ) alias_count;
Line: 237

select  types.master_source_type_flag,
decode(master_source_type_flag,'Y','A'||to_char(rownum)||'.'||source_object_pk_field||'  =  ',
'A'||to_char(rownum)||'.'||source_object_pk_field ||'(+)')
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id;
Line: 247

select count(*) from
 (
 select distinct alias2.query_alias_id,alias2.source_object_name, alias2.master_source_type_flag,alias2.source_object_pk_field,
alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id
) tab3
where master_source_type_flag = 'N';
Line: 268

select column_name from sys.all_tab_columns where table_name = l_view_name
and column_name not in (
select flds.source_column_name
from ams_list_src_fields flds ,AMS_QUERY_ALIAS alias,ams_list_src_types types,
     ams_query_template_all qtemp
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.LIST_SOURCE_TYPE_ID = flds.LIST_SOURCE_TYPE_ID
  and types.MASTER_SOURCE_TYPE_FLAG = 'Y'
  and qtemp.template_id = alias.template_id
  and qtemp.list_src_type = types.source_type_code);
Line: 281

select 'Y' from sys.all_tables where table_name = l_view_name;
Line: 285

select 'Y' from sys.all_objects
where object_name = l_view_name
and object_type = 'SYNONYM';
Line: 291

select types.source_object_name
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and types.master_source_type_flag = 'Y'
  and alias.object_name = types.source_type_code;
Line: 298

select tab1.query_alias_id,
decode(tab1.master_source_type_flag,'Y',
'( select * from ( select * from '|| tab1.source_object_name||
' order by dbms_random.value ) where rownum <=
(select (count(*) * '|| l_sample_pct ||'/100) from '|| tab1.source_object_name||')  )' ,tab1.source_object_name),
tab1.master_source_type_flag,tab1.source_object_pk_field,
tab1.line_num
from
(
select distinct alias2.query_alias_id,alias2.source_object_name, alias2.master_source_type_flag,alias2.source_object_pk_field,
alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
   and types.list_source_type = 'TARGET'
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id ) tab1;
Line: 325

select flds.source_column_name
from ams_list_src_fields flds ,AMS_QUERY_ALIAS alias,ams_list_src_types types,
     ams_query_template_all qtemp
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.LIST_SOURCE_TYPE_ID = flds.LIST_SOURCE_TYPE_ID
  and types.MASTER_SOURCE_TYPE_FLAG = 'Y'
  and qtemp.template_id = alias.template_id
  and qtemp.list_src_type = types.source_type_code;
Line: 351

select typ.SOURCE_OBJECT_PK_FIELD
from ams_query_template_all tmp,ams_list_src_types typ
where tmp.template_id = p_template_id
  and tmp.list_src_type = typ.SOURCE_TYPE_CODE;
Line: 359

select tab2.source_object_name,tab2.list_source_type_id,tab2.master_source_type_flag,tab2.line_num||'.'
from
(
select distinct alias2.query_alias_id,alias2.source_object_name, alias2.master_source_type_flag,alias2.source_object_pk_field,
alias2.line_num, alias2.list_source_type_id
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num,types.list_source_type_id
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id
) tab2;
Line: 386

select nvl(assoc.master_source_type_pk_column,types.SOURCE_OBJECT_PK_FIELD ),assoc.sub_source_type_pk_column from
ams_list_src_type_assocs assoc , ams_list_src_types types
where assoc.master_source_type_id = l_master_lstype_id
  and assoc.sub_source_type_id = l_child_lstype_id
  and assoc.master_source_type_id = types.list_source_type_id;
Line: 399

select source_object_pk_field from ams_list_src_types where list_source_type_id = p_template_id;
Line: 404

select 'Y' from sys.dba_policies where object_name like 'HZ%';
Line: 407

select 'Y' from sys.dba_policies where object_name = l_source_object_name;
Line: 412

select tablespace,INDEX_TABLESPACE from fnd_product_installations
where application_id = '530';
Line: 419

select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias, ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id;
Line: 427

select types.LIST_SOURCE_TYPE_ID, types.source_object_name, types.master_source_type_flag,'A'||to_char(rownum)||'.' line_num
from AMS_QUERY_ALIAS alias, ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
  and types.list_source_type = 'TARGET'
order by alias.query_alias_id;
Line: 446

select sys_context( 'userenv', 'current_schema' ) "apps_schema" from dual;
Line: 450

  select NVL(types.remote_flag, 'N'), database_link
  from AMS_QUERY_ALIAS alias, ams_list_src_types types
  where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code;
Line: 467

select application_short_name from fnd_application where application_id = 530;
Line: 501

   update ams_query_template_all
      set MV_AVAILABLE_FLAG = 'N'
    where TEMPLATE_ID = p_template_id;
Line: 575

	l_create_string := l_create_string || ' AS SELECT ';
Line: 576

        l_insert_string := ' INSERT INTO '||l_view_name||' SELECT ';
Line: 581

	l_create_string := l_create_string || ' COMPRESS AS SELECT ';
Line: 582

        l_insert_string := ' INSERT /*+ APPEND */ INTO  '||l_view_name||' SELECT ';
Line: 584

	 l_create_string := l_create_string || ' AS SELECT ';
Line: 585

         l_insert_string := ' INSERT INTO  '||l_view_name||' SELECT ';
Line: 590

	 l_create_string := l_create_string || ' COMPRESS AS SELECT ';
Line: 591

         l_insert_string := ' INSERT /*+ APPEND */ INTO  '||l_view_name||' SELECT ';
Line: 608

Ams_Utility_Pvt.Write_Conc_log('l_insert_string = '||l_insert_string);
Line: 629

   l_master_string := 'begin select count(*) into :l_master_total_records from '||l_master_view||' ;end;';
Line: 632

   l_master_string := 'begin select count(*) into :l_master_total_records from '||l_master_view||'@'||l_dblink||' ;end;';
Line: 689

		l_select_string := l_select_string||' '||l_column_alias||'.'||l_attribute_name||' '
                                   ||l_column_alias||'_'||l_attribute_name||' '||l_comma;
Line: 692

Ams_Utility_Pvt.Write_Conc_log('l_select_string = '||l_select_string );
Line: 732

      l_select_string := l_select_string||' '||l_master_columns_string;
Line: 733

Ams_Utility_Pvt.Write_Conc_log('l_select_string = '||l_select_string);
Line: 879

 l_no_of_chunks  := ceil(length(l_select_string)/2000 );
Line: 882

      Ams_Utility_Pvt.Write_Conc_log('l_select_string = '||substrb(l_select_string,(2000*i) - 1999,2000));
Line: 885

l_create1_string := l_create_string ||' '||l_select_string||' '||l_from_string||' '||l_where_string||' '||l_policy_where||' ';
Line: 906

      Ams_Utility_Pvt.Write_Conc_log('Maximum 100 LOV value selections are allowed. Please reselect the LOV values.');
Line: 924

      Ams_Utility_Pvt.Write_Conc_log('Maximum 100 LOV value selections are allowed. Please reselect the LOV values.');
Line: 950

 l_create_string := l_create_string ||' '||l_select_string||' '||l_from_string||' '||l_where_string||' '||l_policy_where||' ';
Line: 951

 l_insert_string := l_insert_string ||' '||l_select_string||' '||l_from_string||' '||l_where_string||' '||l_policy_where||' ';
Line: 959

 l_no_of_chunks  := ceil(length(l_insert_string)/2000 );
Line: 960

 Ams_Utility_Pvt.Write_Conc_log('Final l_insert_string chunks= '||l_no_of_chunks);
Line: 963

      Ams_Utility_Pvt.Write_Conc_log(substrb(l_insert_string,(2000*i) - 1999,2000));
Line: 1005

        execute immediate l_insert_string;
Line: 1006

        Ams_Utility_Pvt.Write_Conc_log('Insert statement executed. ');
Line: 1056

         l_insert_string||
 '; exception when others then  Ams_Utility_Pvt.Write_Conc_log(SQLERRM);  end;  '  ;
Line: 1106

   update ams_query_template_all
        set mv_name = l_view_name,
            MV_AVAILABLE_FLAG = 'Y',
            SAMPLE_PCT = l_sample_pct,
            SAMPLE_PCT_RECORDS = l_sample_records,
            MASTER_DS_REC_NUMBERS = l_master_total_records,
            RECALC_TABLE_STATUS = 'AVAILABLE'
        where TEMPLATE_ID = p_TEMPLATE_ID;
Line: 1151

        l_check_table_string := 'begin select 1 into :l_exist from sys.all_tables'||'@'||l_dblink||' where table_name = '''||l_view_name||''' ;end;';
Line: 1177

        Ams_Utility_Pvt.Write_Conc_log('remote l_insert_string = '||l_insert_string);
Line: 1195

          l_insert_string,
          l_null,
          OUT l_total_recs,
          'EXECUTE_STRING';
Line: 1203

        update ams_query_template_all
        set mv_name = l_view_name,
            MV_AVAILABLE_FLAG = 'Y',
            SAMPLE_PCT = l_sample_pct,
            SAMPLE_PCT_RECORDS = l_sample_records,
            MASTER_DS_REC_NUMBERS = l_master_total_records,
		  RECALC_TABLE_STATUS = 'AVAILABLE'
        where TEMPLATE_ID = p_TEMPLATE_ID;
Line: 1226

        l_remote_index_string := 'begin select max(COLUMN_ID) into :l_number_of_index from sys.all_tab_columns'||'@'||l_dblink||' where table_name = '''||l_view_name||''' and column_name like ''A%'';end;';
Line: 1239

            l_remote_index_string := 'BEGIN select column_name into :l_index_column from sys.all_tab_columns'||'@'||l_dblink||' where table_name = '''||l_view_name||''' and column_name like ''A%'' and column_id = '||l_counter||'; END;';
Line: 1270

   update ams_query_template_all
   set RECALC_TABLE_STATUS = 'FAILED'
   where TEMPLATE_ID = p_TEMPLATE_ID;
Line: 1320

l_delete_string		varchar2(2000);
Line: 1325

select template_id, mv_name from ams_query_template_all where mv_name is not null;
Line: 1333

		l_delete_string := ' DROP MATERIALIZED VIEW '||l_mv_name;
Line: 1334

		execute immediate l_delete_string;
Line: 1336

   		update ams_query_template_all
	    	   set MV_AVAILABLE_FLAG = 'N'
		where TEMPLATE_ID = L_TEMPLATE_ID;
Line: 1384

select nvl(SAMPLE_PCT,0),MASTER_DS_REC_NUMBERS,SAMPLE_PCT_RECORDS from ams_query_template_all
where TEMPLATE_ID = P_TEMPLATE_ID;
Line: 1390

  select NVL(types.remote_flag, 'N'), database_link
  from AMS_QUERY_ALIAS alias, ams_list_src_types types
  where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code;
Line: 1408

delete from ams_act_logs where ARC_ACT_LOG_USED_BY =
'RECL' and ACT_LOG_USED_BY_ID =  p_template_id;
Line: 1551

    select distinct cond.query_condition_id cond_id
    from AMS_QUERY_CONDITION cond, AMS_QUERY_COND_DISP_STRUCT_all struct,
          AMS_COND_STRUCT_RESTRICT_VALUE res_values
    where cond.template_id = p_template_id
    and cond.value1_type = 'LOV'
    and struct.QUERY_CONDITION_ID = cond.query_condition_id
    and struct.QUERY_COND_DISP_STRUCT_ID = res_values.query_cond_disp_struct_id(+)
    and struct.token_type= 'OPERATOR'
    and cond.mandatory_flag = 'Y'
    UNION
    select distinct cond.query_condition_id cond_id
    from AMS_QUERY_CONDITION cond, AMS_QUERY_COND_DISP_STRUCT_all struct,
          AMS_COND_STRUCT_RESTRICT_VALUE res_values
    where cond.template_id = p_template_id
    and cond.value1_type = 'LOV'
    and struct.QUERY_CONDITION_ID = cond.query_condition_id
    and struct.QUERY_COND_DISP_STRUCT_ID = res_values.query_cond_disp_struct_id
    and struct.token_type= 'OPERATOR'
    and cond.mandatory_flag = 'Y'
    and  ( ( upper(res_values.code) in ('IS', 'IN', 'LIKE') and upper(res_values.code) not in ('IS NOT', 'NOT IN', 'NOT LIKE'))
        or  ( upper(res_values.code) in ('IS NOT', 'NOT IN', 'NOT LIKE') and upper(res_values.code) not in ('IS', 'IN', 'LIKE'))
       )
    and upper(res_values.code) not in ('>', '>=', 'BETWEEN', '<', '<=');
Line: 1576

    select  struct.non_variant_value  attr_name, source_object_name table_name,src_types.list_source_type_id
-- || alias.ALIAS_SEQ table_name
    from AMS_QUERY_COND_DISP_STRUCT_all struct, AMS_QUERY_ALIAS alias, ams_list_src_types src_types
    where struct.query_condition_id = p_cond_id
    and struct.token_type = 'ATTRIBUTE'
    and alias.query_alias_id = struct.query_alias_id
                and alias.OBJECT_NAME = src_types.SOURCE_TYPE_CODE;
Line: 1584

    select upper(res_values.code) operator
    from AMS_QUERY_COND_DISP_STRUCT_all struct, AMS_COND_STRUCT_RESTRICT_VALUE res_values
    where struct.query_condition_id = p_cond_id and
    struct.token_type = 'OPERATOR'
    and struct.QUERY_COND_DISP_STRUCT_ID = res_values.query_cond_disp_struct_id;
Line: 1591

    select upper(res_values.code) lov_value
    from AMS_QUERY_COND_DISP_STRUCT_all struct, AMS_COND_STRUCT_RESTRICT_VALUE res_values
    where struct.query_condition_id = p_cond_id and
    struct.token_type = 'VALUE1'
    and struct.QUERY_COND_DISP_STRUCT_ID = res_values.query_cond_disp_struct_id;
Line: 1599

  select qu.QUERY --sql_string is obsolete bug 4604653
  from ams_list_src_fields flds,ams_attb_lov_b lovb, ams_list_queries_all qu
  where flds.LIST_SOURCE_TYPE_ID = l_list_source_type_id
  and flds.SOURCE_COLUMN_NAME = l_source_field
  and flds.attb_lov_id = lovb.attb_lov_id
  and lovb.CREATION_TYPE = 'SQL'
  and qu.ACT_LIST_QUERY_USED_BY_ID = lovb.attb_lov_id
  and qu.ARC_ACT_LIST_QUERY_USED_BY = 'LOV' ;
Line: 1615

  select lovb.CREATION_TYPE
  from ams_list_src_fields flds ,ams_attb_lov_b lovb
  where flds.LIST_SOURCE_TYPE_ID = l_list_source_type_id
  and flds.SOURCE_COLUMN_NAME = l_source_field
  and flds.attb_lov_id = lovb.attb_lov_id;
Line: 1624

 select valb.value_code
  from ams_list_src_fields flds ,ams_attb_lov_b lovb, ams_attb_lov_values_b valb
  where flds.LIST_SOURCE_TYPE_ID = l_list_source_type_id
  and flds.SOURCE_COLUMN_NAME = l_source_field
  and flds.attb_lov_id = lovb.attb_lov_id
  and lovb.CREATION_TYPE = 'USER'
  and lovb.attb_lov_id = valb.attb_lov_id;
Line: 1634

select distinct alias2.query_alias_id,alias2.source_object_name, alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id;
Line: 1743

         Ams_Utility_Pvt.Write_Conc_log('After c_lov_values --SELECT ALL is used for lov values ');
Line: 1764

            EXECUTE IMMEDIATE ' BEGIN  select valb.value_code '||' BULK COLLECT INTO :1 '||
            ' from ams_list_src_fields flds ,ams_attb_lov_b lovb, ams_attb_lov_values_b valb'||
            ' where flds.LIST_SOURCE_TYPE_ID = :2'||
            ' and flds.SOURCE_COLUMN_NAME = :3 '||
            ' and flds.attb_lov_id = lovb.attb_lov_id and lovb.CREATION_TYPE = '||''''|| 'USER'||''''||
            ' and lovb.attb_lov_id = valb.attb_lov_id ; END; ' USING OUT l_code_tbl, IN l_left_operand_rec.list_source_type_id, l_left_operand_rec.attr_name;
Line: 1881

select cond.query_condition_id cond_id, count(*)
  from AMS_QUERY_CONDITION cond, AMS_QUERY_COND_DISP_STRUCT_all struct,
       AMS_COND_STRUCT_RESTRICT_VALUE res_values
 where cond.template_id = p_template_id
   and cond.value1_type = 'CONSTANT'
   and struct.QUERY_CONDITION_ID = cond.query_condition_id
   and struct.QUERY_COND_DISP_STRUCT_ID = res_values.query_cond_disp_struct_id
   and struct.token_type= 'OPERATOR'
   and cond.mandatory_flag = 'Y'
 group by cond.query_condition_id
having count(*) = 1;
Line: 1895

    select  struct.non_variant_value  attr_name, source_object_name table_name, src_types.list_source_type_id
    from AMS_QUERY_COND_DISP_STRUCT_all struct, AMS_QUERY_ALIAS alias, ams_list_src_types src_types
    where struct.query_condition_id = p_cond_id
    and struct.token_type = 'ATTRIBUTE'
    and alias.query_alias_id = struct.query_alias_id
    and alias.OBJECT_NAME = src_types.SOURCE_TYPE_CODE;
Line: 1904

    select upper(res_values.code) operator, count(*)
    from AMS_QUERY_COND_DISP_STRUCT_all struct, AMS_COND_STRUCT_RESTRICT_VALUE res_values
    where struct.query_condition_id = p_query_cond_id and
    struct.token_type = 'OPERATOR'
    and struct.QUERY_COND_DISP_STRUCT_ID = res_values.query_cond_disp_struct_id
	group by upper(res_values.code)
	having count(*) = 1; --has only one operator
Line: 1914

    select display_text
    from AMS_QUERY_COND_DISP_STRUCT_vl struct
    where struct.query_condition_id = p_query_cond_id and
    struct.token_type in ('VALUE1');
Line: 1920

    select display_text
    from AMS_QUERY_COND_DISP_STRUCT_vl struct
    where struct.query_condition_id = p_query_cond_id and
    struct.token_type in ('VALUE2');
Line: 1927

select distinct alias2.query_alias_id,alias2.source_object_name, alias2.line_num
from
(SELECT  distinct non_variant_value, query_alias_id
 from AMS_QUERY_COND_DISP_STRUCT_vl
  where query_template_id = p_template_id and token_type in ('ATTRIBUTE','VALUE1','VALUE2')
     and query_alias_id is not null) alias1,
(select alias.query_alias_id, types.source_object_name, types.master_source_type_flag,types.source_object_pk_field,
'A'||to_char(rownum) line_num
from AMS_QUERY_ALIAS alias,ams_list_src_types types
where alias.template_id = p_template_id
  and alias.object_name = types.source_type_code
order by alias.query_alias_id) alias2
where alias1.query_alias_id = alias2.query_alias_id;