How to show multipe records on a single record
Hi all,
I have a query which can contain 1 or Many records for each S.WAS_NO or APPL_NO even. A new record is created when the APPL_STATUS changes and a timestamp is created in APPL_STATUS_CHANGE_DATE.
select distinct
S.APPL_ID,
S.WAS_NO,
S.AS_STATUS,
S.STATUS_CHANGE_DATE,
dense_rank() over (partition by S.WAS_NO order by S.STATUS_CHANGE_DATE) rank
from table_a S, table b S2
where S.APPL_ID = S2.APPL_ID
order by S.WAS_NO, rank asc;
Current Results:
APPL_ID---WAS_NO---------------AS_STATUS----STATUS_CHANGE_DATE-----RANK
6628-------E4G0YL9B08V0V6---ASSIGNED-------25/10/2011----------------------1
6628-------E4G0YL9B08V0V6---USED--------------30/12/2011----------------------2
Desired Results:
APPL_ID--WAS_NO------------------AS_STATUS1----STATUS_CHANGE_DATE1----AS_STATUS2----STATUS_CHANGE_DATE2
6628-------E4G0YL9B08V0V6----ASSIGNED---------25/10/2011------------------------USED--------------30/12/2011The rank is based on the WAS_Number and ordered by the STATUS_CHANGE_DATE so i know which order they should go in.
I want to show 1 record per WAS_NO and show each status change with its date. There can only be a maximum of three status changes.
I have not been able to workout how to get Multiple records onto a singe record and in different columns.
Many thanks
This should do what you want:
WITH t AS
(SELECT 6628 appl_id, 'E4G0YL9B08V0V6' was_no, 'ASSIGNED' as_status, TO_DATE('25/10/2011', 'DD/MM/YYYY') status_change_date FROM dual UNION ALL
SELECT 6628 appl_id, 'E4G0YL9B08V0V6' was_no, 'USED' as_status, TO_DATE('30/12/2011', 'DD/MM/YYYY') status_change_date FROM dual UNION ALL
SELECT 6628 appl_id, 'E4G0YL9B08V0V6' was_no, 'COMPLETE' as_status, TO_DATE('15/01/2012', 'DD/MM/YYYY') status_change_date FROM dual UNION ALL
SELECT 6629 appl_id, 'A5AAFG1C07L0P2' was_no, 'ASSIGNED' as_status, TO_DATE('19/01/2012', 'DD/MM/YYYY') status_change_date FROM dual)
SELECT appl_id,
was_no,
MAX(CASE rank
WHEN 1 THEN as_status
ELSE NULL
END) as_status1,
MAX(CASE rank
WHEN 1 THEN status_change_date
ELSE NULL
END) status_change_date1,
MAX(CASE rank
WHEN 2 THEN as_status
ELSE NULL
END) as_status2,
MAX(CASE rank
WHEN 2 THEN status_change_date
ELSE NULL
END) status_change_date2,
MAX(CASE rank
WHEN 3 THEN as_status
ELSE NULL
END) as_status3,
MAX(CASE rank
WHEN 3 THEN status_change_date
ELSE NULL
END) status_change_date3
FROM (SELECT appl_id,
was_no,
as_status,
status_change_date,
DENSE_RANK() OVER (PARTITION BY was_no ORDER BY status_change_date) rank
FROM t)
GROUP BY appl_id,
was_no
Similar Messages
-
Concatenate multiple records into one single record
Hello everyone,
Can anyone guide me how to merge multiple records into one single record
like......... I am getting the data in the file like
aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
ffffff/gggg/hhhhhhhhhhhhhh
/123/4567/55555/99999999/kaoabfa/eee
fffff/kkkkkkkk/llllllllllllllllllllllll
when i use gui_upload I am getting the data into the internal table in the above format.
My main intension is to split the record at / to multiple lines and dowload it into another file.
What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.Yes, it should work.
In my example
Loop at itab.
concatenate i_text itab into i_text.
endloop.
You change that loop for the loop of your internal table with the file records
So if you have this three records
'aaaa/bbb/ccc'
'/dddd/efg'
'hijk/lmn'
i_text will look like this at the end
'aaaa/bbb/ccc/dddd/efghijk/lmn'
then in this part of the code
split i_text at '/' into table itab2.
itab2 will have the records looking like this
aaaa
bbb
ccc
dddd
efghijk
lmn' -
Merging two records in a single record for the same matnr,werks and bwart.
Hi I have a requirement to merge two records into one single record using the quantity field from MSEG table.
I am selecting two records from the table MSEG. Now for these two records i have to add the quantity values into one variable.
Then there should be only one record for the same matnr,werks,bwart.
Any suggestion would be appreciated.
Regards,
Amithi,
You can COLLECT statement only if all non key fields are numeric.
This statement Adds all such fields and give us a single record.
Regards
Sumit Agarwal -
How to use execute query For a single record
Hi All,
I am working with oracle forms 10g, I have developed a custom form.
I the form user enter some data and click save in the menu and data get inserted into my table. Inside the insert statement i have hardcoded some values, Once data get inserted i cant able to see that values immediately in my text fields in my form.After requerying i can able to see the changes.
For example I have a text field called Status, and the field is display only field. At that time of insert i have hardcoded as "INCOMPLETE". Once the user enter the data in the form and click save the data get inserted in to my table but i cant able to see the status, after i requery my form i can able to see the status.
Here i do multi insert also.
This is my insert statement
BEGIN
First_Record;
LOOP
IF :BANK_GUARANTEE_BLK.CHECK_IN_OUT = 'Y'
THEN
XXBANK_GUARANTEE_HEADERS.XXBANK_GUARANTEE_INSERT;(this is my package, here i have written my insert statement)
--Execute_query;
END IF;
Exit when :System.Last_Record = 'TRUE';
Next_Record;
END LOOP;
END;
If user insert only one row and i gave Execute_query to refresh and bring the current data, but when i use execute_query Its brings up all the datas in the table.
Can any one tell me how to avoid this and how to use execute_query for a single record.
Thanks ®ards
SrikkanthSolved,
The solution is
set_block_property('LC_REQ_BLK',ONETIME_WHERE,'LC_PO_NUMBER='||:LC_REQ_BLK.LC_PO_NUMBER);
go_block('LC_REQ_BLK');
execute_query;
Works fine.
Regards
Sri -
How can I map last of the repeating records into a single record?
I have a following input schema, I need to take only one of the <Student> records and map that to a single record in output. Doesn't matter if the first, second or last one of the records get mapped, I only need one in the output. Any idea how can
this be accomplished?
Input:
<Students>
<Student id="1">
<Name>
A
</Name>
<Roll>
1
</Roll>
</Student>
<Student id="2">
<Name>
A
</Name>
<Roll>
1
</Roll>
</Student>
<Student id="3">
<Name>
A
</Name>
<Roll>
1
</Roll>
</Student>
</Students>
Expected Output:
<Candidate>
<Student>
<Name>
A
</Name>
</Student>
</Candidate>Sounds rather complex for something that could be done very simple in custom XSLT like this:
<?xml version="1.0" encoding="utf-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Students">
<Candidate>
<Student>
<Name>
<xsl:value-of select="Student/Name" />
</Name>
</Student>
</Candidate>
</xsl:template>
</xsl:stylesheet>
Morten la Cour -
How to show multiple messages for a single exception
hi
Please consider this example application created using JDeveloper 11.1.1.3.0
at http://www.consideringred.com/files/oracle/2010/MultipleMessagesExceptionApp-v0.01.zip
It has a class extending DCErrorHandlerImpl configured as ErrorHandlerClass in DataBindings.cpx .
Running the page and entering a value starting with "err" will result in an exception being thrown and multiple messages shown.
See the screencast at http://screencast.com/t/zOmEOzP4jmQ
To get multiple messages for a single exception the MyDCErrorHandler class is implemented like
public class MyDCErrorHandler
extends DCErrorHandlerImpl
public MyDCErrorHandler()
super(true);
@Override
public void reportException(DCBindingContainer pDCBindingContainer,
Exception pException)
if (pException instanceof JboException)
Throwable vCause = pException.getCause();
if (vCause instanceof MyMultiMessageException)
reportMyMultiMessageException(pDCBindingContainer,
(MyMultiMessageException)vCause);
return;
super.reportException(pDCBindingContainer, pException);
public void reportMyMultiMessageException(DCBindingContainer pDCBindingContainer,
MyMultiMessageException pException)
String vMessage = pException.getMessage();
reportException(pDCBindingContainer, new Exception(vMessage));
List<String> vMessages = pException.getMessages();
for (String vOneMessage : vMessages)
reportException(pDCBindingContainer, new Exception(vOneMessage));
}I wonder if calling reportException() multiple times is really the way to go here?
question:
- (q1) What would be the preferred use of the DCErrorHandlerImpl API to show multiple messages for a single exception?
many thanks
Jan Verveckenfyi
Looks like using MultipleMessagesExceptionApp-v0.01.zip in JDeveloper 11.1.1.2.0 (11.1.1.2.36.55.36) results in a different behaviour compared to when used in JDeveloper 11.1.1.3.0 (11.1.1.3.37.56.60)
see http://www.consideringred.com/files/oracle/img/2010/MultipleMessages-111130versus111120.png
When using JDeveloper 11.1.1.2.0 each exception seems to result in two messages where there is only one message (as intended/expected) per exception when using JDeveloper 11.1.1.3.0 .
(Could be somehow related to the question in forum thread "multiple callbacks to DCErrorHandlerImpl".)
But, question (q1) remains and is still about JDeveloper 11.1.1.3.0 .
regards
Jan -
Integrating number of records into a single record
Hi
I have a table where we store trainees with certifications, it stores trainees address, id, pass/fail flag, course codes, competetion date and certificate expiration date. WHat I need is to display a single record for each trainee in my query. In this case, what we have currently in the table is we might have 11 certificates for a trainee or 1 or maybe 5 etc. All I need is to display all his information, address, trainee id, courrse code..course code11 in a signle record. Is it possible and how? Please helpTry this one - it points to the same page and looks like it works:
Re: How to show the SELECT result in a certain form? -
How to show 250 characters in a single line.
Hi,
How do I store 250 characters in an infoobject? (An Infoobject can be of 60 characters only)
I can certainly store using 5 different infoobjects but my requirment is that the text should be visible in a single line while executing a report.
Regards
AugustineHello!
here is a solution from previous posts.
You may want to try this workaround:
"Create two 60 CHAR length InfoObjects and adding them as attributes to the InfoObject you originally created (say ZIO_1). Populate long texts (in your case, up to 100 CHAR) to the master data of ZIO_1. You need to make ZIO_1 values unique. That works for me where I need to store up to 480 CHAR for comments"- Bill Wu
and a link to one more thread
Re: Bypass 60 char limit
hope this helps
with regards
ashwin -
BI Report is showing two rows for a single record
Dear Experts
This is Raja
I am Facing one issue in BI Report,
I have created report based on a Infocube which is getting data from two DSO. one is Standard [ Billing Condition Data]and another one is ZDSO[Targets}. these two requests go in the Infocube
1. Budget- zdbudget [DSO]
2.Actuals -0sd_o06 [DSO]
I need to make report Like this :For a specific period
EX:1
Material Sold to party Actual Budget/Target Variance Actual YTD Budget YTD
M100 S100 21 30 10 21 30
here budget{ Budget DSO} values i am getting Material wise sold to party is not coming through file. But for Actual values sold to party is coming, that's why my report is showing like this..
Ex:2
Material Sold to party Actual Budget/Target Variance Actual YTD Budget YTD
M100 S100 21 10 21
30 -30 30
Since the sold to party is not available in Budget DSO in the report For Every Material it's showing Two Rows.
How can bring this in to one Line..Like EX:1
Please give Valuable Suggestions..Say the data is like this.
Material Sold to Party Act Bud
M1 S1 100 0
M1 # 0 50
M1 S2 200 0
And you want to see like below.
Material Sold to Party Act Bud
M1 S1 100 50
M1 S2 200 50
If this is your requirement, let the sold to party be in Rows.
In columns, for budget, create a local selection, drag budget kf, sold to party (restrict this by # and right click and choose constant selection). This makes the budget kf independent of what is coming in the rows and always shows data corresponding to sold to party #. Hope this is clear. -
Combining multiple records into a single record (View)
Okay so here is my scenerio:
There is a table I have made that details SQL jobs and the various details about them. What i wan't to do is make a view with specific logic implemented. Fields that will be taken across to this view will be: LastRunDate, LastRunTime and Step_Status.
JobName will also be used to define the logic but will not be a column in itself.
What i wan't is an additional column using this logic, called 'DataSet'. For each Dataset there are multiple jobs that are unique to it, so there are multiple records being brought over from the table to view for one particular dataset. For example,
for 'ExampleDataSet' there are three jobs, i wan't it so these jobs are combined and named as 'ExampleDataSet' under a calculated column called 'Dataset'. For the following fields i would like it so that LastRunDate and LastRunTime are the time in whichever
job was last to be intitiated is the date and time set. For Step_Status, there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running'. If neither are running yet one has failed then 'Failed'.
Only when all three have succeeded should it then be set to 'Succeeded'.
I hope i have made that clear enough, please feel free to ask any questions if not. I am relatively new to SQL but i thought to at least try least try (I knew it wouldn't work) and it didn't work. But it may give you a better idea of
what i wan't:
CREATE VIEW [dbo].[vw_DataAvailabilityAnalysts] AS
SELECT CASE
WHEN JobName in ('Job1','Job2','Job3') and step_status='Running' THEN 'Running'
WHEN JobName in ('Job1','Job2','Job3') and step_status='Failed' THEN 'Failed'
WHEN JobName in ('Job1','Job2','Job3) and step_status='Succeeded' THEN 'Succeeded'
END as StatusCheck,
CASE WHEN JobName in ('Job1','Job2','Job3') THEN 'ExampleDataSet'
END as DATASET,
LastRunDate,
lastruntime,
step_status,
FROM [CDS_Common].[dbo].[DataAvailability]
Many Thanks,
Plain_Clueless
Plain_CluelessOkay so here is what my table looks like (Simplified). There are four columns and the data within is extracted via a Stored Procedure.
JobName
LastRunDate
LastRunTime
Step_Status
Job1
11/06/2014
09:30:00
Succeeded
Job1
10/06/2014
09:37:20
Succeeded
Job2
11/06/2014
04:05:00
Succeeded
Job1
09/06/2014
02:17:41
Succeeded
As you can see there are 3 jobs which are all 'Job1'. This jobs are obviously different within the table however this represents that they are jobs which all update the same DataSet within our local warehouse. Whereas Job2 updates a different dataset alltogether.
I wan't to create a view which will alagmate the jobs that are of the same DataSet, which will disclude the column JobName but would create a whole new column that looks like this:
DataSet
LastRunDate
LastRunTime
Step_Status
DataSet2
11/06/2014
04:05:00
Succeeded
DataSet1
11/06/2014
09:30:00
Succeeded
Bascically what this shows you is all the Job 1's combined so they are one record, Amaglamated. The last time any of these jobs were run is the LastRunDate & LastRunTime, which was the first record in the first table provided. Again for Step_Status,
there are three possible results, 'Running', 'Failed' or 'Succeeded'. If any of the three jobs are 'Running', then 'Running' (Absolute). If none of the three jobs are running yet one has failed then 'Failed'. If one has failed yet another is also running then
'Running'.Only when all three have succeeded should it then be set to 'Succeeded'. (This last bit isn't as important).
Hope this clears it up a bit,
Plain_Clueless
Plain_Clueless -
Grouping the Records Into One Single Record
Suggest me any function in sql or script which gives me following result.
I have a table in which there are few columns and the data looks like below. I am only concerned about 3 columns
C1 C2 C3
A B Parent
B A Child
My requirement is to club and make it as
C1 C2 C3 C4
A B Parent Child
I need to group in .. If we look into the first 2 records .. c1 of first record is equal to c2 of second record..Hi,
Here's one way to do it:
SELECT p.c1
, p.c2
, p.c3
, c.c3 AS c4
FROM table_x p
JOIN table_x c ON p.c2 = c.c1
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Point out where the query above is producing the wrong results and explain, using specific examples, how you get those results from the given data in those places.
Always say which version of Oracle you're using.
See the forum FAQ {message:id=9360002} -
To group multi records as a single record
HI,
I want to fetch multirecords as a single row
how to obtain itOk the answer is already there!
Cheers
Sarma
Message was edited by:
Radhakrishna Sarma -
Sender File Adapter cannot send single record per message ?
Hi,
I have scenario flat file to jdbc. but then why the sender file adapter didn't split the record to become single record per message eventhough i have set it in "Recordsets Per Message" = 1. ?
Document Name MT_APINVOICE
Document Namespace urn:file:jdbc:apivinvoice
Document Offset 8
Recordset Name INPUT
Recordset Namespace
Recordset Structure RECORD,*
Recordset Sequence Ascending
Recordset per Message 1
Key Field Name
Key field Type String
RECORD.fieldFixedLengths 10,5,10,10
RECORD.endSeparator 'nl'
RECORD.fieldNames F1,F2,F3,F4
Please advise
Thank You and Best Regards
Fernand>>but then how to make for example more then 1 records per message.
like 10 records per message. should i set RECORD,10 ?
That is right. Just try it out yourself.
@Shesagiri,
Number of record is decided by the parameter Recordset structure and number of recordset with in a message is decided by Recordset per Message.
Regards
Jaishankar -
How to make a single record datablock?
Hi all,
I got a data-entry form (9i) that will input a record one at a time and commit before entering another record.
I try to set the block as single-record to yes but it gives error, and after checking with help, I understand that it can not work with database data block.
Is there any idea on how to make the data block to show only one record? The problem is that after entering some data on the record, sometime the data-entry clerk may push the arrow-key that make form shows the next record items, which will be empty, and this will confuse the clerk!
Thank you for your help.Add Triggers KEY-UP(DOWN, NXTREC, PRVREC...) to the following effect:
NULL;
or
NEXT (PREVIOUS) _ITEM; -
How to find the maximum value among four fields in a single record
Hi Gems...
I have a record in which there are 4 currency fields.
Now i would like to know the maximum of these 4 fields.
I tried with Max functions in which i put all the 4 values...but it is showing error like ") is missing" though it is there.
Can we insert more than 2 values in Max function?
Or else is there any other option to find the max value among the 4 values which lies in a single record
Thanks
JitenHi Anil,
Say suppose i have a single record in which 4 premiums of a particular bond exists.
for eg:
Prem1 Prem2 Prem3 Prem4
129000.00 388000.00 228000.00 14800.00
Now this is a single record for a particular bond ... now i need to calculate the max value among these 4 premiums.
How would we proceed to achieve this?
Regards
Jiten
Edited by: Jitendra Yuddandi on Feb 3, 2009 1:04 PM
Maybe you are looking for
-
Hi, I am scanning a photo and placing in a java application. I am scanning multiple images. While scanning I am getting the following exception. Please give me a solution. thanks in advance, sampath Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occu
-
CDs of any kind will not load. After about 10 seconds, they are ejected. The CD icon never shows up on the desktop, and I have this machine configured to show CDs, if loaded. I have resorted to using an air-duster aimed at the slot to see it it is a
-
hallo list, i run Oracle 8.1.7.2, iFS 1.19 an solaris. iFS fits our purpose quite good, but the customization is really a hard pain. The only thing i wanna do is to make a HTML preview of the document, when it is stored via smb or http and display it
-
Hi all, I am trying to execute a mapping in OWB. It finishes running with several warnings. The wb_rt_audit table doesn't show any details for this mapping. Where are the execution scripts stored for the mapping? I need to look at them in detail. Tha
-
Production order released (CO02)
Hello Guru, We have question in our mide if we can block for modification of other user the PRODUCTION DATE of the batch created for the order when we do the RELEASED for the order? how could we block this PRODUCTION DATE? please help us. Thanks a lo