generate a daily test execution report in HP ALM - testing

I want to generate a daily test execution report for one of my regression set (which is in 1 folder and that 1 regression has multiple sub folders inside it , which contains test sets).
I tried running below query but not getting any output from that
SELECT
TESTCYCL.TC_USER_03 as Defect_ID,
TESTCYCL.TC_STATUS as Status,
--TESTCYCL.TC_ACTUAL_TESTER as Tester,
TESTCYCL.TC_EXEC_DATE as Exec_Date,
TESTCYCL.TC_TEST_ID as Test_ID,
TESTCYCL.TC_USER_01 as Build_Number,
TEST.TS_NAME As 'plan name'
FROM
TESTCYCL,
test
WHERE TESTCYCL.TC_EXEC_DATE = '18/08/2022'
AND TESTCYCL.TC_ACTUAL_TESTER = 'anurag.kulshreshtha'
AND TEST.TS_TEST_ID = TESTCYCL.TC_TEST_ID
tried to check on google as well but no luck...can someone please help?

Related

Runtime of stored procedure with temporary tables varies intermittently

We are facing a performance issue while executing a stored procedure. It usually takes between 10-15 minutes to run, but sometimes it takes up to more than 30 minutes to execute.
We captured visualize plan execute files for the Normal run and Long run cases.
By checking the visualized plan we came to know that, one particular Insert block of code takes extra time in the long run. And by checking
"EXPLAIN PLAN FOR SQL PLAN CACHE ENTRY <plan_id> "
the table we found that the order of execution differs in the long run.
This is the block which takes extra time to run sometimes.
INSERT INTO #TMP_DATI_SALDI_LORDI_BASE (
"COD_SCENARIO","COD_PERIODO","COD_CONTO","COD_DEST1","COD_DEST2","COD_DEST3","COD_DEST4","COD_DEST5"
,"IMPORTO","COD_VALUTA","IMPORTO_VALUTA_ORIGINARIA","COD_VALUTA_ORIGINARIA","NOTE"
)
( SELECT
SCEN_P.SCENARIO
,SCEN_P.PERIOD
,ACCOUT_ADJ.ATTRIBUTO1 AS "COD_CONTO"
,DATAS_rev.COD_DEST1
,DATAS_rev.COD_DEST2
,DATAS_rev.COD_DEST3
,__typed_NString__($1, 50)
,'RPT_NON'
,SUM(
CASE WHEN INFO.INCOT = 'FOB' THEN
CASE ACCOUT_rev.ATTRIBUTO1 WHEN 'CalcInsurance' THEN
0
ELSE
DATAS_rev.IMPORTO
END
ELSE
DATAS_rev.IMPORTO
END
* (DATAS_ADJ.IMPORTO - DATAS.IMPORTO)
)
,DATAS_rev.COD_VALUTA
,SUM(
CASE WHEN INFO.INCOT = 'FOB' THEN
CASE ACCOUT_rev.ATTRIBUTO1 WHEN 'CalcInsurance' THEN
0
ELSE
DATAS_rev.IMPORTO_VALUTA_ORIGINARIA
END
ELSE
DATAS_rev.IMPORTO_VALUTA_ORIGINARIA
END
* (DATAS_ADJ.IMPORTO_VALUTA_ORIGINARIA - DATAS.IMPORTO_VALUTA_ORIGINARIA)
)
,DATAS_rev.COD_VALUTA_ORIGINARIA
,'CPM_SP_CACL_FY_E3 Parts Option ADJ'
FROM #TMP_TAGERT_SCEN_P SCEN_P
INNER JOIN #TMP_DATI_SALDI_LORDI_BASE DATAS_rev
ON DATAS_rev.COD_SCENARIO = SCEN_P.SCENARIO
AND DATAS_rev.COD_PERIODO = SCEN_P.PERIOD
AND LEFT(DATAS_rev.COD_DEST3, 1) = 'O'
INNER JOIN CONTO ACCOUT_rev
ON ACCOUT_rev.COD_CONTO = DATAS_rev.COD_CONTO
AND ACCOUT_rev.ATTRIBUTO1 IN ('CalcFOB','CalcInsurance') --FOB,Insurance(Ocean freight is Nothing by Option)
INNER JOIN #DSL DATAS
ON DATAS.COD_SCENARIO = 'LAUNCH'
AND DATAS.COD_PERIODO = 12
AND DATAS.COD_DEST1 = 'NC'
AND DATAS.COD_DEST2 = 'NC'
AND DATAS.COD_DEST3 = 'F001'
AND DATAS.COD_DEST4 = DATAS_rev.COD_DEST4
AND DATAS.COD_DEST5 = 'INP'
INNER JOIN CONTO ACCOUT
ON ACCOUT.COD_CONTO = DATAS.COD_CONTO
AND ACCOUT.ATTRIBUTO2 = 'E3'
INNER JOIN CONTO ACCOUT_ADJ
ON ACCOUT_ADJ.ATTRIBUTO3 = DATAS.COD_CONTO
AND ACCOUT_ADJ.ATTRIBUTO2 = 'HE3'
INNER JOIN #DSL DATAS_ADJ
ON LEFT(DATAS_ADJ.COD_SCENARIO,4) = LEFT(SCEN_P.SCENARIO,4)
AND DATAS_ADJ.COD_PERIODO = 12
AND DATAS_ADJ.COD_DEST1 = DATAS.COD_DEST1
AND DATAS_ADJ.COD_DEST2 = DATAS.COD_DEST2
AND DATAS_ADJ.COD_DEST3 = DATAS.COD_DEST3
AND DATAS_ADJ.COD_DEST4 = DATAS.COD_DEST4
AND DATAS_ADJ.COD_DEST5 = DATAS.COD_DEST5
AND DATAS_ADJ.COD_CONTO = ACCOUT_ADJ.COD_CONTO
LEFT OUTER JOIN #TMP_KDPWT_INCOTERMS INFO
ON INFO.P_CODE = DATAS.COD_DEST4
GROUP BY
SCEN_P.SCENARIO,SCEN_P.PERIOD,ACCOUT_ADJ.ATTRIBUTO1,DATAS_rev.COD_DEST1,DATAS_rev.COD_DEST2
,DATAS_rev.COD_DEST3, DATAS.COD_DEST4,DATAS_rev.COD_VALUTA,DATAS_rev.COD_VALUTA_ORIGINARIA,INFO.INCOT
)
I will share the order of execution details also for normal and long run case.
Could someone please help us to overcome this issue? And also we don't know how to fix the order of the join execution. Is there any way to fix the join order execution, Please guide us.
Thanks in advance
Vinothkumar
Without a lot more detailed information, there is no way to tell exactly why your INSERT statement shows this alternating runtime behaviour.
Based on my experience, such an analysis can take quite some time and there are only few people available that are capable to perform it. If you can get someone like that to look at this, make sure to understand and learn.
What I can tell from the information shared is this
using temporary tables to structure a multi-stage data flow is the wrong thing to do on SAP HANA. Instead, use table variables in SQLScript.
if you insist on using the temporary tables, make them at least column tables; this will allow to avoid a need for some internal data materialisation.
when using joins make sure that the joined columns are of the same data type. The explain plan is full of TO_INT(), TO_DECIMAL(), and other conversion functions. Those take time, memory, and make it hard for the optimiser(s) to estimate cardinalities.
as the statement uses a lot of temporary tables, the different join orders can easily result from different volumes of data that was present when the SQL was parsed, prepared and optimised. One option to avoid this is to have HANA ignore any cached plans for the statement. The documentation has the HINTS for that.
And that is about what I can say about this with the available information.

