DBA Data[Home] [Help]

APPS.AMS_LIST_RUNNING_TOTAL_PVT SQL Statements

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

Line: 46

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

            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: 72

            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: 105

l_insert_string           VARCHAR2(32767);
Line: 106

l_select_string           VARCHAR2(32767);
Line: 151

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: 157

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: 163

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: 180

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: 198

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: 216

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: 226

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: 247

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: 260

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

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

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: 277

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: 304

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: 330

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: 338

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: 365

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: 378

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

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

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

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

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: 406

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: 425

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

  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: 446

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

  select to_number(substr(version, 1, instr(version,'.',1,2)-1))
  from v$instance;
Line: 474

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        execute immediate l_insert_string;
Line: 940

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

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

   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: 1085

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

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

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

        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: 1160

        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: 1173

            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: 1204

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

l_delete_string		varchar2(2000);
Line: 1259

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

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

		execute immediate l_delete_string;
Line: 1270

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

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

  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: 1342

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

    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: 1510

    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: 1518

    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: 1525

    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: 1533

  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: 1549

  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: 1558

 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: 1568

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: 1677

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

            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: 1815

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: 1829

    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: 1838

    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: 1848

    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: 1854

    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: 1861

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;