Display each quarters record in a row
user aske me if I can display each quarters records in a separate row in the same report. will this possible without using PL/SqL
here is the desired out put.
in this case the user select quarter 1-3 the year is 2011 and they can not select more than one year at a time of running report.
If possible i would like to give the user to select any quarter they want when they run the reprot. please give me a clue how this can be done.
PROJECTAWARDED AWARDEDDOLLARAMOUNT NUMBEROFBIDDERS AVERAGENUMBEROFBIDDER
30 56,552,584 116 4
96 196,470,119 329 3
71 174,899,055 278 4
197 427,921,758 723 11
SELECT DISTINCT
COUNT (P.CPROJNUM) ProjectAwarded,
SUM (MIN (c.calcbtot)) AwardedDollarAmount,
SUM (COUNT (C.VENDOR)) NumberOfBidders,
(SUM (COUNT (C.VENDOR)) / (COUNT (P.CPROJNUM))) AverageNumberOfBidder
FROM BIDDERS C,
BIDLET B,
LETPROP L,
PROPOSAL P
WHERE C.LETTING = B.LETTING
AND P.CONTID = L.LCONTID
AND C.LETTING = L.LETTING
AND C.CALL = L.CALL
AND l.lcontid IN
(SELECT lcontid
FROM letprop c, PROPOSAL d
WHERE datestat IS NOT NULL
AND UPPER (letstat) <> 'R'
AND UPPER (letstat) <> 'B'
AND TRIM (UPPER (TIMELET)) = TRIM ('9:30 A.M.')
AND c.LCONTID = d.CONTID)
AND B.DATELET >= ADD_MONTHS(TRUNC(TO_DATE(:year,'YYYY'),'YYYY'),(:quarter - 1) * 3)
AND B.DATELET < ADD_MONTHS(TRUNC(TO_DATE(:year,'YYYY'),'YYYY'),:quarter * 3)
GROUP BY l.call
SELECT DISTINCT
COUNT (P.CPROJNUM) ProjectAwarded,
SUM (MIN (c.calcbtot)) AwardedDollarAmount,
TRUNC (TO_CHAR(B.DATELET, 'Q')) ,------------------------Added this line and now it gives me an error ORA-00937: not a single-group group function
----I added the field in the group by clasue.
SUM (COUNT (C.VENDOR)) NumberOfBidders,
(SUM (COUNT (C.VENDOR)) / (COUNT (P.CPROJNUM))) AverageNumberOfBidder
FROM BIDDERS C,
BIDLET B,
LETPROP L,
PROPOSAL P
WHERE C.LETTING = B.LETTING
AND P.CONTID = L.LCONTID
AND C.LETTING = L.LETTING
AND C.CALL = L.CALL
AND l.lcontid IN
(SELECT lcontid
FROM letprop c, PROPOSAL d
WHERE datestat IS NOT NULL
AND UPPER (letstat) <> 'R'
AND UPPER (letstat) <> 'B'
AND TRIM (UPPER (TIMELET)) = TRIM ('9:30 A.M.')
AND c.LCONTID = d.CONTID)
AND B.DATELET >=
ADD_MONTHS (TRUNC(TO_DATE (:year, 'YYYY'), 'YYYY'),
(:from_quarter - 1) * 3)
AND B.DATELET <
ADD_MONTHS (TRUNC(TO_DATE (:year, 'YYYY'), 'YYYY'),
:to_quarter * 3)
GROUP BY TRUNC(TO_CHAR (B.DATELET, 'Q')), l.call
Similar Messages
-
When executing query...in the result i want to display each row values
Hi All,
When executing query...in the result area i want to display each row values.
Example: query result is like this
Business Area Sales Material
kh02 1000 2000
2000 300
5000 400
6990 1000
Kh03 1400 700
200 500
50 60
but i need like this
kh02 1000 2000
kh02 500 600
kh02 400 300
kh03 1400 700
kh03 200 500
Why i need like this because am exporting to Excel spread sheet and i have to send as i show above ....i am doing manual but the file is very big like 95, 969 records i have to change manual...like this i have to change 8 files.
please advice me easy way
i willl be very gr8ful
Thanks
sidharthaHi,
that'S exactly what hide repeated key values does. If this option is on your result is:
Kh02 1000 1500
blank 500 456
blank 600 700
kh03 400 500
balnk 500 600
If you turn it off, the result will be:
Kh02 1000 1500
Kh02 500 456
kh02 600 700
kh03 400 500
kh03 500 600
Exaclty what you want. Try it, it should work
Regards,
Juergen -
Creating Search prompt to display a particular record row
Hi,
I have a crystal report with an Excel sheet as my data source.
I want to create a prompt which would ask for a certain value (say, "name") and when we enter a name (say "John") ; it will display the record row(age, income, savings, etc..) for the Name "John". (if multiple "john"s exist; it will display all the records with name- "John").
Basically, i want to create a "search" function.
Can you please help me understand how to create one like this. I am new to Crystal report. I have tried using Parameters but not able to make it happen.!
Thanks,
AditiHi Aditi,
Please follow these steps:
1) Create a string parameter. You may choose to create a dynamic/static parameter. In the parameter creation screen, you can also choose to select the 'value' field and you can select the Name field from the database here. This will give a list of Names when the report is run. Skip this if you do not want it this way, that is, if you wish to manually type in the value
2) Go to the Record Selection Formula (Report > Selection Formulas > Record) and use this formula:
= {?Parameter_Name}
Place the fields you want on the details section and the run the report.
Hope this helps!
-Abhilash -
How to display each character of an input string in different rows
Dear Members,
I want to write a SQL or PL/SQL where in I can separate and display each character of an input string into multiple rows.
For eg, the input string is TESTING, I want the result to be displayed as following:
1 T
2 E
3 S
4 T
5 I
6 N
7 G
I know we can use substr, but it returns me only one or more than one characters consecutively.
Please help me get the desired output.
Thanks in advance.Hi,
Perhaps
with a as
select 'TESTING' text from dual
select level, substr(a.text,level,1)
from a
connect by level <= length(a.text) -
Displaying records in one row??
The Board table has the following columns Userrecordid,Board_codes and the data is being displayed as:
Here is the data in the Boards Table:
Userrecordid Board_codes Board_Number
m001 KBIM A1234
m001 PBIM B1234
m002 PBIM Dytu1
m003 PBIM io34I had written a query(splitting KBIM code data & PBIM code data which actually brought back results as seen below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 NULL NULL
NULL NULL Y B1234I need to display the above results in one row shown as below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 Y B1234Hi,
francislazaro wrote:
The Board table has the following columns Userrecordid,Board_codes and the data is being displayed as:
Here is the data in the Boards Table:
Userrecordid Board_codes Board_Number
m001 KBIM A1234
m001 PBIM B1234
m002 PBIM Dytu1
m003 PBIM io34...
I need to display the above results in one row shown as below:
KBIM (Y/N) KBIM # PBIM (Y/N) PBIM #
Y A1234 Y B1234
So you don't want anything in the results about userrecordids 'm002' and 'm003', because they do not have both board_codes 'KBIM' and 'PBIM', is that it?
One way to get those results is a self-join, as if all the rows with borad_code 'KBIM' were in one table, and all the rows with borad_code 'PBIM' were in another:
SELECT 'Y' AS "KBIM (Y/N)"
, k.boradnumber AS "KBIM #"
, 'Y' AS "PBIM (Y/N)"
, k.boradnumber AS "KBIM #"
FROM boards k
JOIN boards p ON k.userrecordid = p.usrrecordid
WHERE k.board_codes = 'KBIM'
AND p.board_codes = 'PBIM'
;Another way is a GROUP BY, like Mpautom suggested.
If your requirements change in the future, so that you need to include all rows, even if they don't have both board_codes, then you could change the JOIN to a FULL OUTER JOIN and make what I wrote as the WHERE clause part of the join condition, but I suspect the GROUP BY approach would be more efficient in that case. -
Self join to get related records in one row
I have a table that has individual records for each family member.
tPerson.LastName, tPerson.FirstName, tPerson.RelationshipCode, tPerson.FamilyUnitCode, tPerson.JobCode
Smith, John,HD, 1234, AD
Smith, Jill, SP, 1234, TC
Olson, Fred, HD, 2345, AV
Olson, Wilma, SP, 2345, MD
Adams, Nate, HD, 3456, DP
Adams, Heidi, SP, 3456, DP
Franks, John, HD, 4567, AV
Williams, Pauline, HD, 5678, TC
I need to get each family unit in one row, preferably without a group on, for a report because I need to compare the jobcodes of HD and SP to decide how to build an expression for a listing. I need to also get singles with no spouse info.
FamilyCode, Lastname, HDFirstName, SPFirstName, HDJobCode, SPJobCode
1234, Smith, John, Jill, AD, TC
2345, Olson, Fred, Wilma, AV, MD
3456, Adams, Nate, Heidi, DP, DP
4567, Franks, John, NULL, AV, NULL
5678, Williams, Pauline, NULL, TC, NULL
Does the type on constraint affect the effect of an inner join? I have trouble getting the left side returning rows where there is no SP records for that familyCode.
Any help? John>> I have a table that has individual records [sic] for each family member. <<
Rows are not records. And you posted no DDL.
Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying
temporal data. We need to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
The sample data looks like it has a tibble on it. This is the classic design error of putting meta data, like a “t-” on tables and data element names. The next classic error you made
is a table name that is singular and vague; do you really have only one “Person” in a table? According to ISO-11179 rules, that is what you said.
>> I need to get each family unit in one row, ..<<
Not in RDBMS. Please look up the term “1NF” or “First Normal Form” which forbids structure data in columns.
But it just gets worse. Being in a family is a relationship, so it has its own table. The individuals are entities, so they have a table. Having a job is another relationship, so it is
in a third table. In your world, all these things are crammed into a single table! This might be how an OO programmer would attempt to do RDBMS that first time, but it is not good. Here is skeleton to get your started:
CREATE TABLE Personnel
(emp_id CHAR(9) NOT NULL PRIMARY KEY,
last_name VARCHAR(20) NOT NULL,
first_name VARCHAR(20) NOT NULL);
CREATE TABLE Family_Units
(family_unit CHAR(4) NOT NULL,
relationship_code CHAR(5) NOT NULL
CHECK (relationship_code IN ('spouse', ????)),
PRIMARY KEY (family_unit, relationship_code),
emp_id_1 CHAR(9) NOT NULL
REFERENCES Personnel
ON DELETE CASCADE,
emp_id_2 CHAR(9) NOT NULL
REFERENCES Personnel
ON DELETE CASCADE,
CHECK (emp_id_1 <> emp_id_2)
CREATE TABLE Employment
(emp_id_1 CHAR(9) NOT NULL
REFERENCES Personnel
ON DELETE CASCADE PRIMARY KEY,
job_code CHAR(2) NOT NULL); -- do you know about DOT codes?
See how we use DRI actions? Etc.
>> I need to compare the job_codes of HD and SP to decide how to build an expression [sic] for a listing. I need to also get singles with no spouse info. <<
Expression return scalar values in SQL. You meant query. Where is the SQL you attempted? Is “spouse” the only relationship?
You have not posted enough information for anyone to really help you. What little we can extract from this says that you have no idea how about RDBMS. Want to do some reading, follow
Netiquette and try again?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Display of data in a single row
Hi
Here is my query:
SELECT
--Element Classification Details:
pec.CLASSIFICATION_ID,
pec.classification_name,
pec1.classification_id "Sub Classification Id",
DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions',
'Others Voluntary Deductions', 'Other Deductions',
'Personal Deductions', 'Personal Deductions',
'Personal Voluntary Deductions', 'Personal Deductions',
'Car Loan Deductions') "Sub Classification",
pec1.parent_classification_id,
scr.sub_classification_rule_id,
--Element Details:
pet.element_name, pet.element_type_id, pet.reporting_name,
DECODE(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
--Run Result Details:
prr.run_result_id,
TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)) "Amount",
piv.NAME "Input Value",
--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"
FROM hr.pay_element_classifications pec,
hr.pay_element_classifications pec1,
hr.pay_sub_classification_rules_f scr,
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
WHERE
pec.classification_id = pec1.parent_classification_id (+)
AND scr.classification_id = pec1.classification_id
AND pet.classification_id = pec.classification_id
AND scr.element_type_id = pet.element_type_id
AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
AND prr.run_result_id = prrv.run_result_id
AND piv.input_value_id = prrv.input_value_id
AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
AND ptp.TIME_PERIOD_ID = payroll.time_period_id
AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
AND pec1.classification_name LIKE '%Deduction%'
AND piv.name = 'Pay Value'
AND paa.payroll_id != 0
AND paa.pay_basis_id != 0
AND paa.ASSIGNMENT_ID = '560'
I needed to display the amounts as separate columns pertaining to different elements or rather different sub classification of the elements
This is the final expected result for the report:
Employee Personal Deductions PD Amount Other Deductions OD Amt
XYZ Element1 00000.00 Element3 0000.00
Element 2
Car Loan Deductions CLD Amt Total Deductions (Total of all three)
Element4 00000.00 00000000.00
Here Personal Deductions, Other, Car Loan etc. are grouping of elements (sub classifications)
I have used MAX function to display the results as separate columns like this:
SELECT
--Run Result Details:
prr.run_result_id,
MAX(DECODE(pec1.classification_name, 'Personal Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal Deductions",
MAX(DECODE(pec1.classification_name, 'Personal Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal V Deductions",
MAX(DECODE(pec1.classification_name, 'Other Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Other Deductions",
MAX(DECODE(pec1.classification_name, 'Others Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Others V Deductions",
MAX(DECODE(pec1.classification_name, 'Car Loan Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Car Loan Deductions"
/*--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"*/
FROM hr.pay_element_classifications pec,
hr.pay_element_classifications pec1,
hr.pay_sub_classification_rules_f scr,
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv
/*hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp*/
WHERE
pec.classification_id = pec1.parent_classification_id (+)
AND scr.classification_id = pec1.classification_id
AND pet.classification_id = pec.classification_id
AND scr.element_type_id = pet.element_type_id
AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
AND prr.run_result_id = prrv.run_result_id
AND piv.input_value_id = prrv.input_value_id
/*AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
AND ptp.TIME_PERIOD_ID = payroll.time_period_id
--and pet.element_NAME like 'IVTB%'
AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE*/
AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
AND pec1.classification_name LIKE '%Deduction%'
AND piv.name = 'Pay Value'
--and paa.PRIMARY_FLAG like 'Y%'
/*AND paa.payroll_id != 0
AND paa.pay_basis_id != 0*/
GROUP BY
prr.run_result_id
However, the fact is that my each element_type_id has each run_result_id, which means 1 element has 1 run result id. Thus, I cannot display the data in a single row.
Can someone guide me on this? How can I display the data for an employee as a single row?
Thanks and regards,
AparnaSELECT EMP_ID,
Sum(Decode(DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions','Others Voluntary Deductions', 'Other Deductions'),'Other Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Other deduction',
sum(Decode(DECODE(pec1.classification_name,'Personal Deductions', 'Personal Deductions', 'Personal Voluntary Deductions', 'Personal Deductions'),'Personal Deductions'),TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Personal deduction',
sum(DECODE(pec1.classification_name,'Car Loan Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Car deduction'
FROM hr.pay_element_classifications pec,
hr.pay_element_classifications pec1,
hr.pay_sub_classification_rules_f scr,
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
WHERE
pec.classification_id = pec1.parent_classification_id (+)
AND scr.classification_id = pec1.classification_id
AND pet.classification_id = pec.classification_id
AND scr.element_type_id = pet.element_type_id
AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
AND prr.run_result_id = prrv.run_result_id
AND piv.input_value_id = prrv.input_value_id
AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
AND ptp.TIME_PERIOD_ID = payroll.time_period_id
AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
AND pec1.classification_name LIKE '%Deduction%'
AND piv.name = 'Pay Value'
AND paa.payroll_id != 0
AND paa.pay_basis_id != 0
I hope this may help!
Brijesh -
Displaying resultset one record at a time
This is a rather long question, but I have never done any projects like this before with Java.
I have an application in which users can view each record within a range of values one at a time. I have created a recordset that is sorted by one column in the resultset. What is the best way to display each record using forward/back buttons to "flip" through each record? How would I keep track of which record in the set I am actually displaying so I can move to either the next or previous depending on which button the user selects? Another problem I have is whether a particular button should be disabled?
Thanks in advance,
ChrisTry this link
http://www.theserverside.com/resources/article.jsp?l=DataListHandler
Select the Read PDF here link and it will download the PDF for you to read.
It's a pattern for the sort of problem that you describe. It comes complete with source code that you could use.
If you wish you can contact me via e-mail and I'll email you a working example.
Dave -
How do i display every 10 Records in my JSP page??
Hi..
I have developed one web-page which shows ALL employee records fetched from a employee table and display them in my JSP page.
It has contain more than 1000's of records. I need to display first 10 Records in my page. There should be some 4 links below the records display which get me to see next 10 records or previous 10 records or first 10 records or Last 10 records.
IS it possible in JSP??
This is my sample code for your ref:
<jsp:useBean id="empOperation" class="com.venki.gen.EmployeeOperation" />
<html>
<head>
<title>Stardeveloper : DataAccess JSP Tag</title>
<style>
p, td { font-family:Tahoma,Sans-Serif; font-size:8pt;
padding-left:15; }
</style>
</head>
<body>
<p align="center"><u>DataAccess JSP Tag</u></p>
<%
EmployeeList empList[] = null;
empList = empOperation.getEmployees(empName);
%>
<table align="center" border="0" width="90%" cellspacing="2" cellpadding="2">
<tr bgcolor="#CCDDEE">
<td>EMPNO</td>
<td>EMP Name</td>
<td>DESIGNATION</td>
</tr>
<%if(empList!=null)
for(int i=0; i<empList.length; i++)
EmployeeList emp = empList;%>
<tr bgcolor="#F7F7F7">
<td><%= emp.getEmpNo() %></td>
<td><%= emp.getEmpName() %></td>
<td><%= emp.getEmpDesignation()%></td>
</tr>
<% }%>
</table>
</body>
</html>
It would be extremely useful,if i know the technique how to display every 10 Records thru JSP.
Waiting for You people valuable reply and code!
Regards
venkiI do it by pages. i.e. http://example.com/page.jsp?page=1 would show records 1-10, ?page=2 would show records 11-20
let's pretend each record is identified by one field in the database, `id`
then the SQL query you'd use to grab the records could be..
SELECT * FROM `your_table` WHERE `id` >= (page*10) and <= (page*10+10)or this might even work:
SELECT * FROM `your_table` ORDER BY `id` ASC LIMIT (page*10),10(all examples untested as I'm at work :P) -
How to display only one record.
Hi Gurus,
Here my requirement is i have 2 pages.
first page having project_number lov,create and tableRN.
once u select the projectnumber and click on the create button it is navigate to secound page,here enter the data and click on the submit button it ll insert into database table and navigate to fitst page and display the data in tableRN what ever u insert the data(this part is over).
but the problem is, in tableRN displays all the records(previous records also displayed)
my requirement is display only one record(click on the submit button at the time of record only).
Plz help me
its very urgent.
Thanks
Seshu.
Edited by: its urgent on Jan 3, 2012 10:52 PMSeshu,
Do u want to display the inserted row...
Regards,
Gyan
www.gyanoracleapps.blogspot.com
www.querenttech.com -
Display all quarters between 2 dates?
hi,
Is their any way to display all quarters between 2 dates.. using a SQL statement alone.. or through some function..
If so, could some one help me around on it..
1/1/2005 12/31/2006
so, the answer should be..
Q1-05
Q2-05
Q3-05
Q4-05
Q1-06
Q2-06
Q3-06
Q4-06
thanks in advance....Hello
It looks slightly counter-intuitive (or atleast it did to me the first time I saw it) but you just need to pass the date columns of the table you want to generate the quarters for to the function:
SQL> select * from dt_test_dates
2 /
ID START_DAT END_DATE
1 01-JAN-05 31-DEC-06
2 01-JAN-07 31-DEC-08
3 01-JAN-09 31-DEC-10
SQL> select
2 dates.id,
3 quarters.column_value
4 from
5 dt_test_dates dates,
6 TABLE( f_ListQuartersBetween(dates.start_date,dates.end_date)
7 ) quarters
8 ORDER BY
9 id
10 /
ID COLUMN_VALUE
1 Q1-05
1 Q2-05
1 Q3-05
1 Q4-05
1 Q1-06
1 Q2-06
1 Q3-06
1 Q4-06
2 Q1-07
2 Q2-07
2 Q3-07
2 Q4-07
2 Q1-08
2 Q2-08
2 Q3-08
2 Q4-08
3 Q1-09
3 Q2-09
3 Q3-09
3 Q4-09
3 Q1-10
3 Q2-10
3 Q3-10
3 Q4-10
24 rows selected.It's important to note that the call to the function must come after the table that contains the dates you are interested in(at least on this version of oracle)
SQL> select * from v$version
2 /
BANNER
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for HPUX: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
SQL> select
2 dates.id,
3 quarters.column_value
4 from
5 TABLE( f_ListQuartersBetween(dates.start_date,dates.end_date)
6 ) quarters,
7 dt_test_dates dates
8 ORDER BY
9 id
10 /
TABLE( f_ListQuartersBetween(dates.start_date,dates.end_date)
ERROR at line 5:
ORA-00904: "DATES"."START_DATE": invalid identifierHTH
David -
Want to get sum/avg first 90% records in each grouped record set.
Hi Gurus,
Need your help or example query which help me to achieve sum/avg first 90% records in each grouped record set. Let me show you the basic query and output and proposed output.
select Pid, Sum(SalesAmt) TotalSaleAmt, Avg(SalesAmt) AvgSaleAmt, count(*) NoOfSales from ProductSales group by Pid;
PID TotalSaleAmt AvgSaleAmt NoOfSales
1 12000 100 120
2 24000 50 480
Now I need for PID =1 TotalSaleAmt of first 90% of NoOfSale i.e.120(this is basically nuber of rows found in PrdocutSales Table).
I hope I am clear enough explain my requirement... I would appreciate if we have some Analytical function available..
Gurus Pls help me asap..
Thanks In adavance...
Srichan.Now I need for PID =1 TotalSaleAmt of first 90% of NoOfSale i.e.120(this is basically nuber of rows found in PrdocutSales Table).
first 90% should mean first 90% by some order, so in this case, which 108 rows (of the 120) do you want to take into consideration?
with
the_sample as
(select 1 the_pid,10 the_sale,1 the_order from dual union all
select 1 the_pid,20 the_sale,2 the_order from dual union all
select 1 the_pid,15 the_sale,3 the_order from dual union all
select 1 the_pid,12 the_sale,4 the_order from dual union all
select 1 the_pid,12 the_sale,5 the_order from dual union all
select 1 the_pid,13 the_sale,6 the_order from dual union all
select 1 the_pid,19 the_sale,7 the_order from dual union all
select 1 the_pid,11 the_sale,8 the_order from dual union all
select 1 the_pid,15 the_sale,9 the_order from dual union all
select 1 the_pid,12 the_sale,10 the_order from dual union all
select 2 the_pid,25 the_sale,1 the_order from dual union all
select 2 the_pid,22 the_sale,2 the_order from dual union all
select 2 the_pid,22 the_sale,3 the_order from dual union all
select 2 the_pid,23 the_sale,4 the_order from dual union all
select 2 the_pid,29 the_sale,5 the_order from dual union all
select 2 the_pid,21 the_sale,6 the_order from dual union all
select 2 the_pid,25 the_sale,7 the_order from dual union all
select 2 the_pid,22 the_sale,8 the_order from dual
select the_pid,the_sum,the_avg
from (select the_pid,
sum(the_sale) over (partition by the_pid order by the_order) the_sum,
round(avg(the_sale) over (partition by the_pid order by the_order),2) the_avg,
the_order,
floor((0.9 * max(the_order) over (partition by the_pid))) to_pick
from the_sample
where the_order = to_pickRegards
Etbin -
Display readonly single record
Hi
What's the best way to display a single record in Apex? I need it to be display only (read only). A form or report region doesn't seem to do it.
So for example something like:
Customer Details
First Name: John
Surname: Doe
Address: 23 Anystreet, Anytown
etc.PaulBroughton wrote:
Sorry one thing I should have said is it is only available on classic reports not interactive ones.
However interactive reports have Single Row View and Detail View which display similar layouts. -
Material Description is not displaying for few records in Report
Dear Experts,
Report Material Description is not displaying for few records in Bex Report but for records it is coming and even the heading of the material Description is also not coming for this report.
Cud u plz suggest a good solution for it.
Regards,
Sai Phani.Hi Phani,
For the text of the material in records, check if there is text maintained for that material in the master data. also try by changing the text to medium text and long text.
regarding header, you will have same heading for key and text, you may use Materail ID / Description as the heading if you want.
regards,
Rk. -
How to display the NULL records by multiple XMLTABLE()
First, let me provide the testing data of INSERT and CREATE TABLE sql:
create table xml_t2 (xml_raw XMLTYPE);insert sql, a bit long.....just copy and paste then run it will be OK!
the system warns: Your message exceeds the maximum length of 30000 characters.
So, I place it on the mediafire shariing space
http://www.mediafire.com/?npmot6lgl86dgliTesting SQL:
SELECT t1.years, t1.months,t1.days,t1.hours,t1.value,t2.value
FROM xml_t2,
XMLTABLE ('$d/cdata/F1' passing xml_raw as "d" COLUMNS years integer path '//year', months varchar(3) path '//month', days varchar(2) path '//day', hours varchar(2) path '//hour', mins varchar(2) path '//minute', value float path '//value') t1 ,
XMLTABLE ('$d/cdata/F2' passing xml_raw as "d" COLUMNS years integer path '//year', months varchar(3) path '//month', days varchar(2) path '//day', hours varchar(2) path '//hour', mins varchar(2) path '//minute', value float path '//value') t2The condition for now is....In the xml data, I have deleted the month 'Jan' with <F2>tag which is in 2010.
That mean the output of XMLTABLE t2 will not contain the 'Jan' records but it is still remain in XMLTABLE t1.
The problem is that when I use the above SQL to show the t1.value, it will not display the t1.value in 2010 Jan.....it just skipped 'Jan' and becomes 'Feb'...
what i would prefer to display is something like this:
YEARS MONTHS DAYS HOURS t1_value t2_value
2009 Jan 01 01 8 8
2009 Jan 01 02 8 580
2009 Jan 02 01 580 580
2009 Jan 02 02 580 580
2009 Feb 01 01 440 440
2010 Jan 01 01 627 NULL
2010 Jan 01 02 627 NULL
2010 Jan 02 01 367 NULL
2010 Jan 02 02 367 NULL
2010 Feb 01 01 367 849
2010 Feb 01 02 849 849
..............So...the main problem is how to display back the record in JAN in 2010 in t1 XMLTABLE and assign null to the t2 XMLTABLE since it doen't contains this months record.
THANKS for help!!Hi,
What's your database version?
Are you using binary XML storage? (This is the default in 11.2.0.2)
If not you have to explicitely specify it :
create table xml_t2 (xml_raw XMLTYPE)
xmltype column xml_raw store as securefile binary xml;Along with object-relational, it's the best storage strategy to use in conjunction with XMLIndex.
You should also use a structured XML index instead, it's more appropriate than the unstructured index you're currently using :
create index xml_t2_sxi on xml_t2 (xml_raw)
indextype is xdb.xmlindex
parameters (q'#
XMLTABLE xml_t2_xt '/cdata'
COLUMNS
YEARS INTEGER PATH 'F1/name/year',
MONTHS VARCHAR(3) PATH 'F1/name/month',
DAYS VARCHAR(2) PATH 'F1/name/day',
HOURS VARCHAR(2) PATH 'F1/name/hour',
MINS VARCHAR(2) PATH 'F1/name/minute',
VALUE FLOAT PATH 'F1/name/value',
VALUE2 FLOAT PATH 'F2/name/value'
call dbms_stats.gather_table_stats(user, 'XML_T2');Use the query provided by Stew and check the explain plan, you'll see the difference.
Maybe you are looking for
-
Error while generating form 16 in portal - Screen output without connection
Dear Gurus, We are facing error while generating form 16 through portal and getting the below error in portal. Screen output without connection to user. error key: RFC_ERROR_SYSTEM_FAILURE When we checked for dumps in R/3 the following dump is com
-
TS3694 How do i take my phone out of recovery mode?
I have followed the recovery restore steeps and get error -1 the troubleshooting says Error -1 Attempt to restore your iOS device two more times. If the issue is still unresolved, the device may need service. I have an appointment at my local apple s
-
Receiver is getting duplicate emails
My iphone 5 sends duplicate emails to one receiver.
-
SSO E-Sourcing and SAP GUI for HTML
Hi, We are trying to provide integration between SAP E-Sourcing and SAP ECC via the SAP GUI for HTML. From an E-Sourcing project, we should define a link which will link us to the report via SAP GUI for HTML. Some parameters are automatically transfe
-
Morphing Plug-ins for Premiere Pro
I have been tasked to produce a video which will require a morphing effect between 2 individuals. I know that since this is not new technology (music videos in the 80s) there are many plug-in products to be found, but has anyone found one that is bot