SQl query to find multiple fixtures that a user hasn’t yet predicted, but other users may have

I have a football predictions database and I need a sql query that I can use to display all the fixtures that a specific user has not yet predicted. All predictions are kept in the UserPredictions table so a Left Join checking if the FixtureID is null will not work without another condition.
I have a fixtures table with FixtureID, HomeTeam, AwayTeam & FixtureStartTime as well as a UserPredictions table with UserPredictionID, UserID, FixtureID, HomeTeamPrediction & AwayTeamPrediction.
For example:
There are a total of 4 fixtures.
User 1 has predicted fixtures 1 & 2.
User 2 has only predicted fixture 2.
User 3 has predicted fixtures 1-4.
I want to get the fixtures that user 1 is yet to predict (3 & 4), but I would like to just be able to choose the UserID and the query will display outstanding predictions based on the user.
I can’t wrap my head around it.
Thanks
Use not exists:
select f.*
from fixtures f
where not exists (select 1
from predictions p
where p.FixtureID = f.FixtureID and
p.UserId = ?
);
The ? is a parameter placeholder for the user you care about.
Try this:
EDIT:
select * from fixtures
where fixture_id NOT IN (select fixture_id from UserPredictions where user_id = 1)

Intercepting queries oracle database 11g (e-business suite)

