Professional Documents
Culture Documents
undefine v_headerinfo
Define v_headerinfo = '$Header: OTL_Diag.sql 2.0'
undefine v_queries_ver
Define v_queries_ver = '26-Jan-2011'
undefine v_scriptlongname
Define v_scriptlongname = 'OTL Data Collection'
REM ========================================================
REM Copyright © 2007 Oracle Corporation Redwood Shores, California, USA
REM Oracle Support Services. All rights reserved.
REM ========================================================
REM PURPOSE: This is a collection of adhoc queries to get data
REM for specific issues as identified by OTL support.
REM PRODUCT: 311 - Oracle Time and Labor
REM PRODUCT VERSIONS: 11.5
REM PLATFORM: Generic
REM PARAMETERS: Parameter1: <Script Section>
REM Parameter2: dynamic by section
REM Parameter3: dynamic by section
REM =======================================================
REM USAGE: This script should be run in SQLplus in APPS Schema
REM and only at the request of OTL support.
REM EXAMPLE: in the SQL prompt execute :SQL>@c:\filepath\OTL_Diag.sql
REM OUTPUT: The output will be spooled to a dynamic filename based on
REM the parameters used. eg... OTL_vish_otl11i_0_0.html
REM =======================================================
REM ==============SQL PLUS Environment setup===================
set serveroutput on size 1000000
set autoprint off
set verify off
set echo off
REM ============== Define SQL Variables for input parameters =============
undefine v_date
undefine v_nls
undefine v_version
clear columns
variable v_nls varchar2(50);
variable v_version varchar2(17);
set head off feedback off
--Verify RDBMS version
DECLARE
BEGIN
select max(version)
into :v_version
from v$instance;
:v_version := substr(:v_version,1,9);
if :v_version < '8.1.6.0.0' and :v_version > '4' then
dbms_output.put_line(chr(10));
dbms_output.put_line('RDBMS Version = '||:v_version);
dbms_output.put_line('ERROR - The Script requires RDBMS version 8.1.6 or highe
r');
dbms_output.put_line('ACTION - Type Ctrl-C <Enter> to exit the script.');
dbms_output.put_line(chr(10));
end if;
exception
when others then
dbms_output.put_line(chr(10));
dbms_output.put_line('ERROR - RDBMS Version error: '|| sqlerrm);
dbms_output.put_line('ACTION - Please report the above error to Oracle Suppo
rt Services.' || chr(10) ||
' Type Ctrl-C <Enter> to exit the script.');
dbms_output.put_line(chr(10));
END;
/
--Verify NLS Character Set
DECLARE
BEGIN
select value
into :v_nls
from v$nls_parameters
where parameter = 'NLS_CHARACTERSET';
if :v_version < '8.1.7.4.0' and :v_version > '4' and :v_nls = 'UTF8' then
dbms_output.put_line(chr(10));
dbms_output.put_line('RDBMS Version = '||:v_version);
dbms_output.put_line('NLS Character Set = '||:v_nls);
dbms_output.put_line('ERROR - The HTML functionality of this script is incompa
tible with this Character Set for RDBMS version 8.1.7.3 and lower');
dbms_output.put_line('ACTION - Please report the above error to Oracle Support
Services.');
dbms_output.put_line(chr(10));
end if;
exception
when others then
dbms_output.put_line(chr(10));
dbms_output.put_line('ERROR - NLS Character Set error: '|| sqlerrm);
dbms_output.put_line('ACTION - Please report the above error to Oracle Suppo
rt Services.' || chr(10) ||
' Type Ctrl-C <Enter> to exit the script.' ||
chr(10) );
dbms_output.put_line(chr(10));
END;
/
REM ============ Get the Date ====================
set pagesize 200
set term off
--Get the Date and Time
COLUMN TODAY NEW_VALUE v_date
SELECT TO_CHAR(SYSDATE, 'MMDDHH24MI') TODAY
from sys.dual;
set term on
set head on feedback on
-- *****************************************************************************
**********************
-- *****************************************************************************
**********************
--undefine 1
Prompt Enter Parameter 1:
set termout off
Prompt &&1
set termout on
--undefine 2
Prompt Enter Parameter 2:
set termout off
Prompt &&2
set termout on
--undefine 3
Prompt Enter Parameter 3:
set termout off
Prompt &&3
set termout on
-- *****************************************************************************
**********************
-- *****************************************************************************
**********************
REM ============ Spooling the output file====================
Prompt
Prompt Running...
Prompt
set termout off
undefine l_instance_name
undefine outputfilename
--define outputfilename = OTL_Diag_&1._&2._diag.html -- OTL_Diag._&v_date._diag
.html
define l_instance_name = ''
column linstancename new_value l_instance_name
select substr(rpad(value,4,'_'),1,4) linstancename from v$parameter where name =
'db_name';
define outputfilename = ''
column outputfilename new_value outputfilename
select substr(replace(replace(replace(replace(replace(replace(replace(replace('O
TL_&&l_instance_name._&&1._&&2._&&3','.','_'),'+','_'),'$','_'),' ','_'),'~','_'
),'%','_'),'/','_'),'-','_'),1,25) || '.html' outputfilename from dual;
spool &outputfilename
set termout on
REM ================= Pl/SQL api start ========================================
set termout off
prompt <html lang="en,us"><head><!--
REM $Header: CoreApiHtml.sql 1.31.2 24-NOV-2003 support $
REM +=========================================================================+
REM | Copyright (c) 2001 Oracle Corporation Belmont, California, USA |
REM | All rights reserved. |
REM +=========================================================================+
REM ##########################################################################
REM PURPOSE: PLSQL API
REM PROGRAM: CoreApiHtml.sql
REM NOTE: No Note to Associate
REM CONFIG: support.cfg, Requires files to source (.env) and Passwords.
REM USAGE: API only, included in others as: @CoreApiHtml
REM FRAMEWORK: SDF OHS
REM PRODUCT_VER: 11.5.X
REM PRODUCT_CODE: 510
REM SUBCOMPONENT: FND
REM NODE: WEB
REM PARAMS: NONE
REM
REM ##########################################################################
REM ##########################################################################
REM Change History
REM 05-JUN-2002 ALUMPE Modified Display_SQL so that headers print only
REM if rows are returned
REM 02-JUL-2002 ALUMPE 1) Added Column_Exists API
REM 2) Added Show_Invalids API
REM 3) Added Feedback option and Number of rows option
REM To Run_SQL and Display_SQL API's
REM 4) Modified Get_DB_Patch_List to give appropriate
REM feedback if no rows retrieved
REM 5) Added CheckFinPeriod API
REM 6) Added CheckKeyFlexfield API
REM 7) Fixed font inconsistencies with Tab0Print
REM 05-AUG-2002 ALUMPE Added Init_Block and End_Block API's to enable
REM multi-block script without reprinting header info
REM 14-AUG-2002 ALUMPE Added NoticePrint API.
REM 30-AUG-2002 ALUMPE Modified Display_profiles to use the _VL views
REM rather than the _TL tables with a language condition
REM as userenv('LANG') = 'US' but language = 'AMERICAN'
REM on some 10.7 instances
REM 07-NOV-2002 ALUMPE Modified Display_SQL/Run_SQL to allow for indenting
REM of the table output.
REM 06-DEC-2002 ALUMPE Modified Display_SQL to convert chr(10) to html
REM <BR> in text values
REM 02-JAN-2003 ALUMPE Modified Display_SQL to fix bug with dates displaying
REM in DD-MON- format on certain DB versions.
REM 05-FEB-2003 ALUMPE Modified Compare_Pkg_Version to handle branched
REM code versions
REM 17-FEB-2003 ALUMPE Fixed bug in ActionWarningLink "spanclass" corrected
REM to "span class" to get correct text color.
REM 26-FEB-2003 ALUMPE Fixed issue with Show_Invalids. Error storing
REM variable was not being initialized for each object
REM 08-APR-2003 ALUMPE Modified CheckProfile to act like java api
REM Added parameter to include filename in
REM get_package_version/spec/body apis
REM Added global variable to control date format in SQL
REM 17-JUN-2003 ALUMPE Removed unused code and simplified display_sql
REM additionally added check to remove chr(0) where
REM found in text columns.
REM 20-NOV-2003 CMDRAKE Modified Display_SQL so that headers longer than 10
REM characters are broken at underscores
REM 21-NOV-2003 IGOVAERT Modified Display_SQL so that headers do not always
REM appear in InitCap
REM Modified Display_sql/Run_sql to allow to create a
REM See SQL link
REM ##########################################################################
REM Procedures/Functions Implemented
REM ActionErrorPrint()
REM ActionPrint()
REM ActionWarningPrint()
REM Begin_Pre()
REM BRPrint()
REM CheckFinPeriod()
REM CheckKeyFlexfield()
REM CheckProfile()
REM Column_Exists()
REM Compare_Pkg_Version()
REM Display_Profiles()
REM Display_SQL()
REM Display_Table()
REM End_Pre()
REM ErrorPrint()
REM Get_DB_Apps_Version()
REM Get_DB_Patch_List()
REM Get_Package_Body()
REM Get_Package_Spec()
REM Get_Package_Version()
REM Get_Profile_Option()
REM Get_RDBMS_Header()
REM Insert_HTML()
REM Insert_Style_Sheet()
REM NoticePrint()
REM Run_SQL()
REM SectionPrint()
REM Send_Email()
REM Set_Client()
REM Set_Org()
REM Show_Header()
REM Show_Invalids()
REM Show_Link()
REM Show_Table()
REM Tab0Print()
REM Tab1Print()
REM Tab2Print()
REM Tab3Print()
REM WarningPrint()
REM
REM Procedures/Functions Removed
REM BlackPrint() - 508 Compatibility
REM BluePrint() - 508 Compatibility
REM GreenPrint() - 508 Compatibility
REM Plain_SectionPrint() - Same as ActionPrint()
REM RedPrint() - 508 Compatibility
REM Steps_Results() - Standards Modification
REM SuccessPrint() - Same as Tab1Print()
REM
REM Functions to possibly implement
REM Compare_SQL_Data()
REM Execute_URL()
REM Validate_Apps_User()
REM
set serveroutput on size 1000000
set feedback off
set verify off
set echo off
set long 2000000000
set linesize 32767
set longchunksize 32767
set pagesize 0
set timing off
set trimout on
set trimspool on
set heading off
set autoprint on
undefine nbsp
define nbsp = ''
column lnbsp new_value nbsp noprint
select chr(38) || 'nbsp' lnbsp from dual;
undefine p_id
define p_id = ''
column lp_id new_value p_id noprint
select chr(38) || 'p_id' lp_id from dual;
undefine lt
define lt = ''
column llt new_value lt noprint
select chr(38) || 'lt' llt from dual;
undefine gt
define gt = ''
column lgt new_value gt noprint
select chr(38) || 'gt' lgt from dual;
undefine AMPER
define AMPER = ''
column lAMPER new_value AMPER noprint
select chr(38) lAMPER from dual;
undefine T_VARCHAR2
undefine T_ROWID
undefine T_NUMBER
undefine T_LONG
undefine T_DATE
undefine T_CHAR
undefine T_CLOB
variable g_hold_output clob;
declare
counter number := 0;
failures number := 0;
g_curr_loc number := 1;
/* Global defaults for SQL output formatting */
g_sql_date_format varchar2(100) := 'DD-MON-YYYY HH24:MI';
/* Global variables set by Set_Client which can be used throughout a script */
g_user_id number;
g_resp_id number;
g_appl_id number;
g_org_id number;
/* Global variable set by Set_Client or Get_DB_Apps_Version which can
be referenced in scripts which branch based on applications release */
g_appl_version varchar2(10);
type V2T is table of varchar2(32767);
l_counter2 := 0;
l_num_segs := 0;
l_num_segs_vs := 0;
for seg in get_segments(p_flex_code, str.flex_str_num) loop
if l_counter2 = 0 then
Tab1Print('Segment Details for '||str.flex_str_name);
BRPrint;
end if;
l_counter2 := l_counter2 + 1;
if (p_flex_num is not null) then
if seg.enabled = 'Y' then
l_num_segs := l_num_segs + 1;
if (seg.value_set_id is not null) then
l_num_segs_vs := l_num_segs_vs + 1;
end if;
end if;
end if;
l_sec_enabled := 'N';
if (seg.seg_security = 'Y' and seg.value_set_security in ('Y','H')) then
l_any_sec_enabled := 'Y';
l_sec_enabled := 'Y';
end if;
if (seg.value_set_id is not null) then
l_value_set_str := ', Value Set = '||seg.value_set_name||
', Value Set Type = '||seg.validation_type;
else
l_value_set_str := ' with no value set assigned';
end if;
Tab2Print('Segment Name = '||seg.seg_name);
Tab2Print('Enabled = '||seg.enabled||', Displayed = '||
seg.displayed||l_value_set_str);
for qual in get_qualifiers(p_flex_code,str.flex_str_num,seg.col_name) loop
Tab3Print('Qualifier '||qual.segment_prompt||' is assigned to '||
'segment '|| seg.seg_name);
end loop;
if l_sec_enabled = 'Y' then
select count(*) into l_rule_count
from fnd_flex_value_rules_vl
where flex_value_set_id = seg.value_set_id;
select count(*) into l_rule_assign_count
from fnd_flex_value_rules_vl r,
fnd_flex_value_rule_usages ru
where r.flex_value_rule_id = ru.flex_value_rule_id
and r.flex_value_set_id = seg.value_set_id;
Tab3Print('Security is enabled for this segment and value set with '||
to_char(l_rule_count)||' rules defined and '||
to_char(l_rule_assign_count)||' rule assignments');
end if;
end loop;
if (p_flex_num is not null) then
l_ret_array(6) := to_char(l_num_segs);
l_ret_array(7) := to_char(l_num_segs_vs);
l_ret_array(8) := l_any_sec_enabled;
end if;
if l_counter2 = 0 then
ErrorPrint('There are no segments defined for this structure');
ActionErrorPrint('Please enable or define at least one segment for '||
str.flex_str_name);
end if;
end loop;
if l_counter = 0 then
if p_flex_num is null then
ErrorPrint('There are no Key Flexfields enabled for ' || p_flex_code);
ActionErrorPrint('Please enable or define a Key Flexfield for ' ||
p_flex_code);
else
ErrorPrint('The requested flexfield structure (ID_FLEX_NUM='||
to_char(p_flex_num)||') is inactive or does not exist');
ActionErrorPrint('Verify that the flexfield structure is defined '||
'and enabled for Key Flexfield '||p_flex_code);
end if;
end if;
return l_ret_array;
exception
when leave_api then
return l_ret_array;
end CheckKeyFlexfield;
procedure CheckKeyFlexfield(p_flex_code in varchar2
, p_flex_num in number default null
, p_print_heading in boolean default true) is
dummy_v2t V2T;
begin
dummy_v2t := CheckKeyFlexfield(p_flex_code, p_flex_num, p_print_heading);
end CheckKeyFlexfield;
-- Function/Procedure Name: CheckProfile
--
-- Usage:
-- CheckProfile('Profile Name', UserID, ResponsibilityID,
-- ApplicationID, 'Default Value', Indent Level, Align At,
-- 'Error Flag');
--
-- Parameters:
-- Profile Name - System name of the profile option being checked
-- UserID - The identifier of that applications user for which the
-- profile option is to be checked.
-- ResponsibilityID - The identifier of the responsibility for which
-- the profile option is to be checked
-- ApplicationID - The identifier of the application for which the profile
-- option is to be checked
-- Default Value - The value that will be used as a default if the profile
-- option is not set by the users (Default=NULL)
-- Indent Level - Number of tabs (0,1,2,3) that output should be indented
-- (Default=0)
-- Align At - Not used in HTML API's. Only present for consistency
-- with text API's where this will place the '=' at the
-- indicated character position from the beginning of the
-- text.
-- Error Flag - 'E', 'W', or 'N' to indicate if a profile that is not set
-- should produce an error, a warning, or neither. (default=E)
--
-- Returns:
-- If called as a function the return value will be either --
-- 1 the value of the profile option if set
-- 2 'DOESNOTEXIST' if the profile option does not exist
-- 3 'DISABLED' if the profile option has been end dated
-- 4 null if the profile option is not set
-- Output:
-- If the profile is set, displays its current setting. Else indicates
-- whether the option does not exist, is not active, or is not set.
-- If the profile option is not set the error flag indicates whether a
-- warning or error should be printed as well.
-- Examples:
-- declare
-- profile_val fnd_profile_option_values.profile_option_value%type;
-- begin
-- profile_val := CheckProfile('PA_SELECTIVE_FLEX_SEG',g_user_id,
-- g_resp_id, g_appl_id, null, 1, 0, 'W');
-- CheckProfile('PA_DEBUG_MODE',g_user_id, g_resp_id, g_appl_id);
-- CheckProfile('PA_DEBUG_MODE',g_user_id, g_resp_id, g_appl_id,'Y',2,
-- 45,'E');
-- end;
--
function CheckProfile(p_prof_name in varchar2
, p_user_id in number
, p_resp_id in number
, p_appl_id in number
, p_default in varchar2 default null
, p_indent in integer default 0
, p_align_at in integer default 0
, p_error in varchar2 default 'E')
return varchar2 is
l_user_prof_name fnd_profile_options_tl.user_profile_option_name%type;
l_prof_value fnd_profile_option_values.profile_option_value%type;
l_start_date date;
l_end_date date;
l_opt_defined boolean;
l_output_txt varchar2(500);
begin
begin
select user_profile_option_name,
nvl(start_date_active,sysdate-1),
nvl(end_date_active,sysdate+1)
into l_user_prof_name, l_start_date, l_end_date
from fnd_profile_options_vl
where profile_option_name = p_prof_name;
exception
when no_data_found then
l_prof_value := 'DOESNOTEXIST';
l_output_txt := p_prof_name||' does not exist.';
when others then
ErrorPrint(sqlerrm||' occured while getting profile option '||
'information');
ActionErrorPrint('Report the above information to Oracle '||
'Support Services');
return(null);
end;
if (nvl(l_prof_value,'X') != 'DOESNOTEXIST' and
((sysdate < l_start_date) or (sysdate > l_end_date))) then
l_prof_value := 'DISABLED';
l_output_txt := l_user_prof_name||' is not active.';
end if;
if (nvl(l_prof_value,'X') not in ('DOESNOTEXIST','DISABLED')) then
fnd_profile.get_specific(p_prof_name, p_user_id, p_resp_id, p_appl_id,
l_prof_value, l_opt_defined);
if not l_opt_defined then
l_prof_value := null;
end if;
if l_prof_value is null then
if p_default is null then
l_output_txt := l_user_prof_name||' is not set.';
else
l_output_txt := l_user_prof_name||' is not set, but defaults to '||
p_default;
end if;
else
l_output_txt := l_user_prof_name||' = "'||l_prof_value||'"';
end if;
end if;
if p_indent = 1 then
Tab1Print(l_output_txt);
elsif p_indent = 2 then
Tab2Print(l_output_txt);
elsif p_indent = 3 then
Tab3Print(l_output_txt);
else
Tab0Print(l_output_txt);
end if;
if l_prof_value is null and p_error = 'E' then
ErrorPrint(l_user_prof_name || ' profile option is not set');
ActionErrorPrint('Please set the profile option according to '||
'the product user manual');
elsif l_prof_value is null and p_error = 'W' then
WarningPrint(l_user_prof_name || ' profile option is not set');
ActionWarningPrint('Please set the profile option according to '||
'the product user manual');
end if;
return(l_prof_value);
exception when others then
ErrorPrint(sqlerrm||' occured in CheckProfile');
ActionErrorPrint('Please report this error to your support representative');
end CheckProfile;
procedure CheckProfile(p_prof_name in varchar2
, p_user_id in number
, p_resp_id in number
, p_appl_id in number
, p_default in varchar2 default null
, p_indent in integer default 0
, p_align_at in integer default 0
, p_error in varchar2 default 'E' ) is
l_dummy_prof_value fnd_profile_option_values.profile_option_value%type;
begin
l_dummy_prof_value := CheckProfile(p_prof_name, p_user_id, p_resp_id,
p_appl_id, p_default, p_indent, p_align_at, p_error);
end CheckProfile;
-- Function Name: Column_Exists
--
-- Usage:
-- Column_Exists('Table Name','Column Name');
--
-- Paramteters:
-- Table Name - Table in which to check for the column
-- Column Name - Column to check
--
-- Returns:
-- 'Y' if the column exists in the table, 'N' if not.
--
-- Example:
-- declare
-- sqltxt varchar2(1000);
-- begin
-- if Column_Exists('PA_IMPLEMENTATIONS_ALL','UTIL_SUM_FLAG') = 'Y' then ;
-- sqltxt := sqltxt||' and i.util_sum_flag is not null';
-- end if;
-- end;
--
function Column_Exists(p_tab in varchar, p_col in varchar) return varchar2 is
l_counter integer:=0;
begin
select count(*) into l_counter
from all_tab_columns
where table_name = upper(p_tab)
and column_name = upper(p_col);
if l_counter > 0 then
return('Y');
else
return('N');
end if;
exception when others then
ErrorPrint(sqlerrm||' occured in Column_Exists');
ActionErrorPrint('Report this information to your support analyst');
raise;
end Column_Exists;
-- Procedure Name: Begin_Pre
--
-- Usage:
-- Begin_Pre;
--
-- Output:
-- Allows the following output to be preformatted
--
-- Examples:
-- begin
-- Begin_Pre;
-- end;
--
procedure Begin_Pre is
begin
line_out('<pre>');
end Begin_Pre;
-- Procedure Name: End_Pre
--
-- Usage:
-- End_Pre;
--
-- Output:
-- Closes the Begin_Pre procedure
--
-- Examples:
-- begin
-- End_Pre;
-- end;
--
procedure End_Pre is
begin
line_out('</pre>');
end End_Pre;
if p_current_exec = 0 then
select value into l_hold_date_format from nls_session_parameters
where parameter = 'NLS_DATE_FORMAT';
execute immediate 'alter session set nls_date_format = ''DD-MON-
YYYY HH24:MI''';
end if;
begin
v_cursor_id := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(v_cursor_id, p_sql_statement, DBMS_SQL.V7);
DBMS_SQL.DESCRIBE_COLUMNS(v_cursor_id, column_high, v_describe);
hold_sql := 'select ';
hold_sql_needed := null;
hold_exclude_cols := false;
hold_sql_remain := ltrim(substr(replace(p_sql_statement,chr(10),
' '), 7));
for value_counter in 1..column_high loop
if v_describe(value_counter).col_type = T_LONG then
hold_length := 25000;
else
hold_length := to_number(v_describe(value_counte
r).col_max_len);
end if;
if v_describe(value_counter).col_type in (T_DATE, T_VARC
HAR2, T_NUMBER, T_CHAR, T_ROWID) then
DBMS_SQL.DEFINE_COLUMN(v_cursor_id, value_counte
r, hold_string, greatest(hold_length,30));
elsif v_describe(value_counter).col_type = T_CLOB then
DBMS_SQL.DEFINE_COLUMN(v_cursor_id, value_counte
r, hold_clob);
else
null;
end if;
hold_string := v_describe(value_counter).col_name;
if value_counter = 1 then
v_col_headers := V2T(replace(initcap(hold_string
),'|','<br>'));
else
v_col_headers.EXTEND;
v_col_headers(value_counter) := replace(initcap(
hold_string),'|','<br>');
end if;
if substr(hold_sql_remain,1,1) != '*' then
hold_end_pos := 1;
hold_open_paren := 0;
loop
if substr(hold_sql_remain,hold_end_pos,1
) = '(' then
hold_open_paren := hold_open_par
en + 1;
elsif substr(hold_sql_remain,hold_end_po
s,1) = ')' then
hold_open_paren := hold_open_par
en - 1;
elsif substr(hold_sql_remain,hold_end_po
s,1) = ','
or lower(substr(hold_sql_remain, hold
_end_pos, 4)) = ' from ' then
if hold_open_paren = 0 then
exit;
end if;
end if;
hold_end_pos := hold_end_pos + 1;
if hold_end_pos > length(p_sql_statement
) then
exit;
end if;
end loop;
hold_element := substr(hold_sql_remain, 1, hold_
end_pos);
hold_sql_remain := ltrim(substr(hold_sql_remain,
hold_end_pos + 1));
else
hold_element := v_describe(value_counter).col_na
me;
end if;
if v_describe(value_counter).col_type in (T_VARCHAR2, T_
CHAR, T_NUMBER, T_DATE, T_LONG, T_CLOB, T_ROWID) then
hold_sql := hold_sql || hold_sql_needed || hold_
element;
else
hold_exclude_cols := true;
end if;
hold_sql_needed := ', ';
end loop;
if hold_exclude_cols then
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);
hold_sql := hold_sql || ' ' || substr(p_sql_statement,in
str(lower(p_sql_statement),' from '));
row_counter := Display_SQL (hold_sql, table_alias, displ
ay_longs, p_current_exec + 1) + 1;
else
if nvl(p_ind_level,0) != 0 then
line_out('<div class=ind'||to_char(p_ind_level)||'>');
end if;
if table_alias is not null then
line_out('<br><span class="BigPrint">' || table_
alias ||'</span>');
end if;
Start_Table(table_alias);
line_out('<tr>');
line_out('<th id=1>Column</th>');
line_out('<th id=2>Value</th>');
line_out('</tr>');
v_dummy := DBMS_SQL.EXECUTE(v_cursor_id);
row_counter := 1;
loop
if DBMS_SQL.FETCH_ROWS(v_cursor_id) = 0 then
exit;
end if;
for value_counter in 1..column_high loop
if v_describe(value_counter).col_type in
(T_DATE, T_VARCHAR2, T_NUMBER, T_CHAR, T_ROWID) then
DBMS_SQL.COLUMN_VALUE(v_cursor_i
d, value_counter, hold_string);
else
DBMS_SQL.COLUMN_VALUE(v_cursor_i
d, value_counter, hold_clob);
hold_string := 'CLOB';
end if;
hold_option := null;
if v_describe(value_counter).col_type =
T_DATE then
hold_string := replace(hold_stri
ng,' ',' ');
elsif v_describe(value_counter).col_type
= T_VARCHAR2 then
hold_string := replace(replace(h
old_string,'<','<'),'>','>');
else
null;
end if;
hold_string := replace(hold_string,' ','
');
if value_counter = 1 then
v_values := V2T(hold_string);
else
v_values.EXTEND;
v_values(value_counter) := hold_
string;
end if;
end loop;
if row_counter > 1 then
line_out('<br><span class="BigPrint">' || table_alias ||' Row '||row_cou
nter||' </span> ');
line_out('</style>') ;
line_out('</head><body>');
line_out('<table cellspacing=0 summary="' || table_alias ||' Row '||row_
counter||' "><tr> ');
line_out('<tr>');
line_out('<th id=1>Column</th>');
line_out('<th id=2>Value</th>');
line_out('</tr>');
end if;
for i in 1..v_values.COUNT loop
if v_values(i) is null then
if upper(nvl(p_null,'Y')) = 'Y' then
line_out('<tr>');
line_out('<td align=left headers="'||1||'" nowrap>'||'<tt>' ||v_col_headers(i)||
' </tt>'||'</td>');
line_out('<td align=left headers="'||2||'" nowrap>'||'<tt>><</tt>'||'</td>'
);
line_out('</tr>');
end if;
else
line_out('<tr>');
line_out('<td align=left headers="'||1||'" nowrap>'||'<tt>' ||v_col_headers(i)||
' </tt>'||'</td>');
if p_spaces = 'Y' then
if v_describe(i).col_type in (T_NUMBER, T_DATE) then
line_out('<td align=left headers="'||2||'" nowrap>'||'<tt>' ||v_values(i
)||'</tt>'||'</td>');
else
line_out('<td align=left headers="'||2||'" nowrap>'||'<tt>>' ||v_valu
es(i)||'< </tt>'||'</td>');
end if;
else
line_out('<td align=left headers="'||2||'" nowrap>'||'<tt>' ||v_values(i)||'</tt
>'||'</td>');
end if;
line_out('</tr>');
end if;
end loop;
line_out('<br>');
row_counter := row_counter + 1;
if row_counter > nvl(l_max_rows,row_counter) then
exit;
end if;
line_out('</tr></table><br>');
end loop;
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);
Show_Table('END');
end if;
if p_current_exec = 0 and p_feedback = 'Y' then
if row_counter = 1 then
l_feedback_txt := '<BR><span class="SmallPrint">'||
'0 Rows Selected</span><br>';
elsif row_counter = 2 then
l_feedback_txt := '<span class="SmallPrint">'||
'1 Row Selected</span><br>';
else
l_feedback_txt := '<span class="SmallPrint">'||
ltrim(to_char(row_counter - 1,'9999999')) ||
' Rows Selected</span><br>';
end if;
line_out(l_feedback_txt);
execute immediate 'alter session set nls_date_format = '
'' || l_hold_date_format || '''';
end if;
return row_counter-1;
exception
when others then
line_out('</table><br>');
error_position := DBMS_SQL.LAST_ERROR_POSITION;
ErrorPrint(sqlerrm || ' occurred in Display_SQLP');
ActionErrorPrint('Please report the error below to suppo
rt.');
line_out('Position: ' || error_position || ' of ' || le
ngth(p_sql_statement) || '<br>');
line_out(replace(substr(p_sql_statement,1,error_position
),chr(10),'<br>'));
error_position_end := instr(p_sql_statement,' ',error_po
sition+1) - error_position;
line_out('<span class="error">' || replace(substr(p_sql_
statement,error_position+1, error_position_end),chr(10),'<br>') || '</span>');
line_out(replace(substr(p_sql_statement,error_position+e
rror_position_end+1),chr(10),'<br>') || '<br>');
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);
if p_current_exec = 0 then
execute immediate 'alter session set nls_date_fo
rmat = ''' || l_hold_date_format || '''';
end if;
return -1;
end;
end display_sqlP;
begin
if nvl(p_max_rows,0) = 0 then
l_max_rows := null;
else
l_max_rows := p_max_rows;
end if;
if p_current_exec = 0 then
select value into l_hold_date_format from nls_session_parameters
where parameter = 'NLS_DATE_FORMAT';
execute immediate 'alter session set nls_date_format = ''DD-MON-
YYYY HH24:MI''';
end if;
begin
v_cursor_id := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(v_cursor_id, p_sql_statement, DBMS_SQL.V7);
DBMS_SQL.DESCRIBE_COLUMNS(v_cursor_id, column_high, v_describe);
hold_sql := 'select ';
hold_sql_needed := null;
hold_exclude_cols := false;
hold_sql_remain := ltrim(substr(replace(p_sql_statement,chr(10),
' '), 7));
for value_counter in 1..column_high loop
if v_describe(value_counter).col_type = T_LONG then
hold_length := 25000;
else
hold_length := to_number(v_describe(value_counte
r).col_max_len);
end if;
if v_describe(value_counter).col_type in (T_DATE, T_VARC
HAR2, T_NUMBER, T_CHAR, T_ROWID) then
DBMS_SQL.DEFINE_COLUMN(v_cursor_id, value_counte
r, hold_string, greatest(hold_length,30));
elsif v_describe(value_counter).col_type = T_CLOB then
DBMS_SQL.DEFINE_COLUMN(v_cursor_id, value_counte
r, hold_clob);
else
null;
end if;
hold_string := v_describe(value_counter).col_name;
if value_counter = 1 then
v_col_values := V2T(replace(initcap(hold_string)
,'|','<br>'));
else
v_col_values.EXTEND;
v_col_values(value_counter) := replace(initcap(h
old_string),'|','<br>');
end if;
if substr(hold_sql_remain,1,1) != '*' then
hold_end_pos := 1;
hold_open_paren := 0;
loop
if substr(hold_sql_remain,hold_end_pos,1
) = '(' then
hold_open_paren := hold_open_par
en + 1;
elsif substr(hold_sql_remain,hold_end_po
s,1) = ')' then
hold_open_paren := hold_open_par
en - 1;
elsif substr(hold_sql_remain,hold_end_po
s,1) = ','
or lower(substr(hold_sql_remain, hold
_end_pos, 4)) = ' from ' then
if hold_open_paren = 0 then
exit;
end if;
end if;
hold_end_pos := hold_end_pos + 1;
if hold_end_pos > length(p_sql_statement
) then
exit;
end if;
end loop;
hold_element := substr(hold_sql_remain, 1, hold_
end_pos);
hold_sql_remain := ltrim(substr(hold_sql_remain,
hold_end_pos + 1));
else
hold_element := v_describe(value_counter).col_na
me;
end if;
if v_describe(value_counter).col_type in (T_VARCHAR2, T_
CHAR, T_NUMBER, T_DATE, T_LONG, T_CLOB, T_ROWID) then
hold_sql := hold_sql || hold_sql_needed || hold_
element;
else
hold_exclude_cols := true;
end if;
hold_sql_needed := ', ';
end loop;
if hold_exclude_cols then
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);
hold_sql := hold_sql || ' ' || substr(p_sql_statement,in
str(lower(p_sql_statement),' from '));
row_counter := Display_SQL (hold_sql, table_alias, displ
ay_longs, p_current_exec + 1) + 1;
else
if nvl(p_ind_level,0) != 0 then
line_out('<div class=ind'||to_char(p_ind_level)||'>');
end if;
v_dummy := DBMS_SQL.EXECUTE(v_cursor_id); -------->find
null columns
row_counter2 := 1;
loop
if DBMS_SQL.FETCH_ROWS(v_cursor_id) = 0 then
exit;
end if;
for value_counter in 1..column_high loop
if v_describe(value_counter).col_type in
(T_DATE, T_VARCHAR2, T_NUMBER, T_CHAR, T_ROWID) then
DBMS_SQL.COLUMN_VALUE(v_cursor_i
d, value_counter, hold_string);
else
DBMS_SQL.COLUMN_VALUE(v_cursor_i
d, value_counter, hold_clob);
hold_string := 'CLOB';
end if;
hold_option := null;
if v_describe(value_counter).col_type =
T_DATE then
hold_string := replace(hold_stri
ng,' ',' ');
hold_option := 'nowrap align=rig
ht';
elsif v_describe(value_counter).col_type
= T_VARCHAR2 then
hold_string := replace(replace(h
old_string,'<','<'),'>','>');
if hold_string != rtrim(hold_str
ing) then
hold_option := 'nowrap b
gcolor=yellow';
else
hold_option := 'nowrap';
end if;
elsif v_describe(value_counter).col_type
= T_NUMBER then
hold_option := 'nowrap align=rig
ht';
else
null;
end if;
hold_string := replace(hold_string,' ','
');
if value_counter = 1 then
v_valuesN := v2t(hold_string);
else
v_valuesN.EXTEND;
v_valuesN(value_counter) := v_va
luesN(value_counter)||hold_string;
end if;
end loop;
row_counter2 := row_counter2 + 1;
end loop;
if table_alias is not null then
line_out('<br><span class="BigPrint">' || table_
alias ||'</span>');
end if;
Start_Table(table_alias);
line_out('<tr>');
line_out('<th id=1>Column</th>');
for i in 1..row_counter2-1 loop
if i > l_max_rows then
exit;
end if;
line_out('<th id='||(i)||'> Row '||(i)||'</th>')
;
end loop;
line_out('</tr>');
column_high2 := column_high;
v_values2 := V2T('');
v_options2 := V2T('');
v_dummy := DBMS_SQL.EXECUTE(v_cursor_id);
row_counter := 1;
loop
if DBMS_SQL.FETCH_ROWS(v_cursor_id) = 0 then
exit;
end if;
for value_counter in 1..column_high loop
if v_describe(value_counter).col_type in
(T_DATE, T_VARCHAR2, T_NUMBER, T_CHAR, T_ROWID) then
DBMS_SQL.COLUMN_VALUE(v_cursor_i
d, value_counter, hold_string);
else
DBMS_SQL.COLUMN_VALUE(v_cursor_i
d, value_counter, hold_clob);
hold_string := 'CLOB';
end if;
--hold_string := nvl(hold_string,NULL);
--hold_string := nvl(hold_string,'
');
hold_option := null;
if v_describe(value_counter).col_type =
T_DATE then
hold_string := replace(hold_stri
ng,' ',' ');
hold_option := 'nowrap align=rig
ht';
elsif v_describe(value_counter).col_type
= T_VARCHAR2 then
hold_string := replace(replace(h
old_string,'<','<'),'>','>');
if hold_string != rtrim(hold_str
ing) then
hold_option := 'nowrap b
gcolor=yellow';
else
hold_option := 'nowrap';
end if;
elsif v_describe(value_counter).col_type
= T_NUMBER then
hold_option := 'nowrap align=rig
ht';
else
null;
end if;
hold_string := replace(hold_string,' ',' ');
if value_counter = 1 then
v_values := V2T('~1~2'||hold_str
ing||'~8~9');
else
v_values.EXTEND;
v_values(value_counter) := '~1~2
'||hold_string||'~8~9';
end if;
v_values2.EXTEND;
v_values2(value_counter) := v_values2(value_counter)||v_values(value_counter);
end loop;
row_counter := row_counter + 1;
if row_counter > nvl(l_max_rows,row_counter) then
exit;
end if;
v_col_values_count := v_col_values.count;
end loop;
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);
end loop;
end if;
Show_Table('END');
end if;
if p_current_exec = 0 and p_feedback = 'Y' then
if row_counter = 1 then
l_feedback_txt := '<BR><span class="SmallPrint">'||
'0 Rows Selected</span><br>';
elsif row_counter = 2 then
l_feedback_txt := '<span class="SmallPrint">'||
'1 Row Selected</span><br>';
else
l_feedback_txt := '<span class="SmallPrint">'||
ltrim(to_char(row_counter - 1,'9999999')) ||
' Rows Selected</span><br>';
end if;
line_out(l_feedback_txt);
execute immediate 'alter session set nls_date_format = '
'' || l_hold_date_format || '''';
end if;
return row_counter-1;
exception
when others then
line_out('</table><br>');
error_position := DBMS_SQL.LAST_ERROR_POSITION;
ErrorPrint(sqlerrm || ' occurred in display_sqlPL');
ActionErrorPrint('Please report the error below to suppo
rt.');
line_out('Position: ' || error_position || ' of ' || le
ngth(p_sql_statement) || '<br>');
line_out(replace(substr(p_sql_statement,1,error_position
),chr(10),'<br>'));
error_position_end := instr(p_sql_statement,' ',error_po
sition+1) - error_position;
line_out('<span class="error">' || replace(substr(p_sql_
statement,error_position+1, error_position_end),chr(10),'<br>') || '</span>');
line_out(replace(substr(p_sql_statement,error_position+e
rror_position_end+1),chr(10),'<br>') || '<br>');
DBMS_SQL.CLOSE_CURSOR(v_cursor_id);
if p_current_exec = 0 then
execute immediate 'alter session set nls_date_fo
rmat = ''' || l_hold_date_format || '''';
end if;
return -1;
end;
end display_sqlPL;
end if;
end RUN_SQLPL;
/*******************************************************************************
******************************************
End of Modified Run_SQL Code. The code was modified to allow the columns to be
displayed in Portrait layout format
********************************************************************************
*****************************************/
--------------------- Addon API end--------------------------------------------
--------------------- CUSTOM API start ----------------------------------------
function get_db_version
return varchar2 is
l_ver varchar2(17);
begin
select max(version) into l_ver from v$instance;
return l_ver;
end get_db_version;
function get_fnd_version
return varchar2 is
l_ver varchar2(50);
begin
select release_name into l_ver from fnd_product_groups where product_group_id
= 1;
return l_ver;
end get_fnd_version;
function check_version(p_ver1 varchar2, p_ver2 varchar2)
return varchar2 is
l_ver1 varchar2(50) := p_ver1;
l_ver2 varchar2(50) := p_ver2;
v1 varchar2(50);
v2 varchar2(50);
begin
if lower(l_ver1) = 'db' then
l_ver1 := get_db_version;
elsif lower(l_ver1) = 'fnd' then
l_ver1 := get_fnd_version;
end if;
if lower(l_ver2) = 'db' then
l_ver2 := get_db_version;
elsif lower(l_ver2) = 'fnd' then
l_ver2 := get_fnd_version;
end if;
l_ver1 := replace(l_ver1,' ','')||'.';
l_ver2 := replace(l_ver2,' ','')||'.';
loop
exit when l_ver1 is null and l_ver2 is null;
v1 := nvl(to_number(substr(l_ver1, 1, instr(l_ver1,'.', 1,1)-1)),0);
v2 := nvl(to_number(substr(l_ver2, 1, instr(l_ver2,'.', 1,1)-1)),0);
if v1>v2 then
return('greater');
end if;
if v1<v2 then
return('lesser');
end if;
l_ver1 := substr(l_ver1, instr(l_ver1,'.',1,1)+1, length(l_ver1)-instr(l_ver1,
'.',1,1)+1);
l_ver2 := substr(l_ver2, instr(l_ver2,'.',1,1)+1, length(l_ver2)-instr(l_ver2,
'.',1,1)+1);
end loop;
return('equal');
exception
when others then
return('error');
end check_version;
procedure show_code(p_code varchar2) is
begin
line_out('<br><span class="code">');
line_out(replace(replace(p_code,chr(10),'<br>'),' ',' '));
line_out('</span><br>');
end show_code;
procedure new_section(p_text varchar2) is
begin
line_out('<hr><center><h3>'||p_text||'</h3></center>');
end new_section;
--------------------- CUSTOM API end ------------------------------------------
begin -- begin1
declare
sqlTxt varchar2(32767);
l_param1 varchar2(100) := '&&1'; --rtrim(ltrim('&&1'));
l_param2 varchar2(100) := '&&2'; --rtrim(ltrim('&&2'));
l_param3 varchar2(100) := '&&3'; --rtrim(ltrim('&&3'));
l_var1 varchar2(4000);
l_var2 varchar2(4000);
l_var3 varchar2(4000);
l_var4 varchar2(4000);
l_var5 varchar2(4000);
l_num1 number;
l_num2 number;
l_num3 number;
l_num4 number;
l_num5 number;
l_date1 date;
l_date2 date;
l_date3 date;
l_date4 date;
l_date5 date;
l_timecard_id number;
l_ovn number;
l_resource_id number;
l_start_date varchar2(11);
l_stop_date varchar2(11);
l_timid number;
begin -- begin2
--Show_Header('9999999.999', '&v_scriptlongname');
Show_Header('9999999.999', '&v_scriptlongname', '&v_headerinfo', '&v_queries_ver
');
sqlTxt := 'select ''&&1'' Parameter1, ''&&2'' Parameter2, ''&&3'' Parameter3 fro
m dual';
run_sql('Parameters', sqltxt);
--new_section('Past Timecards');
sqlTxt := 'select ''HXC.HXC_TC'' Parameter1, resource_id Parameter2, to_char(sta
rt_time, ''DD-MON-YYYY'') Parameter3 from HXC.HXC_TIMECARD_SUMMARY where resourc
e_id = (''&&2'') and start_time > sysdate - 180 order by start_time';
run_sql('Parameters to Output Timecards For Last 6 Months', sqltxt);
end if;
if upper('&&1') = 'HXC.HXC_TEMP' then
-- ************************
-- *** HXC.HXC_TEMP.. Syntax: Parameter1: HXC.HXC_TEMP, Parameter2: <person_id>
, Parameter3: <start date>
-- ************************
sqlTxt := 'select * from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''TIMECARD_T
EMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3'') o
rder by time_building_block_id, object_version_number';
run_sql('HXC.HXC_TIME_BUILDING_BLOCKS - Timecard', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTE_USAGES where time_building_block
_id in (select time_building_block_id from HXC.HXC_time_building_blocks where sc
ope = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) =
to_date(''&&3''))';
run_sql('HXC.HXC_TIME_ATTRIBUTE_USAGES - Timecard', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTES where time_attribute_id in (sel
ect time_attribute_id from HXC.HXC_time_attribute_usages where time_building_blo
ck_id in (select time_building_block_id from HXC.HXC_time_building_blocks where
scope = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time)
= to_date(''&&3''))) order by time_attribute_id';
run_sql('HXC.HXC_TIME_ATTRIBUTES - Timecard', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''DAY'' and
parent_building_block_id in (select time_building_block_id from HXC.HXC_time_bui
lding_blocks where scope = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and
trunc(start_time) = to_date(''&&3'')) order by time_building_block_id, object_v
ersion_number';
run_sql('HXC.HXC_TIME_BUILDING_BLOCKS - Day', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTE_USAGES where time_building_block
_id in (select time_building_block_id from HXC.HXC_time_building_blocks where sc
ope = ''DAY'' and parent_building_block_id in (select time_building_block_id fro
m HXC.HXC_time_building_blocks where scope = ''TIMECARD_TEMPLATE'' and resource_
id = (''&&2'') and trunc(start_time) = to_date(''&&3'')))';
run_sql('HXC.HXC_TIME_ATTRIBUTE_USAGES - Day', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTES where time_attribute_id in (sel
ect time_attribute_id from HXC.HXC_time_attribute_usages where time_building_blo
ck_id in (select time_building_block_id from HXC.HXC_time_building_blocks where
scope = ''DAY'' and parent_building_block_id in (select time_building_block_id f
rom HXC.HXC_time_building_blocks where scope = ''TIMECARD_TEMPLATE'' and resourc
e_id = (''&&2'') and trunc(start_time) = to_date(''&&3'')))) order by time_attri
bute_id';
run_sql('HXC.HXC_TIME_ATTRIBUTES - Day', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''DETAIL'' a
nd parent_building_block_id in (select time_building_block_id from HXC.HXC_time_
building_blocks where scope = ''DAY'' and parent_building_block_id in (select ti
me_building_block_id from HXC.HXC_time_building_blocks where scope = ''TIMECARD_
TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3''))
) order by time_building_block_id, object_version_number';
run_sql('HXC.HXC_TIME_BUILDING_BLOCKS - Detail', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTE_USAGES where time_building_block
_id in (select time_building_block_id from HXC.HXC_time_building_blocks where sc
ope = ''DETAIL'' and parent_building_block_id in (select time_building_block_id
from HXC.HXC_time_building_blocks where scope = ''DAY'' and parent_building_bloc
k_id in (select time_building_block_id from HXC.HXC_time_building_blocks where s
cope = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) =
to_date(''&&3''))))';
run_sql('HXC.HXC_TIME_ATTRIBUTE_USAGES - Detail', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTES where time_attribute_id in (sel
ect time_attribute_id from HXC.HXC_time_attribute_usages where time_building_blo
ck_id in (select time_building_block_id from HXC.HXC_time_building_blocks where
scope = ''DETAIL'' and parent_building_block_id in (select time_building_block_i
d from HXC.HXC_time_building_blocks where scope = ''DAY'' and parent_building_bl
ock_id in (select time_building_block_id from HXC.HXC_time_building_blocks where
scope = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time)
= to_date(''&&3''))))) order by time_attribute_id';
run_sql('HXC.HXC_TIME_ATTRIBUTES - Detail', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_BUILDING_BLOCKS where scope not in (''TIME
CARD'',''DAY'',''DETAIL'') and resource_id = (''&&2'') and trunc(start_time) = t
o_date(''&&3'') order by time_building_block_id, object_version_number';
run_sql('HXC.HXC_TIME_BUILDING_BLOCKS - Other', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTE_USAGES where time_building_block
_id in (select time_building_block_id from HXC.HXC_time_building_blocks where sc
ope not in (''TIMECARD'',''DAY'',''DETAIL'') and resource_id = (''&&2'') and tru
nc(start_time) = to_date(''&&3''))';
run_sql('HXC.HXC_TIME_ATTRIBUTE_USAGES - Other', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIME_ATTRIBUTES where time_attribute_id in (sel
ect time_attribute_id from HXC.HXC_time_attribute_usages where time_building_blo
ck_id in (select time_building_block_id from HXC.HXC_time_building_blocks where
scope not in (''TIMECARD'',''DAY'',''DETAIL'') and resource_id = (''&&2'') and t
runc(start_time) = to_date(''&&3''))) order by time_attribute_id';
run_sql('HXC.HXC_TIME_ATTRIBUTES - Other', sqltxt);
--sqlTxt := 'select * from HXC.HXC_TC_AUDIT_SUMMARY where timecard_id in (select
time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''TIMECA
RD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3'
'))';
--run_sql('HXC.HXC_TC_AUDIT_SUMMARY', sqltxt);
--sqlTxt := 'select * from HXC.HXC_TIMECARD_AUDIT_SUMMARY where timecard_id in (
select time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''
TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(
''&&3''))';
--run_sql('HXC.HXC_TIMECARD_AUDIT_SUMMARY', sqltxt);
sqlTxt := 'select * from HXC.HXC_TIMECARD_SUMMARY where timecard_id in (select t
ime_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''TIMECARD
_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3'')
)';
run_sql('HXC.HXC_TIMECARD_SUMMARY', sqltxt);
sqlTxt := 'select * from HXC.HXC_TC_AP_LINKS where timecard_id in (select time_b
uilding_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''TIMECARD_TEMP
LATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3''))';
run_sql('HXC.HXC_TC_AP_LINKS', sqltxt);
sqlTxt := 'select * from HXC.HXC_APP_PERIOD_SUMMARY where application_period_id
in (select time_building_block_id from HXC.HXC_time_building_blocks where scope
= ''APPLICATION_PERIOD'' and resource_id = (''&&2'') and trunc(start_time) = to_
date(''&&3''))';
run_sql('HXC.HXC_APP_PERIOD_SUMMARY', sqltxt);
sqlTxt := 'select * from HXC.HXC_AP_DETAIL_LINKS where time_building_block_id in
(select time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope =
''DETAIL'' and parent_building_block_id in (select time_building_block_id from H
XC.HXC_time_building_blocks where scope = ''DAY'' and parent_building_block_id i
n (select time_building_block_id from HXC.HXC_time_building_blocks where scope =
''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_da
te(''&&3''))))';
run_sql('HXC.HXC_AP_DETAIL_LINKS', sqltxt);
sqlTxt := 'select * from HXC.HXC_LATEST_DETAILS where time_building_block_id in
(select time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope = '
'DETAIL'' and parent_building_block_id in (select time_building_block_id from HX
C.HXC_time_building_blocks where scope = ''DAY'' and parent_building_block_id in
(select time_building_block_id from HXC.HXC_time_building_blocks where scope =
''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_dat
e(''&&3''))))';
run_sql('HXC.HXC_LATEST_DETAILS', sqltxt);
sqlTxt := 'select * from HXC.HXC_TRANSACTION_DETAILS where time_building_block_i
d in (select time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scop
e = ''DETAIL'' and parent_building_block_id in (select time_building_block_id fr
om HXC.HXC_time_building_blocks where scope = ''DAY'' and parent_building_block_
id in (select time_building_block_id from HXC.HXC_time_building_blocks where sco
pe = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = t
o_date(''&&3''))))';
run_sql('HXC.HXC_TRANSACTION_DETAILS', sqltxt);
sqlTxt := 'select * from HXC.HXC_TRANSACTIONS where transaction_id in (select tr
ansaction_id from HXC.HXC_TRANSACTION_DETAILS where time_building_block_id in (s
elect time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''D
ETAIL'' and parent_building_block_id in (select time_building_block_id from HXC.
HXC_time_building_blocks where scope = ''DAY'' and parent_building_block_id in (
select time_building_block_id from HXC.HXC_time_building_blocks where scope = ''
TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(
''&&3''))))) order by transaction_date';
run_sql('HXC.HXC_TRANSACTIONS', sqltxt);
sqlTxt := 'select * from HXC.HXC_RETRIEVAL_RANGES where transaction_id in (selec
t transaction_id from HXC.HXC_TRANSACTION_DETAILS where time_building_block_id i
n (select time_building_block_id from HXC.HXC_TIME_BUILDING_BLOCKS where scope =
''DETAIL'' and parent_building_block_id in (select time_building_block_id from
HXC.HXC_time_building_blocks where scope = ''DAY'' and parent_building_block_id
in (select time_building_block_id from HXC.HXC_time_building_blocks where scope
= ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_d
ate(''&&3'')))))';
run_sql('HXC.HXC_RETRIEVAL_RANGES', sqltxt);
sqlTxt := 'select * from HXC.HXC_RETRIEVAL_RANGE_RESOURCES where resource_id = (
''&&2'') and retrieval_range_id in (select retrieval_range_id from HXC.HXC_retri
eval_ranges where transaction_id in (select transaction_id from HXC.HXC_TRANSACT
ION_DETAILS where time_building_block_id in (select time_building_block_id from
HXC.HXC_TIME_BUILDING_BLOCKS where scope = ''DETAIL'' and parent_building_block_
id in (select time_building_block_id from HXC.HXC_time_building_blocks where sco
pe = ''DAY'' and parent_building_block_id in (select time_building_block_id from
HXC.HXC_time_building_blocks where scope = ''TIMECARD_TEMPLATE'' and resource_i
d = (''&&2'') and trunc(start_time) = to_date(''&&3''))))))';
run_sql('HXC.HXC_RETRIEVAL_RANGE_RESOURCES', sqltxt);
sqlTxt := 'select * from HXC.HXC_DEPOSIT_PROCESSES where deposit_process_id in (
select transaction_process_id from HXC.HXC_transactions where type = ''DEPOSIT''
and transaction_id in (select transaction_id from HXC.HXC_TRANSACTION_DETAILS w
here time_building_block_id in (select time_building_block_id from HXC.HXC_TIME_
BUILDING_BLOCKS where scope = ''DETAIL'' and parent_building_block_id in (select
time_building_block_id from HXC.HXC_time_building_blocks where scope = ''DAY''
and parent_building_block_id in (select time_building_block_id from HXC.HXC_time
_building_blocks where scope = ''TIMECARD_TEMPLATE'' and resource_id = (''&&2'')
and trunc(start_time) = to_date(''&&3''))))))';
run_sql('HXC.HXC_DEPOSIT_PROCESSES', sqltxt);
sqlTxt := 'select * from HXC.HXC_RETRIEVAL_PROCESSES where retrieval_process_id
in (select transaction_process_id from HXC.HXC_transactions where type = ''RETRI
EVAL'' and transaction_id in (select transaction_id from HXC.HXC_TRANSACTION_DET
AILS where time_building_block_id in (select time_building_block_id from HXC.HXC
_TIME_BUILDING_BLOCKS where scope = ''DETAIL'' and parent_building_block_id in (
select time_building_block_id from HXC.HXC_time_building_blocks where scope = ''
DAY'' and parent_building_block_id in (select time_building_block_id from HXC.HX
C_time_building_blocks where scope = ''TIMECARD_TEMPLATE'' and resource_id = (''
&&2'') and trunc(start_time) = to_date(''&&3''))))))';
run_sql('HXC.HXC_RETRIEVAL_PROCESSES', sqltxt);
sqlTxt := 'select * from HXC.HXC_APPLICATION_SET_COMPS_V where application_set_i
d in (select application_set_id from HXC.HXC_time_building_blocks where scope =
''TIMECARD_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_dat
e(''&&3''))';
run_sql('HXC.HXC_APPLICATION_SET_COMPS_V', sqltxt);
sqlTxt := 'select * from HXC.HXC_APPROVAL_STYLES where approval_style_id in (sel
ect approval_style_id from HXC.HXC_time_building_blocks where scope = ''TIMECARD
_TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3'')
)';
run_sql('HXC.HXC_APPROVAL_STYLES', sqltxt);
sqlTxt := 'select * from HXC.HXC_APPROVAL_COMPS where approval_style_id in (sele
ct approval_style_id from HXC.HXC_time_building_blocks where scope = ''TIMECARD_
TEMPLATE'' and resource_id = (''&&2'') and trunc(start_time) = to_date(''&&3''))
';
run_sql('HXC.HXC_APPROVAL_COMPS', sqltxt);
sqlTxt := 'select * from nuan_per_people_f_mv where person_id = (''&&2'') order
by effective_start_date';
run_sql('nuan_per_people_f_mv', sqltxt);
sqlTxt := 'select * from PER_ALL_ASSIGNMENTS_F where person_id = (''&&2'') order
by effective_start_date';
run_sql('PER_ALL_ASSIGNMENTS_F', sqltxt);
sqlTxt := '
select ''TC Details'' source, sum(det.measure) total
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_time_attribute_usages use
, HXC.HXC_time_attributes att
where sum.resource_id = (''&&2'')
and trunc(sum.start_time) = to_date(''&&3'')
and tim.time_building_block_id = sum.timecard_id
and tim.object_version_number = sum.timecard_ovn
and day.parent_building_block_id = tim.time_building_block_id
and day.parent_building_block_ovn = tim.object_version_number
and det.parent_building_block_id = day.time_building_block_id
and det.parent_building_block_ovn = day.object_version_number
and det.date_to = to_date(''31-DEC-4712'')
and use.time_building_block_id = det.time_building_block_id
and use.time_building_block_ovn = det.object_version_number
and att.time_attribute_id = use.time_attribute_id
and att.attribute_category = ''PROJECTS''
UNION ALL
select ''TC Summary'' source, sum(recorded_hours) total
from HXC.HXC_timecard_summary sum
where sum.resource_id = (''&&2'')
and trunc(sum.start_time) = to_date(''&&3'')
UNION ALL
select ''PA Expenditures'' source, sum(exp.quantity) total
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_time_attribute_usages use
, HXC.HXC_time_attributes att
, pa_expenditure_items_all exp
where sum.resource_id = (''&&2'')
and trunc(sum.start_time) = to_date(''&&3'')
and tim.time_building_block_id = sum.timecard_id
and tim.object_version_number = sum.timecard_ovn
and day.parent_building_block_id = tim.time_building_block_id
and day.parent_building_block_ovn = tim.object_version_number
and det.parent_building_block_id = day.time_building_block_id
-- and det.parent_building_block_ovn = day.object_version_number
-- and det.date_to = to_date(''31-DEC-4712'')
and use.time_building_block_id = det.time_building_block_id
and use.time_building_block_ovn = det.object_version_number
and att.time_attribute_id = use.time_attribute_id
and att.attribute_category = ''PROJECTS''
and det.time_building_block_id || '':'' || det.object_version_number = exp.or
ig_transaction_reference (+)';
run_sql('OTL/PA Totals Compare', sqltxt);
sqlTxt := 'select ''HXC.HXC_TC'' Parameter1, resource_id Parameter2, to_char(sta
rt_time, ''DD-MON-YYYY'') Parameter3 from HXC.HXC_TIMECARD_SUMMARY where resourc
e_id = (''&&2'') and start_time > sysdate - 180 order by start_time';
run_sql('Parameters to Output Timecards For Last 6 Months', sqltxt);
end if;
if upper('&&1') = 'HXC.HXC_APPROVAL_STYLE'
or upper('&&1') = 'HXC.HXC_APPROVAL_STYLES'
then
-- ************************
-- *** HXC.HXC_APPROVAL_STYLE.. Syntax: Parameter1: HXC.HXC_APPROVAL_STYLE Par
ameter2: <approval_style_id> Parameter3: 0
-- ************************
Display_Table('HXC.HXC_APPROVAL_STYLES', null, 'where approval_style_id
= (''&&2'')', null, 'Y');
select count(1)
into l_num1
from HXC.HXC_DATA_APP_RULE_USAGES
where approval_style_id = '&&2';
if l_num1 > 0 then
new_section('Approval Rules');
Display_Table('HXC.HXC_DATA_APP_RULE_USAGES', null, 'where approval_style_i
d = (''&&2'')', 'order by time_recipient_id, object_version_number', 'Y');
Display_Table('HXC.HXC_TIME_RECIPIENTS', null, 'where time_recipient_i
d in (select time_recipient_id from HXC.HXC_DATA_APP_RULE_USAGES where approval_
style_id = (''&&2''))', 'order by time_recipient_id, object_version_number', 'Y'
);
end if;
select count(1)
into l_num1
from HXC.HXC_APPROVAL_COMPS
where approval_style_id = '&&2'
and time_recipient_id = -1;
if l_num1 > 0 then
new_section('Entry Level Approval Components');
Display_Table('HXC.HXC_APPROVAL_COMPS', 'HXC.HXC_APPROVAL_COMPS - Def
ault Entry Level Approval Style', 'where approval_style_id = (''&&2'') and time_
recipient_id = -1 and time_category_id = 0', 'order by approval_comp_id, parent_
comp_id, parent_comp_ovn', 'Y');
Display_Table('HXC.HXC_APPROVAL_COMPS', 'HXC.HXC_APPROVAL_COMPS - Ent
ry Level Components', 'where approval_style_id = (''&&2'') and time_recipient_id
= -1 and time_category_id <> 0', 'order by approval_comp_id, parent_comp_id, pa
rent_comp_ovn', 'Y');
Display_Table('HXC.HXC_TIME_CATEGORIES', null, 'where time_category_id
in (select time_category_id from HXC.HXC_APPROVAL_COMPS where approval_style_id
= (''&&2''))', 'order by time_category_id', 'Y');
Display_Table('HXC.HXC_TIME_CATEGORY_COMPS', null, 'where time_category_id
in (select time_category_id from HXC.HXC_APPROVAL_COMPS where approval_style_id
= (''&&2''))', 'order by time_category_id, time_category_comp_id', 'Y');
Display_Table('HXC.HXC_TIME_CATEGORY_COMPS_V', null, 'where time_category_id
in (select time_category_id from HXC.HXC_APPROVAL_COMPS where approval_style_id
= (''&&2''))', 'order by time_category_id, time_category_comp_id', 'Y');
Display_Table('HXC.HXC_TIME_CATEGORY_COMP_SQL', null, 'where time_category_co
mp_id in (select time_category_comp_id from HXC.HXC_time_category_comps where ti
me_category_id in (select time_category_id from HXC.HXC_APPROVAL_COMPS where app
roval_style_id = (''&&2'')))', null, 'Y');
Display_Table('HXC.HXC_MAPPING_COMPONENTS', null, 'where mapping_componen
t_id in (select mapping_component_id from HXC.HXC_time_category_comps where time
_category_id in (select time_category_id from HXC.HXC_APPROVAL_COMPS where appro
val_style_id = (''&&2'')))', 'order by mapping_component_id', 'Y');
Display_Table('FND_FLEX_VALUE_SETS', null, 'where flex_value_set_id in
(select flex_value_set_id from HXC.HXC_TIME_CATEGORY_COMPS where time_category_
id in (select time_category_id from HXC.HXC_APPROVAL_COMPS where approval_style_
id = (''&&2'')))', 'order by flex_value_set_id', 'Y');
Display_Table('FND_FLEX_VALIDATION_TABLES', null, 'where flex_value_set_id in
(select flex_value_set_id from HXC.HXC_TIME_CATEGORY_COMPS where time_category_
id in (select time_category_id from HXC.HXC_APPROVAL_COMPS where approval_style_
id = (''&&2'')))', 'order by flex_value_set_id', 'Y');
end if;
new_section('Other Attributes');
Display_Table('HXC.HXC_APP_COMP_NOTIF_USAGES', null, 'where approval_comp_id i
n (select approval_comp_id from HXC.HXC_APPROVAL_COMPS where approval_style_id =
(''&&2''))', 'order by approval_comp_id, approval_comp_ovn, comp_notification_i
d', 'Y');
Display_Table('HXC.HXC_APP_COMP_NOTIFICATIONS', null, 'where (comp_notification
_id, object_version_number) in (select comp_notification_id, comp_notification_o
vn from HXC.HXC_APP_COMP_NOTIF_USAGES where approval_comp_id in (select approval
_comp_id from HXC.HXC_APPROVAL_COMPS where approval_style_id = (''&&2'')))', 'or
der by comp_notification_id, object_version_number', 'Y');
sqlTxt := '
select approval_comp_id, object_version_number
from HXC.HXC_approval_comps
where approval_style_id = (''&&2'')
and (approval_comp_id, object_version_number) not in
(select approval_comp_id, approval_comp_ovn
from HXC.HXC_app_comp_notif_usages)
order by approval_comp_id
';
run_sql('HXC.HXC_APPROVAL_COMPS Without Other Attributes', sqltxt);
-- Still need to output Time Entry Rules for Approval Rules and preference usage
s.
end if;
if upper('&&1') = 'HXC.HXC_TO_BEE' then
-- ************************
-- *** HXC.HXC_TO_BEE................ Syntax: Parameter1: HXC.HXC_TO_BEE , Para
meter2: <request_id>, Parameter3:
-- ************************
Display_Table('FND_CONCURRENT_REQUESTS', null, 'where request_id in (''&&2'')',
'order by request_id', 'Y');
Display_Table('HXC.HXC_RETRIEVAL_RANGES', null, 'where conc_request_id in ('
'&&2'')', 'order by conc_request_id', 'Y');
Display_Table('HXC.HXC_TRANSACTIONS', null, 'where transaction_id in (se
lect distinct transaction_id from HXC.HXC_RETRIEVAL_RANGES where conc_request_id
in (''&&2''))', null, 'Y');
sqlTxt := 'select transaction_id, status, exception_description, count(1)
from HXC.HXC_TRANSACTION_DETAILS
where transaction_id in (select distinct transaction_id
from HXC.HXC_RETRIEVAL_RANGES
where conc_request_id in (''&&2''))
group by transaction_id, status, exception_description';
run_sql('HXC.HXC_TRANSACTION_DETAILS - Count', sqltxt);
Display_Table('PAY_BATCH_HEADERS', 'PAY_BATCH_HEADERS - Time Store', 'wh
ere batch_source in (''Time Store'') and trunc(creation_date) in (select trunc(c
reation_date) from HXC.HXC_RETRIEVAL_RANGES where conc_request_id in (''&&2''))'
, null, 'Y');
Display_Table('PAY_BATCH_HEADERS', 'PAY_BATCH_HEADERS - OTM', 'wh
ere batch_source in (''OTM'') and trunc(creation_date) in (select trunc(creation
_date) from HXC.HXC_RETRIEVAL_RANGES where conc_request_id in (''&&2''))', null,
'Y');
Display_Table('HXC.HXC_DEBUG_TEXT', null, null, null, 'N');
Display_Profiles(808,null);
Display_Profiles(809,null);
end if;
if upper('&&1') = 'OTL_WF'
then
-- ************************
-- *** OTL_WF.. Syntax: Parameter1: OTL_WF Parameter2: <item_key> Parameter3:
0
-- ************************
Display_Table('WF_ITEMS', null, 'where item_key in (''&&2'')
', null, 'Y');
Display_Table('WF_ITEM_INFO', null, 'where item_key in (''&&2'')
', null, 'Y');
sqlTxt := 'select
ITEM_TYPE
, ITEM_KEY
, NAME
, TEXT_VALUE
, NUMBER_VALUE
, DATE_VALUE
--, EVENT_VALUE
,SECURITY_GROUP_ID
from WF_ITEM_ATTRIBUTE_VALUES where item_key = (''&&2'')
order by NAME';
run_sql('WF_ITEM_ATTRIBUTE_VALUES', sqltxt);
sqlTxt := 'select
ITEM_TYPE
, ITEM_KEY
, PROCESS_ACTIVITY
, ACTIVITY_STATUS
, ACTIVITY_RESULT_CODE
, ASSIGNED_USER
, NOTIFICATION_ID
, BEGIN_DATE
, END_DATE
, EXECUTION_TIME
, ERROR_NAME
, ERROR_MESSAGE
, ERROR_STACK
--, OUTBOUND_QUEUE_ID
, DUE_DATE
, SECURITY_GROUP_ID
, ACTION
, PERFORMED_BY
from WF_ITEM_ACTIVITY_STATUSES where item_key = (''&&2'')
order by PROCESS_ACTIVITY';
run_sql('WF_ITEM_ACTIVITY_STATUSES', sqltxt);
sqlTxt := 'select
ITEM_TYPE
, ITEM_KEY
, PROCESS_ACTIVITY
, ACTIVITY_STATUS
, ACTIVITY_RESULT_CODE
, ASSIGNED_USER
, NOTIFICATION_ID
, BEGIN_DATE
, END_DATE
, EXECUTION_TIME
, ERROR_NAME
, ERROR_MESSAGE
, ERROR_STACK
--, OUTBOUND_QUEUE_ID
, DUE_DATE
, SECURITY_GROUP_ID
, ACTION
, PERFORMED_BY
from WF_ITEM_ACTIVITY_STATUSES_H where item_key = (''&&2'')
order by PROCESS_ACTIVITY';
run_sql('WF_ITEM_ACTIVITY_STATUSES_H', sqltxt);
Display_Table('WF_NOTIFICATIONS', null, 'where item_key in (''&&2'')
', null, 'Y');
end if;
end if;
if upper('&&1') = 'OTC_INFO_TYPES' then
-- ************************
-- *** OTC_INFO_TYPES........... Syntax: Parameter1: OTC_INFO_TYPES Parameter2
: <context> Parameter3: 0
-- ************************
Display_Table('FND_DESCRIPTIVE_FLEXS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' ', null, 'Y');
Display_Table('FND_DESCRIPTIVE_FLEXS_VL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' ', null, 'Y');
Display_Table('FND_DESCRIPTIVE_FLEXS_TL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' ', null, 'Y');
Display_Table('FND_TABLES', null, 'where (table_name, applic
ation_id) in (select application_table_name, application_id from FND_DESCRIPTIVE
_FLEXS where DESCRIPTIVE_FLEXFIELD_NAME = ''OTC Information Types'')', null, 'Y'
);
Display_Table('FND_DESCR_FLEX_CONTEXTS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', 'order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS_VL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS_TL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_COLUMN_USAGES', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(substr(AP
PLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_DESCR_FLEX_COL_USAGE_VL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(substr(AP
PLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_DESCR_FLEX_COL_USAGE_TL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper(''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(substr(AP
PLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_FLEX_VALUE_SETS', null, 'where flex_value_set_id i
n (select flex_value_set_id from fnd_descr_flex_column_usages where DESCRIPTIVE_
FLEXFIELD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CO
DE) like upper(''&&2''))', null, 'Y');
Display_Table('FND_FLEX_VALIDATION_TABLES', null, 'where flex_value_set_id i
n (select flex_value_set_id from fnd_descr_flex_column_usages where DESCRIPTIVE_
FLEXFIELD_NAME = ''OTC Information Types'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CO
DE) like upper(''&&2''))', null, 'Y');
Display_Table('FND_COLUMNS', null, 'where (column_name, table
_id) in (select a.application_column_name, b.table_id from FND_DESCR_FLEX_COL_US
AGE_VL A, FND_TABLES B, FND_DESCRIPTIVE_FLEXS C where C.DESCRIPTIVE_FLEXFIELD_NA
ME = ''OTC Information Types'' and a.descriptive_flexfield_name = c.descriptive_
flexfield_name and c.application_table_name = b.table_name and c.application_id
= b.application_id)', null, 'Y');
Display_Table('FND_DEFAULT_CONTEXT_FIELDS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = ''OTC Information Types'' ', null, 'Y');
end if;
if upper('&&1') = 'FND_DESC_FLEX' then
-- ************************
-- *** FND_DESC_FLEX........... Syntax: Parameter1: FND_DESC_FLEX Parameter2:
<descriptive_flexfield_name> Parameter3: 0
-- ************************
Display_Table('FND_DESCRIPTIVE_FLEXS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'') ', null, 'Y');
Display_Table('FND_DESCRIPTIVE_FLEXS_VL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'') ', null, 'Y');
Display_Table('FND_DESCRIPTIVE_FLEXS_TL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'') ', null, 'Y');
Display_Table('FND_TABLES', null, 'where (table_name, applic
ation_id) in (select application_table_name, application_id from FND_DESCRIPTIVE
_FLEXS where DESCRIPTIVE_FLEXFIELD_NAME = (''&&2''))', null, 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', 'order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS_VL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS_TL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_COLUMN_USAGES', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(substr
(APPLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_DESCR_FLEX_COL_USAGE_VL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(substr
(APPLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_DESCR_FLEX_COL_USAGE_TL', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(substr
(APPLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_FLEX_VALUE_SETS', null, 'where flex_value_set_id i
n (select flex_value_set_id from fnd_descr_flex_column_usages where DESCRIPTIVE_
FLEXFIELD_NAME = (''&&2''))', null, 'Y');
Display_Table('FND_FLEX_VALIDATION_TABLES', null, 'where flex_value_set_id i
n (select flex_value_set_id from fnd_descr_flex_column_usages where DESCRIPTIVE_
FLEXFIELD_NAME = (''&&2''))', null, 'Y');
Display_Table('FND_COLUMNS', null, 'where (column_name, table
_id) in (select a.application_column_name, b.table_id from FND_DESCR_FLEX_COL_US
AGE_VL A, FND_TABLES B, FND_DESCRIPTIVE_FLEXS C where C.DESCRIPTIVE_FLEXFIELD_NA
ME = (''&&2'') and a.descriptive_flexfield_name = c.descriptive_flexfield_name a
nd c.application_table_name = b.table_name and c.application_id = b.application_
id)', null, 'Y');
Display_Table('FND_DEFAULT_CONTEXT_FIELDS', null, 'where DESCRIPTIVE_FLEXFIE
LD_NAME = (''&&2'') ', null, 'Y');
end if;
if upper('&&1') = 'PA_NOT_XFR' then
-- ************************
-- *** PA_NOT_XFR........... Syntax: Parameter1: PA_NOT_XFR Parameter2: <since
date formatted 01-Jan-2008> Parameter3: 0
-- ************************
sqlTxt := 'select * from HXC.HXC_TIMECARD_SUMMARY where timecard_id in (
select sum.timecard_id
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_application_set_comps_v app
where sum.approval_status = ''APPROVED''
and sum.timecard_id = tim.time_building_block_id
and sum.timecard_ovn = tim.object_version_number
and tim.application_set_id = app.application_set_id
and upper(app.time_recipient_name) in (''PROJECTS'')
and not exists ( select 1
from HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_transaction_details trx_det
, HXC.HXC_transactions trx
where sum.timecard_id = day.parent_building_block_id
and sum.timecard_ovn = day.parent_building_block_ovn
and day.time_building_block_id = det.parent_building_block
_id
and day.object_version_number = det.parent_building_block_
ovn
and det.time_building_block_id = trx_det.time_building_blo
ck_id
and det.object_version_number = trx_det.time_building_bloc
k_ovn
and trx_det.transaction_id = trx.transaction_id
and trx.status = ''SUCCESS''
and trx.type = ''RETRIEVAL''
and trx.transaction_process_id = 1 )
and sum.start_time > to_date(''&&2'')
)
order by start_time, resource_id';
run_sql('HXC.HXC_TIMECARD_SUMMARY', sqltxt);
end if;
if upper('&&1') = 'PROJECT_USAGE' then
-- ************************
-- *** PROJECT_USAGE........... Syntax: Parameter1: PROJECT_USAGE Parameter2:
<Project_Id> Parameter3: 0
-- ************************
Display_Table('PA_PROJECTS_ALL', null, 'where project_id in (''&
&2'')', null, 'Y');
sqlTxt := 'select count(1) count
from HXC.HXC_time_attributes
where attribute_category = ''PROJECTS''
and attribute1 in (''&&2'')';
run_sql('Number Of Lines In OTL', sqltxt);
sqlTxt := 'select count(1) count
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_time_attribute_usages tau
, HXC.HXC_time_attributes ta
where sum.timecard_id = tim.time_building_block_id
and sum.timecard_ovn = tim.object_version_number
and tim.time_building_block_id = day.parent_building_block_id
and tim.object_version_number = day.parent_building_block_ovn
and day.time_building_block_id = det.parent_building_block_id
and day.object_version_number = det.parent_building_block_ovn
and det.time_building_block_id = tau.time_building_block_id
and det.object_version_number = tau.time_building_block_ovn
and tau.time_attribute_id = ta.time_attribute_id
and ta.attribute_category = ''PROJECTS''
and ta.attribute1 in (''&&2'')
and not exists
( select 1
from HXC.HXC_transaction_details trx_det
, HXC.HXC_transactions trx
where det.time_building_block_id = trx_det.time_building_block_id
and det.object_version_number = trx_det.time_building_block_ovn
and trx_det.transaction_id = trx.transaction_id
and trx.status = ''SUCCESS''
and trx.type = ''RETRIEVAL''
and trx.transaction_process_id = 1 )';
run_sql('Number Of Lines Not Transferred to Projects', sqltxt);
sqlTxt := 'select approval_status, count(1) count
from HXC.HXC_timecard_summary
where timecard_id in (
select distinct sum.timecard_id
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_time_attribute_usages tau
, HXC.HXC_time_attributes ta
where sum.timecard_id = tim.time_building_block_id
and sum.timecard_ovn = tim.object_version_number
and tim.time_building_block_id = day.parent_building_block_id
and tim.object_version_number = day.parent_building_block_ovn
and day.time_building_block_id = det.parent_building_block_id
and day.object_version_number = det.parent_building_block_ovn
and det.time_building_block_id = tau.time_building_block_id
and det.object_version_number = tau.time_building_block_ovn
and tau.time_attribute_id = ta.time_attribute_id
and ta.attribute_category = ''PROJECTS''
and ta.attribute1 in (''&&2'')
and not exists
( select 1
from HXC.HXC_transaction_details trx_det
, HXC.HXC_transactions trx
where det.time_building_block_id = trx_det.time_building_block_id
and det.object_version_number = trx_det.time_building_block_ovn
and trx_det.transaction_id = trx.transaction_id
and trx.status = ''SUCCESS''
and trx.type = ''RETRIEVAL''
and trx.transaction_process_id = 1 ))
group by approval_status
order by decode(approval_status, ''APPROVED'', 1, ''SUBMITTED'', 2, ''WORKING'',
3, ''ERROR'', 4, 0.5)';
run_sql('Number Of Timecards Not Transferred By Approval_Status', sqltxt);
SectionPrint('Parameters To Output The Top 10 Timecards Not Transferred By Appro
val_Status');
for l_num1 in 1..4 loop
select decode(l_num1, 1, 'APPROVED', 2, 'SUBMITTED', 3, 'WORKING', 4, 'ERROR') i
nto l_var1 from dual;
sqlTxt := 'select ''OTL_Diag'' Script, ''HXC.HXC_TC'' Parameter1, resource_id Pa
rameter2, to_char(start_time, ''DD-MON-YYYY'') Parameter3
from HXC.HXC_timecard_summary
where timecard_id in (
select distinct sum.timecard_id
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_time_attribute_usages tau
, HXC.HXC_time_attributes ta
where sum.timecard_id = tim.time_building_block_id
and sum.timecard_ovn = tim.object_version_number
and tim.time_building_block_id = day.parent_building_block_id
and tim.object_version_number = day.parent_building_block_ovn
and day.time_building_block_id = det.parent_building_block_id
and day.object_version_number = det.parent_building_block_ovn
and det.time_building_block_id = tau.time_building_block_id
and det.object_version_number = tau.time_building_block_ovn
and tau.time_attribute_id = ta.time_attribute_id
and ta.attribute_category = ''PROJECTS''
and ta.attribute1 in (''&&2'')
and not exists
( select 1
from HXC.HXC_transaction_details trx_det
, HXC.HXC_transactions trx
where det.time_building_block_id = trx_det.time_building_block_id
and det.object_version_number = trx_det.time_building_block_ovn
and trx_det.transaction_id = trx.transaction_id
and trx.status = ''SUCCESS''
and trx.type = ''RETRIEVAL''
and trx.transaction_process_id = 1 ))
and approval_status = '''||l_var1||'''
and rownum < 11
order by timecard_id desc, approval_status, resource_id, start_time';
run_sql(l_var1, sqltxt);
end loop;
end if;
if upper('&&1') = 'TABLES' then
-- ************************
-- *** Tables........... Syntax: Parameter1: Tables Parameter2: <table_name>
Parameter3: 0
-- ************************
sqlTxt := 'select * from ALL_TABLES where table_name in upper(''&&2'') ord
er by owner';
run_sql('ALL_TABLES', sqltxt);
sqlTxt := 'select * from DBA_TAB_PRIVS where (owner, table_name) in (select o
wner, table_name from all_tables where table_name in upper(''&&2'')) order by ow
ner';
run_sql('DBA_TAB_PRIVS', sqltxt);
sqlTxt := 'select * from DBA_COL_PRIVS where (owner, table_name) in (select o
wner, table_name from all_tables where table_name in upper(''&&2'')) order by ow
ner';
run_sql('DBA_COL_PRIVS', sqltxt);
sqlTxt := 'select * from DBA_EXTENTS where (owner, segment_name) in (select
owner, table_name from all_tables where table_name in upper(''&&2'')) order by
extent_id';
run_sql('DBA_EXTENTS', sqltxt);
sqlTxt := 'select * from ALL_TAB_COLUMNS where (owner, table_name) in (select o
wner, table_name from all_tables where table_name in upper(''&&2'')) order by ow
ner, column_id';
run_sql('ALL_TAB_COLUMNS', sqltxt);
sqlTxt := 'select * from ALL_TRIGGERS where (table_owner, table_name) in (se
lect owner, table_name from all_tables where table_name in upper(''&&2'')) order
by table_owner, trigger_name';
run_sql('ALL_TRIGGERS', sqltxt);
sqlTxt := 'select * from ALL_SYNONYMS where (table_owner, table_name) in (se
lect owner, table_name from all_tables where table_name in upper(''&&2'')) order
by table_owner';
run_sql('ALL_SYNONYMS', sqltxt);
sqlTxt := 'select * from ALL_INDEXES where (table_owner, table_name) in (se
lect owner, table_name from all_tables where table_name in upper(''&&2'')) order
by table_owner, index_name';
run_sql('ALL_INDEXES', sqltxt);
sqlTxt := 'select * from ALL_IND_COLUMNS where (table_owner, table_name) in (se
lect owner, table_name from all_tables where table_name in upper(''&&2'')) order
by table_owner, index_owner, index_name, column_position';
run_sql('ALL_IND_COLUMNS', sqltxt);
sqlTxt := 'select * from ALL_CONSTRAINTS where table_name in upper(''&&2'') ord
er by owner,table_name,constraint_name';
run_sql('ALL_CONSTRAINTS', sqltxt);
sqlTxt := 'select * from ALL_CONS_COLUMNS where table_name in upper(''&&2'') ord
er by owner,table_name,constraint_name';
run_sql('ALL_CONS_COLUMNS', sqltxt);
sqlTxt := 'select * from ALL_POLICIES where object_name in upper(''&&2'')';
run_sql('ALL_POLICIES', sqltxt);
sqlTxt := 'select * from DBA_TABLESPACES where tablespace_name in (select table
space_name from all_tables where table_name in upper(''&&2''))';
run_sql('DBA_TABLESPACES', sqltxt);
sqlTxt := 'select * from DBA_FREE_SPACE where tablespace_name in (select table
space_name from all_tables where table_name in upper(''&&2'')) order by tablespa
ce_name, bytes desc';
run_sql('DBA_FREE_SPACE', sqltxt);
end if;
if upper('&&1') = 'FND_CONC_REQ' then
-- ************************
-- *** FND_Conc_Req..... Syntax: Parameter1: FND_Conc_Req Parameter2: <request
_id> Parameter3: 0
-- ************************
sqlTxt := 'select * from FND_CONCURRENT_REQUESTS where request_id in (''&&2'')
order by request_id';
run_sql('FND_CONCURRENT_REQUESTS', sqltxt);
--Display_Table('FND_CONCURRENT_REQUESTS', null, 'where request_id in
(''&&2'')', null, 'Y');
--Display_Table('FND_CONCURRENT_REQUESTS', null, 'where request_id in
(select parent_request_id from fnd_concurrent_requests where parent_request_id
!= -1 and request_id in (''&&2'') UNION select priority_request_id from fnd_conc
urrent_requests where request_id in (''&&2''))', null, 'Y');
--Display_Table('FND_CONCURRENT_PROGRAMS', null, 'where (application_
id, concurrent_program_id) in (select program_application_id, concurrent_program
_id from fnd_concurrent_requests where request_id in (select request_id from fnd
_concurrent_requests where request_id in (''&&2'') UNION select parent_request_i
d from fnd_concurrent_requests where parent_request_id != -1 and request_id in (
''&&2'') UNION select priority_request_id from fnd_concurrent_requests where req
uest_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_CONC_REQUEST_ARGUMENTS', null, 'where request_id in
(''&&2'')', null, 'Y');
--Display_Table('FND_CONCURRENT_PROCESSES', null, 'where concurrent_pr
ocess_id in (select controlling_manager from fnd_concurrent_requests where reque
st_id in (''&&2''))', null, 'Y');
--Display_Table('FND_CONCURRENT_QUEUES', null, 'where CONCURRENT_QU
EUE_ID in (select CONCURRENT_QUEUE_ID from fnd_concurrent_processes where concur
rent_process_id in (select controlling_manager from fnd_concurrent_requests wher
e request_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_CONCURRENT_QUEUES_TL', null, 'where CONCURRENT_QU
EUE_ID in (select CONCURRENT_QUEUE_ID from fnd_concurrent_processes where concur
rent_process_id in (select controlling_manager from fnd_concurrent_requests wher
e request_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_CONCURRENT_QUEUE_CONTENT', null, 'where CONCURRENT_QU
EUE_ID in (select CONCURRENT_QUEUE_ID from fnd_concurrent_processes where concur
rent_process_id in (select controlling_manager from fnd_concurrent_requests wher
e request_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_USER', null, 'where user_id in (s
elect requested_by from fnd_concurrent_requests where request_id in (select requ
est_id from fnd_concurrent_requests where request_id in (''&&2'') UNION select p
arent_request_id from fnd_concurrent_requests where parent_request_id != -1 and
request_id in (''&&2'') UNION select priority_request_id from fnd_concurrent_req
uests where request_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_LOGINS', null, 'where login_id in (
select conc_login_id from fnd_concurrent_requests where request_id in (select re
quest_id from fnd_concurrent_requests where request_id in (''&&2'') UNION select
parent_request_id from fnd_concurrent_requests where parent_request_id != -1 an
d request_id in (''&&2'') UNION select priority_request_id from fnd_concurrent_r
equests where request_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_RESPONSIBILITY', null, 'where (application_
id, responsibility_id) in (select responsibility_application_id, responsibility_
id from fnd_concurrent_requests where request_id in (select request_id from fnd_
concurrent_requests where request_id in (''&&2'') UNION select parent_request_id
from fnd_concurrent_requests where parent_request_id != -1 and request_id in ('
'&&2'') UNION select priority_request_id from fnd_concurrent_requests where requ
est_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_RESPONSIBILITY_TL', null, 'where (application_
id, responsibility_id) in (select responsibility_application_id, responsibility_
id from fnd_concurrent_requests where request_id in (select request_id from fnd_
concurrent_requests where request_id in (''&&2'') UNION select parent_request_id
from fnd_concurrent_requests where parent_request_id != -1 and request_id in ('
'&&2'') UNION select priority_request_id from fnd_concurrent_requests where requ
est_id in (''&&2'')))', null, 'Y');
--Display_Table('FND_ORACLE_USERID', null, 'where oracle_id in
(select oracle_id from fnd_concurrent_requests where request_id in (select reque
st_id from fnd_concurrent_requests where request_id in (''&&2'') UNION select pa
rent_request_id from fnd_concurrent_requests where parent_request_id != -1 and r
equest_id in (''&&2'') UNION select priority_request_id from fnd_concurrent_requ
ests where request_id in (''&&2'')))', null, 'Y');
end if;
if upper('&&1') = 'PROGRAM' then
-- ************************
-- *** Program.......... Syntax: Parameter1: Program Parameter2: <concurrent_p
rogram_name> Parameter3: 0
-- ************************
Display_Table('FND_APPLICATION', null, 'where app
lication_id in (select application_id from FND_CONCURRENT_PROGRAMS where concurr
ent_program_name = (''&&2''))', null, 'Y');
Display_Table('FND_CONCURRENT_PROGRAMS', null, 'where con
current_program_name = (''&&2'')', null, 'Y');
Display_Table('FND_CONCURRENT_PROGRAMS_TL', null, 'where con
current_program_id in (select concurrent_program_id from fnd_concurrent_programs
where concurrent_program_name = (''&&2''))', null, 'Y');
Display_Table('FND_EXECUTABLES', null, 'where (EX
ECUTABLE_ID, APPLICATION_ID) in (select executable_id, application_id from FND_C
ONCURRENT_PROGRAMS where concurrent_program_name = (''&&2''))', null, 'Y');
Display_Table('FND_EXECUTABLES_TL', null, 'where (EX
ECUTABLE_ID, APPLICATION_ID) in (select executable_id, application_id from FND_C
ONCURRENT_PROGRAMS where concurrent_program_name = (''&&2''))', null, 'Y');
Display_Table('FND_DESCR_FLEX_COLUMN_USAGES', null, 'where des
criptive_flexfield_name = ''$SRS$.&&2''', 'order by column_seq_num', 'Y');
Display_Table('FND_FLEX_VALUE_SETS', null, 'where fle
x_value_set_id in (select flex_value_set_id from fnd_descr_flex_column_usages wh
ere descriptive_flexfield_name = ''$SRS$.&&2'')', null, 'Y');
Display_Table('FND_FLEX_VALIDATION_TABLES', null, 'where fle
x_value_set_id in (select flex_value_set_id from fnd_descr_flex_column_usages wh
ere descriptive_flexfield_name = ''$SRS$.&&2'')', null, 'Y');
Display_Table('FND_CONCURRENT_PROGRAM_SERIAL', null, 'where (ru
nning_application_id, running_concurrent_program_id) in (select application_id,
concurrent_program_id from fnd_concurrent_programs where concurrent_program_name
in (''&&2''))', null, 'Y');
Display_Table('FND_CONCURRENT_PROGRAMS', 'Incompatibles', 'where (ap
plication_id, concurrent_program_id) in (select to_run_application_id, to_run_co
ncurrent_program_id from fnd_concurrent_program_serial where (running_applicatio
n_id, running_concurrent_program_id) in (select application_id, concurrent_progr
am_id from fnd_concurrent_programs where concurrent_program_name in (''&&2'')))'
, null, 'Y');
select upper(substr(execution_file_name, 1, instr(execution_file_name,'.')-1))
into l_var1
from FND_EXECUTABLES
where(EXECUTABLE_ID, APPLICATION_ID) in (select executable_id, application_id fr
om FND_CONCURRENT_PROGRAMS where concurrent_program_name = ('&&2'));
Display_Table('ALL_OBJECTS', null, 'where obj
ect_name = '''||l_var1||'''', null, 'Y');
Display_Table('ALL_SOURCE', null, 'where nam
e = '''||l_var1||''' and line = 2', null, 'Y');
Display_Table('ALL_ERRORS', null, 'where nam
e = '''||l_var1||''' and line = 2', null, 'Y');
end if;
if upper('&&1') = 'FND_MESSAGES' then
-- ************************
-- *** FND_MESSAGES..... Syntax: Parameter1: FND_MESSAGES Parameter2: <applica
tion_id> Parameter3: 0
-- ************************
Display_Table('FND_NEW_MESSAGES', null, 'where application_id in (''&
&2'')', null, 'Y');
end if;
if upper('&&1') = 'PROFILES' then
-- ************************
-- *** PROFILES..... Syntax: Parameter1: PROFILES Parameter2: <application_id>
Parameter3: <profile short name>
-- ************************
if l_param3 <> '0' then
Display_Profiles(null, l_param3);
else
Display_Profiles(l_param2,null);
end if;
end if;
if upper('&&1') = 'HR_FORMULAS' then
-- ************************
-- *** HR_Formulas...... Syntax: Parameter1: HR_FORMULAS Parameter2: 0 Parame
ter3: 0
-- ************************
Display_Table('FF_FORMULAS_F', null, 'where 1=1', 'orde
r by formula_id', 'N');
end if;
if upper('&&1') = 'OTL_FORMULAS' then
-- ************************
-- *** OTL_Formulas...... Syntax: Parameter1: OTL_FORMULAS Parameter2: 0 Para
meter3: 0
-- ************************
Display_Table('FF_FORMULAS_F', null, 'where Formula_Nam
e like (''HXC.HXC%'')', 'order by formula_id', 'N');
end if;
if upper('&&1') = 'OTL_FORMULA' then
-- ************************
-- *** OTL_Formula....... Syntax: Parameter1: OTL_FORMULA Parameter2: <formula
_name> Parameter3: <formula_id>
-- ************************
if l_param3 <> 0 then
l_num1 := l_param3;
else
select min(formula_id)
into l_num1
from FF_FORMULAS_F
where formula_name = '&&2';
end if;
select min(formula_name)
into l_var1
from FF_FORMULAS_F
where formula_id = l_num1;
new_section('Formula Definition');
Display_Table('FF_FORMULAS_F', null, 'where formula_id
= ('||l_num1||')', null, 'Y');
Display_Table('FF_FORMULA_TYPES', null, 'where formula_typ
e_id in (select formula_type_id from ff_formulas_f where formula_id = ('||l_num1
||'))', null, 'Y');
Display_Table('FF_COMPILED_INFO_F', null, 'where formula_id
= ('||l_num1||')', null, 'Y');
new_section('Database Object');
Display_Table('ALL_OBJECTS', null, 'where object_name
like (''FFP''||'||l_num1||'||''%'')', 'order by object_type', 'Y');
select min(object_name)
into l_var2
from all_objects
where object_name like ('FFP'||l_num1||'%');
Display_Table('ALL_SOURCE', 'ALL_SOURCE - Package', 'where owner = ''AP
PS'' and name = ('''||l_var2||''') and type = ''PACKAGE'' ', 'order by line', 'Y
');
Display_Table('ALL_SOURCE', 'ALL_SOURCE - Package Body', 'where owner = ''AP
PS'' and name = ('''||l_var2||''') and type = ''PACKAGE BODY'' ', 'order by line
', 'Y');
Display_Table('ALL_ERRORS', null, 'where name = ('''|
|l_var2||''')', 'order by type, line', 'Y');
new_section('OTL Formulas DFF');
Display_Table('FND_DESCRIPTIVE_FLEXS', null, 'where DESCRIPTIVE_
FLEXFIELD_NAME = ''OTL Formulas'' ', null, 'Y');
--Display_Table('FND_DESCRIPTIVE_FLEXS_VL', null, 'where DESCRIPTIV
E_FLEXFIELD_NAME = ''OTL Formulas'' ', null, 'Y');
--Display_Table('FND_DESCRIPTIVE_FLEXS_TL', null, 'where DESCRIPTIV
E_FLEXFIELD_NAME = ''OTL Formulas'' ', null, 'Y');
Display_Table('FND_TABLES', null, 'where (table_name,
application_id) in (select application_table_name, application_id from FND_DESC
RIPTIVE_FLEXS where DESCRIPTIVE_FLEXFIELD_NAME = ''OTL Formulas'')', null, 'Y');
Display_Table('FND_DESCR_FLEX_CONTEXTS', null, 'where DESCRIPTIVE_
FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) like
upper('''||l_var1||''')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
--Display_Table('FND_DESCR_FLEX_CONTEXTS_VL', null, 'where DESCRIPTIV
E_FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper('''||l_var1||''')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
--Display_Table('FND_DESCR_FLEX_CONTEXTS_TL', null, 'where DESCRIPTIV
E_FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper('''||l_var1||''')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE', 'Y');
Display_Table('FND_DESCR_FLEX_COLUMN_USAGES', null, 'where DESCRIPTIVE_
FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) like
upper('''||l_var1||''')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(su
bstr(APPLICATION_COLUMN_NAME,10))', 'Y');
--Display_Table('FND_DESCR_FLEX_COL_USAGE_VL', null, 'where DESCRIPTIV
E_FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper('''||l_var1||''')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(
substr(APPLICATION_COLUMN_NAME,10))', 'Y');
--Display_Table('FND_DESCR_FLEX_COL_USAGE_TL', null, 'where DESCRIPTIV
E_FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE) lik
e upper('''||l_var1||''')', ' order by DESCRIPTIVE_FLEX_CONTEXT_CODE, to_number(
substr(APPLICATION_COLUMN_NAME,10))', 'Y');
Display_Table('FND_FLEX_VALUE_SETS', null, 'where flex_value_s
et_id in (select flex_value_set_id from fnd_descr_flex_column_usages where DESCR
IPTIVE_FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE
) like upper('''||l_var1||'''))', null, 'Y');
Display_Table('FND_FLEX_VALIDATION_TABLES', null, 'where flex_value_s
et_id in (select flex_value_set_id from fnd_descr_flex_column_usages where DESCR
IPTIVE_FLEXFIELD_NAME = ''OTL Formulas'' and upper(DESCRIPTIVE_FLEX_CONTEXT_CODE
) like upper('''||l_var1||'''))', null, 'Y');
Display_Table('FND_COLUMNS', null, 'where (column_name
, table_id) in (select a.application_column_name, b.table_id from FND_DESCR_FLEX
_COL_USAGE_VL A, FND_TABLES B, FND_DESCRIPTIVE_FLEXS C where C.DESCRIPTIVE_FLEXF
IELD_NAME = ''OTL Formulas'' and a.descriptive_flexfield_name = c.descriptive_fl
exfield_name and c.application_table_name = b.table_name and c.application_id =
b.application_id)', null, 'Y');
Display_Table('FND_DEFAULT_CONTEXT_FIELDS', null, 'where DESCRIPTIVE_
FLEXFIELD_NAME = ''OTL Formulas'' ', null, 'Y');
new_section('Time Entry Rules');
Display_Table('HXC.HXC_TIME_ENTRY_RULES', null, 'where formula_
id = ('||l_num1||')', ' order by time_entry_rule_id', 'Y');
end if;
end if;
--Tab0Print(get_fnd_version);
--Tab0Print(check_version('fnd','12.1'));
if check_version('fnd','12.1') = 'greater' and check_version('fnd','12.2') = 'le
sser' then
-- Tab0Print('12.1');
TimecardUpdate_fv := '';
TimecardUpdate_op := '';
TimecardUpdate_ps := '';
TimecardUtilities_fv := '';
TimecardUtilities_op := '';
TimecardUtilities_ps := '';
HXC.HXCDataTranslator_fv := '';
HXC.HXCDataTranslator_op := '';
HXC.HXCDataTranslator_ps := '';
elsif check_version('fnd','12.0') = 'greater' and check_version('fnd','12.1') =
'lesser' then
-- Tab0Print('12.0');
TimecardUpdate_fv := '120.30.12000000.11';
TimecardUpdate_op := '7554354:R12.HXT.A';
TimecardUpdate_ps := 'unknown';
TimecardUtilities_fv := '120.20.12000000.5';
TimecardUtilities_op := '8434432:R12.HXT.A';
TimecardUtilities_ps := 'unknown';
HXC.HXCDataTranslator_fv := '120.22.12000000.5';
HXC.HXCDataTranslator_op := '6686029:R12.HXT.A';
HXC.HXCDataTranslator_ps := '6610000:R12.HR_PF.A.DELTA.5';
sqlTxt := '
select f.app_short_name, f.subdir, f.filename, max(v.version) version
--, decode(f.filename
--, ''TimecardUpdate.class'', '''||TimecardUpdate_fv ||'''
--, ''TimecardUtilities.class'', '''||TimecardUtilities_fv||'''
--, ''HXC.HXCDataTranslator.class'', '''||HXC.HXCDataTranslator_fv||'''
--) fixed_version
--, decode(f.filename
--, ''TimecardUpdate.class'', '''||TimecardUpdate_op ||'''
--, ''TimecardUtilities.class'', '''||TimecardUtilities_op||'''
--, ''HXC.HXCDataTranslator.class'', '''||HXC.HXCDataTranslator_op||'''
--) patch_fix
--, decode(f.filename
--, ''TimecardUpdate.class'', '''||TimecardUpdate_ps ||'''
--, ''TimecardUtilities.class'', '''||TimecardUtilities_ps||'''
--, ''HXC.HXCDataTranslator.class'', '''||HXC.HXCDataTranslator_ps||'''
--) patchset_fix
from AD_FILES f
, AD_FILE_VERSIONS v
where f.app_short_name = ''HXC.HXC''
and f.filename in
( ''TimecardUpdate.class''
, ''TimecardUtilities.class''
, ''HXC.HXCDataTranslator.class''
)
and f.file_id = v.file_id
group by f.file_id, f.app_short_name, f.subdir, f.filename
';
run_sql('File Versions', sqltxt);
--new_section('Duplicates');
sqlTxt := '
select tc1.time_building_block_id timecard_id
, tc1.resource_id resource_id
, tc1.start_time start_time
, det1.time_building_block_id time_building_block_id
, det1.date_to date_to
, det1.translation_display_key translation_display_key
from HXC.HXC_time_building_blocks tc1
, HXC.HXC_time_building_blocks day1
, HXC.HXC_time_building_blocks det1
, HXC.HXC_time_building_blocks tc2
, HXC.HXC_time_building_blocks day2
, HXC.HXC_time_building_blocks det2
where tc1.scope in (''TIMECARD'', ''TIMECARD_TEMPLATE'')';
if l_param2 <> '0' then
sqlTxt := sqlTxt ||'
and tc1.resource_id = '||l_param2;
end if;
if l_param3 <> '0' then
sqlTxt := sqlTxt ||'
and trunc(tc1.start_time) >= to_date('''||l_param3||''')';
end if;
sqlTxt := sqlTxt ||'
and tc1.date_to = to_date(''31-Dec-4712'')
and tc2.time_building_block_id = tc1.time_building_block_id
and tc2.object_version_number = tc1.object_version_number
and day1.parent_building_block_id = tc1.time_building_block_id
and day1.parent_building_block_ovn = tc1.object_version_number
and day2.parent_building_block_id = tc2.time_building_block_id
and day2.parent_building_block_ovn = tc2.object_version_number
and det1.parent_building_block_id = day1.time_building_block_id
and det1.parent_building_block_ovn = day1.object_version_number
and det2.parent_building_block_id = day2.time_building_block_id
and det2.parent_building_block_ovn = day2.object_version_number
and det1.date_to = to_date(''31-Dec-4712'')
and det2.date_to = det1.date_to
and det1.translation_display_key = det2.translation_display_key
and det1.time_building_block_id <> det2.time_building_block_id
order by tc1.time_building_block_id, det1.translation_display_key, det1.time_
building_block_id
';
--Tab0Print(replace(sqlTxt, chr(10),'<br>'));
run_sql('Duplicates', sqltxt);
--new_section('Wrong Line');
sqlTxt := '
with tab as (
select sum.timecard_id, sum.resource_id, sum.start_time, sum.stop_time, sum.appr
oval_status
, det.time_building_block_id, det.object_version_number, day.start_time day
, det.measure otl_hours, det.comment_text, det.translation_display_key
, substr(det.translation_display_key,instr(det.translation_display_key,''|'
',1,1)+1,instr(det.translation_display_key,''|'',1,2)-(instr(det.translation_dis
play_key,''|'',1,1)+1)) det_row
, att.attribute_category
, att.attribute1, att.attribute2, att.attribute3, att.attribute4, att.attri
bute5, att.attribute6, att.attribute7, att.attribute8, att.attribute9, att.attri
bute10
, att.attribute11, att.attribute12, att.attribute13, att.attribute14, att.a
ttribute15, att.attribute16, att.attribute17, att.attribute18, att.attribute19,
att.attribute20
, att.attribute21, att.attribute22, att.attribute23, att.attribute24, att.a
ttribute25, att.attribute26, att.attribute27, att.attribute28, att.attribute29,
att.attribute30
from HXC.HXC_timecard_summary sum
, HXC.HXC_time_building_blocks tim
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
, HXC.HXC_time_attribute_usages use
, HXC.HXC_time_attributes att
where 1=1';
if l_param2 <> '0' then
sqlTxt := sqlTxt ||'
and sum.resource_id = '||l_param2;
end if;
if l_param3 <> '0' then
sqlTxt := sqlTxt ||'
and trunc(sum.start_time) >= to_date('''||l_param3||''')';
end if;
sqlTxt := sqlTxt ||'
and tim.time_building_block_id = sum.timecard_id
and tim.object_version_number = sum.timecard_ovn
and day.parent_building_block_id = tim.time_building_block_id
and day.parent_building_block_ovn = tim.object_version_number
and det.parent_building_block_id = day.time_building_block_id
and det.parent_building_block_ovn = day.object_version_number
and det.date_to = to_date(''31-Dec-4712'')
and use.time_building_block_id = det.time_building_block_id
and use.time_building_block_ovn = det.object_version_number
and att.time_attribute_id = use.time_attribute_id
and (att.attribute_category = ''PROJECTS''
or att.attribute_category like ''ELEMENT%''))
select a.timecard_id, a.resource_id, a.start_time, a.stop_time
, a.time_building_block_id
, a.translation_display_key
, a.det_row detail_row
, a.attribute_category
, a.attribute1, a.attribute2, a.attribute3, a.attribute4, a.attribute5, a.a
ttribute6, a.attribute7, a.attribute8, a.attribute9, a.attribute10
, a.attribute11, a.attribute12, a.attribute13, a.attribute14, a.attribute15
, a.attribute16, a.attribute17, a.attribute18, a.attribute19, a.attribute20
, a.attribute21, a.attribute22, a.attribute23, a.attribute24, a.attribute25
, a.attribute26, a.attribute27, a.attribute28, a.attribute29, a.attribute30
from tab a
where exists (select 1
from tab b
where a.timecard_id = b.timecard_id
and a.time_building_block_id <> b.time_building_block_id
and a.det_row = b.det_row
and substr(a.attribute_category,1,8) = substr(b.attribute_cate
gory,1,8)
and (a.attribute_category = b.attribute_category
and (nvl(a.attribute1,''.'') <> nvl(b.attribute1,''.'')
or nvl(a.attribute2,''.'') <> nvl(b.attribute2,''.'')
or nvl(a.attribute3,''.'') <> nvl(b.attribute3,''.'')
or nvl(a.attribute4,''.'') <> nvl(b.attribute4,''.'')
or nvl(a.attribute5,''.'') <> nvl(b.attribute5,''.'')
or nvl(a.attribute6,''.'') <> nvl(b.attribute6,''.'')
or nvl(a.attribute7,''.'') <> nvl(b.attribute7,''.'')
or nvl(a.attribute8,''.'') <> nvl(b.attribute8,''.'')
or nvl(a.attribute9,''.'') <> nvl(b.attribute9,''.'')
or nvl(a.attribute10,''.'') <> nvl(b.attribute10,''.'')
or nvl(a.attribute11,''.'') <> nvl(b.attribute11,''.'')
or nvl(a.attribute12,''.'') <> nvl(b.attribute12,''.'')
or nvl(a.attribute13,''.'') <> nvl(b.attribute13,''.'')
or nvl(a.attribute14,''.'') <> nvl(b.attribute14,''.'')
or nvl(a.attribute15,''.'') <> nvl(b.attribute15,''.'')
or nvl(a.attribute16,''.'') <> nvl(b.attribute16,''.'')
or nvl(a.attribute17,''.'') <> nvl(b.attribute17,''.'')
or nvl(a.attribute18,''.'') <> nvl(b.attribute18,''.'')
or nvl(a.attribute19,''.'') <> nvl(b.attribute19,''.'')
or nvl(a.attribute20,''.'') <> nvl(b.attribute20,''.'')
or nvl(a.attribute21,''.'') <> nvl(b.attribute21,''.'')
or nvl(a.attribute22,''.'') <> nvl(b.attribute22,''.'')
or nvl(a.attribute23,''.'') <> nvl(b.attribute23,''.'')
or nvl(a.attribute24,''.'') <> nvl(b.attribute24,''.'')
or nvl(a.attribute25,''.'') <> nvl(b.attribute25,''.'')
or nvl(a.attribute26,''.'') <> nvl(b.attribute26,''.'')
or nvl(a.attribute27,''.'') <> nvl(b.attribute27,''.'')
or nvl(a.attribute28,''.'') <> nvl(b.attribute28,''.'')
or nvl(a.attribute29,''.'') <> nvl(b.attribute29,''.'')
or nvl(a.attribute30,''.'') <> nvl(b.attribute30,''.'')
)))
order by a.timecard_id, a.det_row, a.attribute_category, a.attribute1, a.attribu
te2, a.attribute3
';
--Tab0Print(replace(sqlTxt, chr(10),'<br>'));
run_sql('Wrong Line', sqltxt);
--new_section('Wrong Day');
sqlTxt := '
select tc.time_building_block_id timecard_id
, tc.resource_id
, tc.start_time
, det.time_building_block_id time_building_block_id
, day.start_time day
, day.translation_display_key day_tdk
, det.translation_display_key det_tdk
, to_number(day.start_time-tc.start_time) correct_segment3
from HXC.HXC_time_building_blocks tc
, HXC.HXC_time_building_blocks day
, HXC.HXC_time_building_blocks det
where tc.date_to = to_date(''31-DEC-4712'', ''DD-MON-YYYY'')';
if l_param2 <> '0' then
sqlTxt := sqlTxt ||'
and tc.resource_id = '||l_param2;
end if;
if l_param3 <> '0' then
sqlTxt := sqlTxt ||'
and trunc(tc.start_time) >= to_date('''||l_param3||''')';
end if;
sqlTxt := sqlTxt ||'
and day.parent_building_block_id = tc.time_building_block_id
and day.parent_building_block_ovn = tc.object_version_number
and day.date_to = tc.date_to
and det.parent_building_block_id = day.time_building_block_id
and det.parent_building_block_ovn = day.object_version_number
and det.date_to = day.date_to
and substr(det.translation_display_key,instr(det.translation_display_key,''|'
',1,2)+1,length(det.translation_display_key))
<> to_number(day.start_time-tc.start_time)
';
--Tab0Print(replace(sqlTxt, chr(10),'<br>'));
run_sql('Wrong Day', sqltxt);
end;
end;
end if;
if upper('&&1') = 'HXC.HXC_TIME_CATEGORY'
or upper('&&1') = 'HXC.HXC_TIME_CATEGORIES'
then
-- ************************
-- *** HXC.HXC_TIME_CATEGORY.. Syntax: Parameter1: HXC.HXC_TIME_CATEGORY Param
eter2: <time_category_id> Parameter3: 0
-- ************************
if upper(l_param2) = 'PTO' then
Display_Table('HXC.HXC_TIME_CATEGORIES', null, 'where time_category_
id in (select time_category_id from HXC.HXC_time_categories where time_category_
name like ''%OTL_DEC%'' or time_category_name like ''%OTL_INC%'')', 'order by ti
me_category_id', 'Y');
else
Display_Table('HXC.HXC_TIME_CATEGORIES', null, 'where time_category_
id in (''&&2'')', null, 'Y');
Display_Table('HXC.HXC_TIME_CATEGORY_COMPS', null, 'where time_category_
id in (''&&2'')', null, 'Y');
Display_Table('HXC.HXC_TIME_CATEGORY_COMP_SQL', null, 'where time_category_
comp_id in (select time_category_comp_id from HXC.HXC_time_category_comps where
time_category_id in (''&&2''))', null, 'Y');
new_section('Mapping Components');
Display_Table('HXC.HXC_MAPPING_COMPONENTS', null, 'where mapping_compon
ent_id in (select mapping_component_id from HXC.HXC_time_category_comps where ti
me_category_id in (''&&2''))', null, 'Y');
new_section('Value Sets');
Display_Table('FND_FLEX_VALUE_SETS', null, 'where flex_value_set_id
in (select flex_value_set_id from HXC.HXC_time_category_comps where time_categor
y_id in (''&&2''))', null, 'Y');
Display_Table('FND_FLEX_VALIDATION_TABLES', null, 'where flex_value_set_id
in (select flex_value_set_id from HXC.HXC_time_category_comps where time_categor
y_id in (''&&2''))', null, 'Y');
sqlTxt := '
select display_column, expenditure_type, system_linkage_m
from pa_online_expenditure_types_v
where expenditure_type = ''Administrative Staff''
';
run_sql('PA_ONLINE_EXPENDITURE_TYPES_V', sqltxt);
end if;
end if;
end if;
new_section('EARNING GROUP');
sqlTxt := 'select * from HXT_EARN_GROUP_TYPES where id in
(select egt_id from HXT_EARNING_POLICIES where id = ('||l_param2||'))'
;
run_sql('HXT_EARN_GROUP_TYPES', sqltxt);
sqlTxt := 'select * from HXT_EARN_GROUPS where egt_id in
(select egt_id from HXT_EARNING_POLICIES where id = ('||l_param2||'))
order by element_type_id';
run_sql('HXT_EARN_GROUPS', sqltxt);
new_section('HOLIDAY CALENDAR');
sqlTxt := 'select * from HXT_HOLIDAY_CALENDARS where id in
(select Hcl_Id from HXT_EARNING_POLICIES where id = ('||l_param2||'))'
;
run_sql('HXT_HOLIDAY_CALENDARS', sqltxt);
sqlTxt := 'select * from HXT_HOLIDAY_DAYS where hcl_id in
(select Hcl_Id from HXT_EARNING_POLICIES where id = ('||l_param2||'))
order by holiday_date';
run_sql('HXT_HOLIDAY_DAYS', sqltxt);
new_section('ELEMENTS');
sqlTxt := 'select * from HXT_ADD_ELEM_INFO_F where element_type_id in
(select element_type_id from HXT_EARNING_RULES where egp_id in
(select id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
or element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id
in
(select element_type_id from HXT_EARN_GROUPS where egt_id in
(select egt_id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
))
or element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id in
(select Element_Type_Id from HXT_HOLIDAY_CALENDARS where id in
(select Hcl_Id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
)
or element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id in
(select Elt_Base_Id from HXT_PREM_ELIGBLTY_POL_RULES where Pep_Id in
(select Pep_Id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
)
or element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id in
(select Elt_Premium_Id from HXT_PREM_ELIGBLTY_RULES where Pep_Id in
(select Pep_Id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
)
or element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id in
(select Elt_Earned_Prem_Id from HXT_PREM_INTERACT_POL_RULES where Pip_
Id in
(select Pip_Id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
)
or element_type_id in
(select element_type_id from HXT_ADD_ELEM_INFO_F where element_type_id in
(select Elt_Prior_Prem_Id from HXT_PREM_INTERACT_RULES where Pip_Id in
(select Pip_Id from HXT_EARNING_POLICIES where id = ('||l_param2||')))
)
order by element_type_id';
run_sql('HXT_ADD_ELEM_INFO_F - Element Time Information', sqltxt);
end if;
-- Show_Footer('&v_scriptlongname', '&v_headerinfo');
EXCEPTION
when others then
BRPrint;
ErrorPrint(sqlerrm ||' occurred in test');
ActionErrorPrint('Please report the above error to Oracle Support Services.');
BRPrint;
Show_Footer('&v_scriptlongname', '&v_headerinfo');
BRPrint;
end;
end;
/
REM ==============SQL PLUS Environment setup===================
Spool off
set termout on
PROMPT
prompt Output spooled to filename &outputfilename
prompt