I want to know which tables the oracle application is using in order to obtain the contact information for a certain customer.
So, i go to the application (html page),i put my username and password. Then, i write the account number and click on "go". Take a look at the picture:
After that, i click on the "communication" button and the contact information appears.
Take a look:
How can i know which tables are used when i click on "go" for that account number?
A friend of mine told me that TOAD was a great tool but i dont know how to use it. Is it free? What query should i use?
Can you help me? I am a little confused :/
You can use the below query to get the contact information for a Customer at Party and Party Site levels.
SELECT DISTINCT hp.party_id,
hp.party_name,
hca.cust_account_id,
hca.account_number,
party_site_id,
party_site_number,
hcp.phone_number,
NVL (hcp.email_address, hcp.url) email_or_url,
hcp.contact_point_type communication_type,
hcp.status active,
hcp.contact_point_purpose purpose
FROM apps.hz_contact_points hcp,
apps.hz_party_sites hps,
apps.hz_cust_accounts hca,
apps.hz_parties hp
WHERE hps.party_id = hca.party_id
AND hp.party_id = hca.party_id
AND hcp.contact_point_type IN ('PHONE','EMAIL')
AND hcp.owner_table_name = 'HZ_PARTIES'
AND hcp.owner_table_id = hps.party_id
AND hcp.status = 'A'
AND hps.status = 'A'
AND hca.status = 'A'
AND hp.status = 'A'
UNION
SELECT DISTINCT hp.party_id,
hp.party_name,
hca.cust_account_id,
hca.account_number,
party_site_id,
party_site_number,
hcp.phone_number,
NVL (hcp.email_address, hcp.url) email_or_url,
hcp.contact_point_type communication_type,
hcp.status active,
hcp.contact_point_purpose purpose
FROM apps.hz_contact_points hcp,
apps.hz_party_sites hps,
apps.hz_cust_accounts hca,
apps.hz_parties hp
WHERE hps.party_id = hca.party_id
AND hp.party_id = hca.party_id
AND hcp.contact_point_type IN ('PHONE','EMAIL')
AND hcp.owner_table_name = 'HZ_PARTY_SITES'
AND hcp.owner_table_id = hps.party_site_id
AND hcp.status = 'A'
AND hps.status = 'A'
AND hp.status = 'A'
AND hca.status = 'A';
Hope this is helpful.
This question was answered already in thread: Trying to know which tables are executed in the oracle external application
You would need to look in v$sqlarea or if the SQLs execute slowly enough, you will find them in v$active_session_history. To retrieve the EBS specific user and responsibility information, you can use our active session history Blitz Report.

How do I convert a user-generated Oracle EBS spreadsheet into a SQL-driven script?

I need to convert a manually-created spreadsheet into a SQL report. The report is generated via Oracle Forms (one of the BI Suite apps).
There's an inbox where many tickets come in to, identified by a "Request Number"
Each Request Number is a help desk ticket in the system. Here is a screenshot of that spreadsheet:
A full listing of columns(with descriptions) :
Request No.
Modules
Submitted ( the request being submitted , a timestamp )
Supervisor ( the request being approved , by supervisor )
Average Supervisor Approval Duration
Responsibility
Average Resp. Approval Duration
Training (the request being approved for completing training)
Average Training Approval Duration -
Configuration - depending on whether its PRISM or iProcurement
Average Config. Approval Duration
Approved
Total Overall Duration
Security
Average Security Approval Duration
SOD
Avg SOD Approval Duration
So what I'm trying to do is to generate, some or all, of it using a SQL script.
One of my issues is that .. for a specific "Request Number" I'll often get redundant and conflicting data in the database.
Below is my query so far.
SELECT hur.reg_request_id AS "Request No",
RESPONSIBILITY_NAME AS "Module",
to_char(hur.creation_date, 'DD-Mon-YYYY HH24:MI:SS') AS "Submitted" ,
to_char(hur.last_update_date, 'DD-Mon-YYYY HH24:MI:SS') AS "Supervisor" ,
ROUND((hur.last_update_date - hur.creation_date), 3 ) ||
' days' AS "Avg Supervisor Appr Duration" ,
/* hura.creation_date AS "Responsibility" */,
NULL AS "Avg Resp Appr Duration", NULL AS "Training",
NULL AS "Avg Training Appr Duration" ,
hur.LAST_UPDATE_DATE AS "Security",
NULL AS "Avg Security Appr Duration",
NULL AS "SOD",
NULL AS "Average SOD Approval Duration" ,
NULL AS "Configuration",
NULL AS "Avg Config Appr Duration",
hurr.last_update_date AS "Approved",
ROUND( hurr.last_update_date - hur.creation_date, 2 )
AS "Total Overall Duration",
NULL AS "Notes"
FROM HHS_UMX_REG_SERVICES hur
JOIN fnd_responsibility_vl frt
ON (hur.responsibility_id = frt.responsibility_id and
hur.responsibility_application_id = frt.application_id)
JOIN
hhs_umx_reg_requests hurr ON
(hurr.reg_request_id = hur.reg_request_id )
/* JOIN hhs_umx_resp_activity hura */
left outer JOIN
hhs_umx_resp_activity
hura ON (hur.reg_request_id = hura.reg_request_id )--ADD ON
WHERE EXISTS (
SELECT NULL FROM hhs_umx_resp_activity hura
WHERE hura.created_by = hur.created_by
AND
hura.creation_date > hur.creation_date)
AND hur.reg_request_id IN
('263428', '263458', '263473',
'264717', '263402', '263404',
'262671', '263229', '263268')
ORDER BY hur.reg_request_id ASC
Here are the schemas :
HHS_UMX_RESP_ACTIVITY
HHS_UMX_REG_SERVICES
fnd_responsibility_vl
**hhs_umx_reg_requests **
thanks
As a simple solution you can just create rows that add the columns together in an SQL command. Something like "INSERT INTO TABLE ('REQ_NO', 'MODULE') VALUES (A2, B2)" etc. Then you can just use the excel function that copies it again and again for each row.
Another simple solution is to save the spreadsheet as CSV (play around with the exact CSV format to see what suits you) and then you might be able to just import it into your SQL table and play around there.
There are of course other more advanced solutions like TommCatt pointed out.
I have done this many times using Perl. There are packages for reading spreadsheets so just write the script to generate the insert statements needed. Then just write it into a nice .SQL text file which can then be executed by SQL Developer or whatever IDE you're using. Or just execute it directly from the Perl script.
It is hard to diagnose without sample tables (with only a few rows) reproducing the issue.
I think your duplicate data comes from a wrong join.
You could try to completely remove hhs_umx_resp_activity from the query (I see that you commented places where it is used).
Then if it continues it has to be related to the join on hhs_umx_reg_requests (you might be able to join an additional column or replace this join by something else, an outer apply for example).

SQL Selecting from one table with WHERE clause on the joined tables

I have three tables. The TestOptionsTable contains a list of tests to be performed on an instrument.
The second table CreateScript, is a table to store scripts to run during testing. These scripts contain a selection of some of the tests stored in TestOptionsTable. The scripts are run and the tests appear on screen one by one.
The results of each test are entered on screen and stored in TestResultsTable. When saved, the column IsTestComplete, is marked with a 1 and has a datatype of BIT.
During a script being run, the user may be interrupted and some individual tests may not yet be carried out. When the tests resume I want to display a list of tests from a script that have yet to be completed. Essentially select data from TestOptions and CreateScript if there is no entry for that Test in the results Table. So far I have this but is not returning anything:
select TestType,TestName, Limits
FROM CreateScriptTable
inner join TestOptionsTable on CreateScriptTable.TestName = TestOptionsTable.TestName
inner join TestResultsTable on CreateScriptTable.TestName = TestResultsTable.TestName
WHERE CreateScriptTable.InstrumentType= 'Instrument1'
AND TestResultsTable.IsTestComplete <> 1
ORDER BY [Index] ASC, TestName
The idea is that data is returned if the IsTestComplete Column has not been set to true in the results table but no data is returned. Has anyone any ideas? Thanks!
EDIT:
Expected output is something like below. With test Name, category and limits of test
Full Test 1 Visual 10 12
test1 Visual 0.1 0.22
Test 34 Visual 121 2222
Flow Test As Found 1 1.2
Test 2 As Found 1 1.1
Test 3 As Left 85 105
Test 6 As Left 95 103
Any incomplete tests will not be in the Test Results Table. I would like to select from CreateScript any tests that are not in the results table.
You say
Any tests that are incomplete will not be present at all in the
Results Table.
this means that you cannot use a INNER JOIN to relate the two first tables with the results.
Probably you should rewrite your query with a LEFT JOIN like this
select TestType,TestName, Limits
FROM CreateScriptTable
inner join TestOptionsTable on CreateScriptTable.TestName = TestOptionsTable.TestName
left join TestResultsTable on CreateScriptTable.TestName = TestResultsTable.TestName
WHERE CreateScriptTable.InstrumentType= 'Instrument1'
AND TestResultsTable.IsTestComplete IS NULL
ORDER BY [Index] ASC, TestName