Multiple rows in a single row.
I want to know how can I store the values of multiple rowe in a single row.for an example..
machine name manchine no frequency month
Lathe MOO1 yearly jan
Lathe MOO1 halfyearly feb
Lathe MOO1 weekly march and so on
I want this in a single row..
like jan feb march
Lathe M001 yearly halfyearly weekly.
and in a single row I want this as per the month specified .
In my report I have 12 months distribution for each machine.
Taruna,
Just make sure understand the scenario correctly. Would you like to store the row in DB like this:
Lathe MOO1 yearly jan,feb,mar
then you expect to show in the report like this:
Lathe MOO1 yearly jan
Lathe MOO1 yearly feb
Lathe MOO1 yearly mar
Yes, you can do it this way, but somehow break the 1st principle of DB schema design - Atomic
Of course, you need to convert jan,feb,mar into list and display for each row.
string monthStr = "jan,feb,mar";
string [] months = monthStr.Split(",");
Kind Regards
-Yatsea
Similar Messages
-
Need help converting multipe rows in a single row
I want to convert multiple rows into a single row. Oracle version is 10.2
SQL> with abc
2 as
3 (select 1 a, 2 b, 3 c from dual union
4 select 4, 5, 6 from dual)
5 select * from abc;
A B C
1 2 3
4 5 6I want the output as
A B C
1,4 2,5 3,6Thanks,
Gangadhar
Edited by: GR on Feb 6, 2012 9:35 PMGR wrote:
I want to convert multiple rows into a single row. Oracle version is 10.2
SQL> with abc
2 as
3 (select 1 a, 2 b, 3 c from dual union
4 select 4, 5, 6 from dual)
5 select * from abc;
A B C
1 2 3
4 5 6I want the output as
A B C
1,4 2,5 3,6
You haven't specified if there's a particular order to the data, so I've assumed one...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 a, 2 b, 3 c from dual union
2 select 4, 5, 6 from dual)
3 --
4 -- end of test data
5 --
6 select trim(',' from sys_connect_by_path(a,',')) as a
7 ,trim(',' from sys_connect_by_path(b,',')) as b
8 ,trim(',' from sys_connect_by_path(c,',')) as c
9 from (select a,b,c,row_number() over (order by a) as rn from t)
10 where connect_by_isleaf = 1
11 connect by rn = prior rn+1
12* start with rn = 1
SQL> /
A B C
1,4 2,5 3,6
SQL> -
Mutiple Rows from a Single Row using SQL
How can i get Multiple rows from a single row using sql ?
Example : one row contains the complete address separated by delimiter say comma (,) as address1,address2,city,state,zip,country
I want to split this row and get the output in multiple rows as address1 address2 city state zip country using sql query.
Thanks,Hi,
The solution above assumes that the |-delimited entries always contain at least one character. If you have a string like
1 Elm Street|||Sioux City|IA||it will think 'Siuox City' is address2.
If you have empty entries, like that, then you need something a little more complicated:
INSERT INTO table2
( address1
, address2
, address3
, city
, state
, postal
, country
SELECT SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 1), 2) -- address1
, SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 2), 2) -- address2
, SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 3), 2) -- address3
, SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 4), 2) -- city
, SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 5), 2) -- state
, SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 6), 2) -- postal
, SUBSTR (REGEXP_SUBSTR ('|' || txt, '\|[^|]*', 1, 7), 2) -- country
FROM table1
; -
Merging two rows into a single row
Hi ,
I wish to merge few columns of tow rows into a single row.
if i use union it gives two rows as o/p.
What is the exact sql statement for that?
ThanksHi Sridhar,
This is my code for merging and i used union.
Suggest me good solution.
CREATE OR REPLACE VIEW INSPECTINT.INSPECT_LOC_TRACKING_RPT_VIEW AS
SELECT
VEN_COMPANY_NAME VEN_COMPANY_NAME,
VEN_COMPANY_NAME_2 VEN_COMPANY_NAME_2,
VEN_CONTACT_FIRST_NAME VEN_CONTACT_FIRST_NAME,
VEN_CONTACT_MIDDLE_NAME VEN_CONTACT_MIDDLE_NAME,
VEN_CONTACT_LAST_NAME VEN_CONTACT_LAST_NAME,
VEN_ADDRESS_LINE_1 VEN_ADDRESS_LINE_1,
VEN_ADDRESS_LINE_2 VEN_ADDRESS_LINE_2,
VEN_CITY VEN_CITY,
VEN_CNT_COUNTY_CODE VEN_CNT_COUNTY_CODE,
VEN_STC_STATE_CODE VEN_STC_STATE_CODE,
VEN_ZIP_CODE VEN_ZIP_CODE,
VEN_PHONE_NO_1 VEN_PHONE_NO_1,
VEN_PHONE_EXTN_1 VEN_PHONE_EXTN_1,
VEN_PHONE_NO_2 VEN_PHONE_NO_2,
VEN_PHONE_EXTN_2 VEN_PHONE_EXTN_2,
VEN_FAX_NO_1 VEN_FAX_NO_1,
VEN_VENDOR_NO VEN_VENDOR_NO,
VEN_APV_AP_VENDOR_ID VEN_APV_AP_VENDOR_ID,
VEN_EMAIL_ADDRESS VEN_EMAIL_ADDRESS,
--all these should be null
to_number(NULL) PHY_LCN_PARAMETER_ID,
to_char(NULL) PHY_LCN_CURRENT_ADDRESS_IND,
to_char(NULL) PHY_LCN_STATUS_CODE,
to_char(NULL) PHY_LCN_LTY_LOCATION_TYPE,
to_char(NULL) PHY_LCN_ADT_ADDRESS_TYPE,
to_char(NULL) PHY_LCN_HOUSE_NO,
to_char(NULL) PHY_LCN_ADDRESS_LINE_1,
to_char(NULL) PHY_LCN_ADDRESS_LINE_2,
to_char(NULL) PHY_LCN_CITY,
to_char(NULL) PHY_LCN_STC_STATE_CODE,
to_char(NULL) PHY_LCN_ZIP_CODE,
to_char(NULL) PHY_LCN_CNT_COUNTY_CODE,
to_date(NULL) PHY_END_DATE,
to_number(NULL) PHY_LCN_VEN_VENDOR_ID_GTA,
to_char(NULL) PHY_LCN_SUB_LOCATION_GTA,
to_char(NULL) PHY_LCN_DIRECTION_GTA,
---all these should be null
to_char(NULL) LOW_LCN_PARAMETER_ID,
to_char(NULL) LOW_LCN_CURRENT_ADDRESS_IND,
to_char(NULL) LOW_LCN_STATUS_CODE,
to_char(NULL) LOW_LCN_LTY_LOCATION_TYPE,
to_char(NULL) LOW_LCN_ADT_ADDRESS_TYPE,
to_char(NULL) LOW_LCN_HOUSE_NO,
to_char(NULL) LOW_LCN_ADDRESS_LINE_1,
to_char(NULL) LOW_LCN_ADDRESS_LINE_2,
to_char(NULL) LOW_LCN_CITY,
to_char(NULL) LOW_LCN_STC_STATE_CODE,
to_char(NULL) LOW_LCN_ZIP_CODE,
to_char(NULL) LOW_LCN_CNT_COUNTY_CODE,
to_char(NULL) LOW_LCN_LANDLORD,
to_number(NULL) LOW_LCN_LANDLORD_PHONE,
to_date(NULL) LOW_END_DATE,
to_char(NULL) LOW_LCN_SUB_LOCATION_GTA,
to_char(NULL) LOW_LCN_DIRECTION_GTA
FROM LOCATIONS LOC , VENDORS VEN
WHERE LOC.LCN_VEN_VENDOR_ID_GTA IS NOT NULL
AND LOC.LCN_VEN_VENDOR_ID_GTA = VEN_VENDOR_ID
AND LOC.LCN_LTY_LOCATION_TYPE ='AS'
UNION ALL
SELECT
to_char(NULL) VEN_COMPANY_NAME,
to_char(NULL) VEN_COMPANY_NAME_2,
to_char(NULL) VEN_CONTACT_FIRST_NAME,
to_char(NULL) VEN_CONTACT_MIDDLE_NAME,
to_char(NULL) VEN_CONTACT_LAST_NAME,
to_char(NULL) VEN_ADDRESS_LINE_1,
to_char(NULL) VEN_ADDRESS_LINE_2,
to_char(NULL) VEN_CITY,
to_char(NULL) VEN_CNT_COUNTY_CODE,
to_char(NULL) VEN_STC_STATE_CODE,
to_char(NULL) VEN_ZIP_CODE,
to_number(NULL) VEN_PHONE_NO_1,
to_number(NULL) VEN_PHONE_EXTN_1,
to_number(NULL) VEN_PHONE_NO_2,
to_number(NULL) VEN_PHONE_EXTN_2,
to_number(NULL) VEN_FAX_NO_1,
to_char(NULL) VEN_VENDOR_NO,
to_char(NULL) VEN_APV_AP_VENDOR_ID,
to_char(NULL) VEN_EMAIL_ADDRESS,
decode(lcn_adt_address_type,'P',to_number(LCN_PARAMETER_ID),to_number(NULL)) PHY_LCN_PARAMETER_ID,
decode(lcn_adt_address_type,'P',LCN_CURRENT_ADDRESS_IND,to_char(NULL)) PHY_LCN_CURRENT_ADDRESS_IND,
decode(lcn_adt_address_type,'P',LCN_STATUS_CODE,to_char(NULL)) PHY_LCN_STATUS_CODE,
decode(lcn_adt_address_type,'P',LCN_STATUS_CODE,to_char(NULL)) PHY_LCN_LTY_LOCATION_TYPE,
decode(lcn_adt_address_type,'P',LCN_ADT_ADDRESS_TYPE,to_char(NULL)) PHY_LCN_ADT_ADDRESS_TYPE,
decode(lcn_adt_address_type,'P',LCN_HOUSE_NO,to_char(NULL)) PHY_LCN_HOUSE_NO,
decode(lcn_adt_address_type,'P',LCN_ADDRESS_LINE_1,to_char(NULL)) PHY_LCN_ADDRESS_LINE_1,
decode(lcn_adt_address_type,'P',LCN_ADDRESS_LINE_2,to_char(NULL)) PHY_LCN_ADDRESS_LINE_2,
decode(lcn_adt_address_type,'P',LCN_CITY,to_char(NULL)) PHY_LCN_CITY,
decode(lcn_adt_address_type,'P',LCN_STC_STATE_CODE,to_char(NULL)) PHY_LCN_STC_STATE_CODE,
decode(lcn_adt_address_type,'P',LCN_ZIP_CODE,to_char(NULL)) PHY_LCN_ZIP_CODE,
decode(lcn_adt_address_type,'P',LCN_CNT_COUNTY_CODE,to_char(NULL)) PHY_LCN_CNT_COUNTY_CODE,
decode(lcn_adt_address_type,'P',END_DATE,to_char(NULL)) PHY_END_DATE,
decode(lcn_adt_address_type,'P',LCN_VEN_VENDOR_ID_GTA,to_char(NULL)) PHY_LCN_VEN_VENDOR_ID_GTA,
decode(lcn_adt_address_type,'P',LCN_SUB_LOCATION_GTA,to_char(NULL)) PHY_LCN_SUB_LOCATION_GTA,
decode(lcn_adt_address_type,'P',LCN_DIRECTION_GTA,to_char(NULL)) PHY_LCN_DIRECTION_GTA,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_PARAMETER_ID,to_char(NULL)) LOW_LCN_PARAMETER_ID,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CURRENT_ADDRESS_IND,to_char(NULL)) LOW_LCN_CURRENT_ADDRESS_IND,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_STATUS_CODE,to_char(NULL)) LOW_LCN_STATUS_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LTY_LOCATION_TYPE,to_char(NULL)) LOW_LCN_LTY_LOCATION_TYPE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADT_ADDRESS_TYPE,to_char(NULL)) LOW_LCN_ADT_ADDRESS_TYPE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_HOUSE_NO,to_char(NULL)) LOW_LCN_HOUSE_NO,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADDRESS_LINE_1,to_char(NULL)) LOW_LCN_ADDRESS_LINE_1,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ADDRESS_LINE_2,to_char(NULL)) LOW_LCN_ADDRESS_LINE_2,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CITY,to_char(NULL)) LOW_LCN_CITY,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_STC_STATE_CODE,to_char(NULL)) LOW_LCN_STC_STATE_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_ZIP_CODE,to_char(NULL)) LOW_LCN_ZIP_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_CNT_COUNTY_CODE,to_char(NULL)) LOW_LCN_CNT_COUNTY_CODE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LANDLORD,to_char(NULL)) LOW_LCN_LANDLORD,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_LANDLORD_PHONE,to_char(NULL)) LOW_LCN_LANDLORD_PHONE,
decode(LCN_ADT_ADDRESS_TYPE,'D',END_DATE,to_char(NULL)) LOW_END_DATE,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_SUB_LOCATION_GTA,to_char(NULL)) LOW_LCN_SUB_LOCATION_GTA,
decode(LCN_ADT_ADDRESS_TYPE,'D',LCN_DIRECTION_GTA,to_char(NULL)) LOW_LCN_DIRECTION_GTA
FROM LOCATIONS LOC
WHERE (LCN_LTY_LOCATION_TYPE ='AS' OR LCN_ADT_ADDRESS_TYPE='D')
AND LCN_CURRENT_ADDRESS_IND ='Y'
thanks -
Multiple rows Converge to Single row and join
Hi Folks,
I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
Table 1: DTL_TABLE (id, period, course, names, title, type)
1 2010 mat john null null
1 2010 mat jim null null
1 2010 cam null officer null
1 2010 cam null Prof null
1 2010 phy null null Inclass
1 2010 phy null null Online
Join with
Table 2: ID_TABLE(id, period, Loc, Dept, Code)
1 2010 nj 101 CC.
Output format (id, period, course, names, title, type, Loc, Dept, Code)
result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
Thank you,
Aj
CREATE TABLE DTL_TABLE
ids VARCHAR2 (10),
period VARCHAR2 (10),
course VARCHAR2 (10),
names VARCHAR2 (10),
title VARCHAR2 (10),
TYPE VARCHAR2 (10)
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'jim',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'john',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'mat',
'kale',
NULL,
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'cam',
NULL,
'officer',
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'cam',
NULL,
'prof',
NULL);
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'phy',
NULL,
NULL,
'inclass');
INSERT INTO DTL_TABLE
VALUES ('1',
'2010',
'phy',
NULL,
NULL,
'online');
COMMIT;
CREATE TABLE id_table
ids VARCHAR2 (10),
period VARCHAR2 (10),
loc VARCHAR2 (10),
dept VARCHAR2 (10),
code VARCHAR2 (10)
INSERT INTO id_table
VALUES ('1',
'2010',
'nj',
'101',
'cc');
COMMIT;Aj09 wrote:
Hi Folks,
I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
Table 1: DTL_TABLE (id, period, course, names, title, type)
1 2010 mat john null null
1 2010 mat jim null null
1 2010 cam null officer null
1 2010 cam null Prof null
1 2010 phy null null Inclass
1 2010 phy null null Online
Join with
Table 2: ID_TABLE(id, period, Loc, Dept, Code)
1 2010 nj 101 CC.
Output format (id, period, course, names, title, type, Loc, Dept, Code)
result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
SELECT TBL.id,
DTLperiod,
course,
names,
title,
TYPE,
Loc,
Dept,
Code
FROM ID_TABLE TBL,
DTL_TABLE DTL
WHERE TBL.ID = DTL.ID
AND TBL.PERIOD = DTL.PERIOD; it not good to use RESERVED WORDS like "ID" or "TYPE" as column names -
Merging Multiple Rows into a single Row
I've read a number of posts with no real good answers or answers that might be good for tables with 3 columns of data. I have a table with 33 columns that will all need to be combined. A little history. Apparently in production the Primary Key Constraint
was dropped which allowed some duplicate data into the table. Now they want me to squish the records together to fix it.
Sorry I couldn't include the screen shot of the data, MSDN says my account isn't verified...
My requirements when I'm putting them together, CERElibilityID is a unique column. This is a sticky problem because in the related tables it is only one of the parent records gets child records related to it.
I just want to keep the one that has the child records in CERPrepActivity table. If there are no child records then the rule will be like all the other records with data.
If a field is null and another record has data we take the record that has data.
If multiple records have data we take the record that has the highest "ModifiedOn" timestamp column value.
I feel like I'm asking a lot, but I'm in a bit of a bind and I've spent the morning Googling and have come up with nothing
Thank you for any help the community can provide and the more specific you can be the better. I'm not a DBA or SQL guru by any stretch so I'm way out of my element.
ThanksUsing the systables, you can get information about your table. I put these together:
SELECT '
LEFT OUTER JOIN #CEREligibility ['+c.name+']
ON s.caseID = ['+c.name+'].caseID
AND s.modifiedOn = ['+c.name+'].modifiedOn
AND ['+c.name+'].['+c.name+'] = (SELECT TOP 1 ['+c.name+'] FROM #CEREligibility WHERE caseID = s.caseID AND ['+c.name+'] IS NOT NULL ORDER BY ModifiedOn)
AND ['+c.name+'].['+c.name+'] IS NOT NULL'
FROM tempdb.sys.objects o
INNER JOIN tempdb.sys.columns c
ON o.object_id = c.object_id
AND o.name LIKE '#CEREligibility%'
SELECT '['+c.name+'].['+c.name+'] AS ['+c.name+'], '
FROM tempdb.sys.objects o
INNER JOIN tempdb.sys.columns c
ON o.object_id = c.object_id
AND o.name LIKE '#CEREligibility%'
On my test system I created your table as a temp table named #CEREligibility.
The first of these two queries generates LEFT OUT JOIN SQL for a self join. Because we're using the columns systable, a LOJ for each column is generated.
The second, produces a select list.
Putting the two together like so, and adding a FROM and GROUP BY gives us:
SELECT
MAX([CEREligibilityId].[CEREligibilityId]) AS [CEREligibilityId], s.[CaseId], MAX([M2Eligibility].[M2Eligibility]) AS [M2Eligibility], MAX([CDREligibility].[CDREligibility]) AS [CDREligibility], MAX([M2Comments].[M2Comments]) AS [M2Comments], MAX([M2CommentsRtf].[M2CommentsRtf]) AS [M2CommentsRtf], MAX([CDRComments].[CDRComments]) AS [CDRComments], MAX([CDRCommentsRtf].[CDRCommentsRtf]) AS [CDRCommentsRtf], MAX([RIAWA].[RIAWA]) AS [RIAWA], MAX([RIAWADate].[RIAWADate]) AS [RIAWADate], MAX([EducationAndTraining].[EducationAndTraining]) AS [EducationAndTraining], MAX([EducationAndTrainingDate].[EducationAndTrainingDate]) AS [EducationAndTrainingDate], MAX([Internship].[Internship]) AS [Internship], MAX([InternshipDate].[InternshipDate]) AS [InternshipDate], MAX([Apprenticeship].[Apprenticeship]) AS [Apprenticeship], MAX([ApprenticeshipDate].[ApprenticeshipDate]) AS [ApprenticeshipDate], MAX([Entrepreneurship].[Entrepreneurship]) AS [Entrepreneurship], MAX([EntrepreneurshipDate].[EntrepreneurshipDate]) AS [EntrepreneurshipDate], MAX([EmploymentPrep].[EmploymentPrep]) AS [EmploymentPrep], MAX([EmploymentPrepDate].[EmploymentPrepDate]) AS [EmploymentPrepDate], MAX([OTPrep].[OTPrep]) AS [OTPrep], MAX([OTPrepDate].[OTPrepDate]) AS [OTPrepDate], MAX([ExitInterview].[ExitInterview]) AS [ExitInterview], MAX([ExitInterviewDate].[ExitInterviewDate]) AS [ExitInterviewDate], MAX([CreatedOn].[CreatedOn]) AS [CreatedOn], MAX([CreatedBy].[CreatedBy]) AS [CreatedBy], MAX([ModifiedOn].[ModifiedOn]) AS [ModifiedOn], MAX([ModifiedBy].[ModifiedBy]) AS [ModifiedBy], MAX([BCPermInEligibility].[BCPermInEligibility]) AS [BCPermInEligibility], MAX([CCPermInEligibility].[CCPermInEligibility]) AS [CCPermInEligibility], MAX([M2EligibilityDate].[M2EligibilityDate]) AS [M2EligibilityDate], MAX([CDREligibilityDate].[CDREligibilityDate]) AS [CDREligibilityDate], MAX([ExitSeparationCode].[ExitSeparationCode]) AS [ExitSeparationCode], MAX([ExitSeparationSubCode].[ExitSeparationSubCode]) AS [ExitSeparationSubCode]
FROM #CEREligibility s
LEFT OUTER JOIN #CEREligibility [CEREligibilityId]
ON s.caseID = [CEREligibilityId].caseID
AND s.modifiedOn = [CEREligibilityId].modifiedOn
AND [CEREligibilityId].[CEREligibilityId] = (SELECT TOP 1 [CEREligibilityId] FROM #CEREligibility WHERE caseID = s.caseID AND [CEREligibilityId] IS NOT NULL ORDER BY ModifiedOn)
AND [CEREligibilityId].[CEREligibilityId] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CaseId]
ON s.caseID = [CaseId].caseID
AND s.modifiedOn = [CaseId].modifiedOn
AND [CaseId].[CaseId] = (SELECT TOP 1 [CaseId] FROM #CEREligibility WHERE caseID = s.caseID AND [CaseId] IS NOT NULL ORDER BY ModifiedOn)
AND [CaseId].[CaseId] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [M2Eligibility]
ON s.caseID = [M2Eligibility].caseID
AND s.modifiedOn = [M2Eligibility].modifiedOn
AND [M2Eligibility].[M2Eligibility] = (SELECT TOP 1 [M2Eligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [M2Eligibility] IS NOT NULL ORDER BY ModifiedOn)
AND [M2Eligibility].[M2Eligibility] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CDREligibility]
ON s.caseID = [CDREligibility].caseID
AND s.modifiedOn = [CDREligibility].modifiedOn
AND [CDREligibility].[CDREligibility] = (SELECT TOP 1 [CDREligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [CDREligibility] IS NOT NULL ORDER BY ModifiedOn)
AND [CDREligibility].[CDREligibility] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [M2Comments]
ON s.caseID = [M2Comments].caseID
AND s.modifiedOn = [M2Comments].modifiedOn
AND [M2Comments].[M2Comments] = (SELECT TOP 1 [M2Comments] FROM #CEREligibility WHERE caseID = s.caseID AND [M2Comments] IS NOT NULL ORDER BY ModifiedOn)
AND [M2Comments].[M2Comments] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [M2CommentsRtf]
ON s.caseID = [M2CommentsRtf].caseID
AND s.modifiedOn = [M2CommentsRtf].modifiedOn
AND [M2CommentsRtf].[M2CommentsRtf] = (SELECT TOP 1 [M2CommentsRtf] FROM #CEREligibility WHERE caseID = s.caseID AND [M2CommentsRtf] IS NOT NULL ORDER BY ModifiedOn)
AND [M2CommentsRtf].[M2CommentsRtf] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CDRComments]
ON s.caseID = [CDRComments].caseID
AND s.modifiedOn = [CDRComments].modifiedOn
AND [CDRComments].[CDRComments] = (SELECT TOP 1 [CDRComments] FROM #CEREligibility WHERE caseID = s.caseID AND [CDRComments] IS NOT NULL ORDER BY ModifiedOn)
AND [CDRComments].[CDRComments] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CDRCommentsRtf]
ON s.caseID = [CDRCommentsRtf].caseID
AND s.modifiedOn = [CDRCommentsRtf].modifiedOn
AND [CDRCommentsRtf].[CDRCommentsRtf] = (SELECT TOP 1 [CDRCommentsRtf] FROM #CEREligibility WHERE caseID = s.caseID AND [CDRCommentsRtf] IS NOT NULL ORDER BY ModifiedOn)
AND [CDRCommentsRtf].[CDRCommentsRtf] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [RIAWA]
ON s.caseID = [RIAWA].caseID
AND s.modifiedOn = [RIAWA].modifiedOn
AND [RIAWA].[RIAWA] = (SELECT TOP 1 [RIAWA] FROM #CEREligibility WHERE caseID = s.caseID AND [RIAWA] IS NOT NULL ORDER BY ModifiedOn)
AND [RIAWA].[RIAWA] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [RIAWADate]
ON s.caseID = [RIAWADate].caseID
AND s.modifiedOn = [RIAWADate].modifiedOn
AND [RIAWADate].[RIAWADate] = (SELECT TOP 1 [RIAWADate] FROM #CEREligibility WHERE caseID = s.caseID AND [RIAWADate] IS NOT NULL ORDER BY ModifiedOn)
AND [RIAWADate].[RIAWADate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [EducationAndTraining]
ON s.caseID = [EducationAndTraining].caseID
AND s.modifiedOn = [EducationAndTraining].modifiedOn
AND [EducationAndTraining].[EducationAndTraining] = (SELECT TOP 1 [EducationAndTraining] FROM #CEREligibility WHERE caseID = s.caseID AND [EducationAndTraining] IS NOT NULL ORDER BY ModifiedOn)
AND [EducationAndTraining].[EducationAndTraining] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [EducationAndTrainingDate]
ON s.caseID = [EducationAndTrainingDate].caseID
AND s.modifiedOn = [EducationAndTrainingDate].modifiedOn
AND [EducationAndTrainingDate].[EducationAndTrainingDate] = (SELECT TOP 1 [EducationAndTrainingDate] FROM #CEREligibility WHERE caseID = s.caseID AND [EducationAndTrainingDate] IS NOT NULL ORDER BY ModifiedOn)
AND [EducationAndTrainingDate].[EducationAndTrainingDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [Internship]
ON s.caseID = [Internship].caseID
AND s.modifiedOn = [Internship].modifiedOn
AND [Internship].[Internship] = (SELECT TOP 1 [Internship] FROM #CEREligibility WHERE caseID = s.caseID AND [Internship] IS NOT NULL ORDER BY ModifiedOn)
AND [Internship].[Internship] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [InternshipDate]
ON s.caseID = [InternshipDate].caseID
AND s.modifiedOn = [InternshipDate].modifiedOn
AND [InternshipDate].[InternshipDate] = (SELECT TOP 1 [InternshipDate] FROM #CEREligibility WHERE caseID = s.caseID AND [InternshipDate] IS NOT NULL ORDER BY ModifiedOn)
AND [InternshipDate].[InternshipDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [Apprenticeship]
ON s.caseID = [Apprenticeship].caseID
AND s.modifiedOn = [Apprenticeship].modifiedOn
AND [Apprenticeship].[Apprenticeship] = (SELECT TOP 1 [Apprenticeship] FROM #CEREligibility WHERE caseID = s.caseID AND [Apprenticeship] IS NOT NULL ORDER BY ModifiedOn)
AND [Apprenticeship].[Apprenticeship] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ApprenticeshipDate]
ON s.caseID = [ApprenticeshipDate].caseID
AND s.modifiedOn = [ApprenticeshipDate].modifiedOn
AND [ApprenticeshipDate].[ApprenticeshipDate] = (SELECT TOP 1 [ApprenticeshipDate] FROM #CEREligibility WHERE caseID = s.caseID AND [ApprenticeshipDate] IS NOT NULL ORDER BY ModifiedOn)
AND [ApprenticeshipDate].[ApprenticeshipDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [Entrepreneurship]
ON s.caseID = [Entrepreneurship].caseID
AND s.modifiedOn = [Entrepreneurship].modifiedOn
AND [Entrepreneurship].[Entrepreneurship] = (SELECT TOP 1 [Entrepreneurship] FROM #CEREligibility WHERE caseID = s.caseID AND [Entrepreneurship] IS NOT NULL ORDER BY ModifiedOn)
AND [Entrepreneurship].[Entrepreneurship] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [EntrepreneurshipDate]
ON s.caseID = [EntrepreneurshipDate].caseID
AND s.modifiedOn = [EntrepreneurshipDate].modifiedOn
AND [EntrepreneurshipDate].[EntrepreneurshipDate] = (SELECT TOP 1 [EntrepreneurshipDate] FROM #CEREligibility WHERE caseID = s.caseID AND [EntrepreneurshipDate] IS NOT NULL ORDER BY ModifiedOn)
AND [EntrepreneurshipDate].[EntrepreneurshipDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [EmploymentPrep]
ON s.caseID = [EmploymentPrep].caseID
AND s.modifiedOn = [EmploymentPrep].modifiedOn
AND [EmploymentPrep].[EmploymentPrep] = (SELECT TOP 1 [EmploymentPrep] FROM #CEREligibility WHERE caseID = s.caseID AND [EmploymentPrep] IS NOT NULL ORDER BY ModifiedOn)
AND [EmploymentPrep].[EmploymentPrep] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [EmploymentPrepDate]
ON s.caseID = [EmploymentPrepDate].caseID
AND s.modifiedOn = [EmploymentPrepDate].modifiedOn
AND [EmploymentPrepDate].[EmploymentPrepDate] = (SELECT TOP 1 [EmploymentPrepDate] FROM #CEREligibility WHERE caseID = s.caseID AND [EmploymentPrepDate] IS NOT NULL ORDER BY ModifiedOn)
AND [EmploymentPrepDate].[EmploymentPrepDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [OTPrep]
ON s.caseID = [OTPrep].caseID
AND s.modifiedOn = [OTPrep].modifiedOn
AND [OTPrep].[OTPrep] = (SELECT TOP 1 [OTPrep] FROM #CEREligibility WHERE caseID = s.caseID AND [OTPrep] IS NOT NULL ORDER BY ModifiedOn)
AND [OTPrep].[OTPrep] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [OTPrepDate]
ON s.caseID = [OTPrepDate].caseID
AND s.modifiedOn = [OTPrepDate].modifiedOn
AND [OTPrepDate].[OTPrepDate] = (SELECT TOP 1 [OTPrepDate] FROM #CEREligibility WHERE caseID = s.caseID AND [OTPrepDate] IS NOT NULL ORDER BY ModifiedOn)
AND [OTPrepDate].[OTPrepDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ExitInterview]
ON s.caseID = [ExitInterview].caseID
AND s.modifiedOn = [ExitInterview].modifiedOn
AND [ExitInterview].[ExitInterview] = (SELECT TOP 1 [ExitInterview] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitInterview] IS NOT NULL ORDER BY ModifiedOn)
AND [ExitInterview].[ExitInterview] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ExitInterviewDate]
ON s.caseID = [ExitInterviewDate].caseID
AND s.modifiedOn = [ExitInterviewDate].modifiedOn
AND [ExitInterviewDate].[ExitInterviewDate] = (SELECT TOP 1 [ExitInterviewDate] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitInterviewDate] IS NOT NULL ORDER BY ModifiedOn)
AND [ExitInterviewDate].[ExitInterviewDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CreatedOn]
ON s.caseID = [CreatedOn].caseID
AND s.modifiedOn = [CreatedOn].modifiedOn
AND [CreatedOn].[CreatedOn] = (SELECT TOP 1 [CreatedOn] FROM #CEREligibility WHERE caseID = s.caseID AND [CreatedOn] IS NOT NULL ORDER BY ModifiedOn)
AND [CreatedOn].[CreatedOn] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CreatedBy]
ON s.caseID = [CreatedBy].caseID
AND s.modifiedOn = [CreatedBy].modifiedOn
AND [CreatedBy].[CreatedBy] = (SELECT TOP 1 [CreatedBy] FROM #CEREligibility WHERE caseID = s.caseID AND [CreatedBy] IS NOT NULL ORDER BY ModifiedOn)
AND [CreatedBy].[CreatedBy] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ModifiedOn]
ON s.caseID = [ModifiedOn].caseID
AND s.modifiedOn = [ModifiedOn].modifiedOn
AND [ModifiedOn].[ModifiedOn] = (SELECT TOP 1 [ModifiedOn] FROM #CEREligibility WHERE caseID = s.caseID AND [ModifiedOn] IS NOT NULL ORDER BY ModifiedOn)
AND [ModifiedOn].[ModifiedOn] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ModifiedBy]
ON s.caseID = [ModifiedBy].caseID
AND s.modifiedOn = [ModifiedBy].modifiedOn
AND [ModifiedBy].[ModifiedBy] = (SELECT TOP 1 [ModifiedBy] FROM #CEREligibility WHERE caseID = s.caseID AND [ModifiedBy] IS NOT NULL ORDER BY ModifiedOn)
AND [ModifiedBy].[ModifiedBy] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [BCPermInEligibility]
ON s.caseID = [BCPermInEligibility].caseID
AND s.modifiedOn = [BCPermInEligibility].modifiedOn
AND [BCPermInEligibility].[BCPermInEligibility] = (SELECT TOP 1 [BCPermInEligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [BCPermInEligibility] IS NOT NULL ORDER BY ModifiedOn)
AND [BCPermInEligibility].[BCPermInEligibility] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CCPermInEligibility]
ON s.caseID = [CCPermInEligibility].caseID
AND s.modifiedOn = [CCPermInEligibility].modifiedOn
AND [CCPermInEligibility].[CCPermInEligibility] = (SELECT TOP 1 [CCPermInEligibility] FROM #CEREligibility WHERE caseID = s.caseID AND [CCPermInEligibility] IS NOT NULL ORDER BY ModifiedOn)
AND [CCPermInEligibility].[CCPermInEligibility] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [M2EligibilityDate]
ON s.caseID = [M2EligibilityDate].caseID
AND s.modifiedOn = [M2EligibilityDate].modifiedOn
AND [M2EligibilityDate].[M2EligibilityDate] = (SELECT TOP 1 [M2EligibilityDate] FROM #CEREligibility WHERE caseID = s.caseID AND [M2EligibilityDate] IS NOT NULL ORDER BY ModifiedOn)
AND [M2EligibilityDate].[M2EligibilityDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [CDREligibilityDate]
ON s.caseID = [CDREligibilityDate].caseID
AND s.modifiedOn = [CDREligibilityDate].modifiedOn
AND [CDREligibilityDate].[CDREligibilityDate] = (SELECT TOP 1 [CDREligibilityDate] FROM #CEREligibility WHERE caseID = s.caseID AND [CDREligibilityDate] IS NOT NULL ORDER BY ModifiedOn)
AND [CDREligibilityDate].[CDREligibilityDate] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ExitSeparationCode]
ON s.caseID = [ExitSeparationCode].caseID
AND s.modifiedOn = [ExitSeparationCode].modifiedOn
AND [ExitSeparationCode].[ExitSeparationCode] = (SELECT TOP 1 [ExitSeparationCode] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitSeparationCode] IS NOT NULL ORDER BY ModifiedOn)
AND [ExitSeparationCode].[ExitSeparationCode] IS NOT NULL
LEFT OUTER JOIN #CEREligibility [ExitSeparationSubCode]
ON s.caseID = [ExitSeparationSubCode].caseID
AND s.modifiedOn = [ExitSeparationSubCode].modifiedOn
AND [ExitSeparationSubCode].[ExitSeparationSubCode] = (SELECT TOP 1 [ExitSeparationSubCode] FROM #CEREligibility WHERE caseID = s.caseID AND [ExitSeparationSubCode] IS NOT NULL ORDER BY ModifiedOn)
AND [ExitSeparationSubCode].[ExitSeparationSubCode] IS NOT NULL
GROUP BY s.caseID
When I ran this against your test data, It produced a single row for each of the two case ID's.
To keep performance in line, I also created a covering index on the temp table:
CREATE INDEX idx_caseID_ModifiedOn ON #CEREligibility (caseID, modifiedOn) INCLUDE ([CEREligibilityId], [M2Eligibility], [CDREligibility], [M2Comments], [M2CommentsRtf], [CDRComments], [CDRCommentsRtf], [RIAWA], [RIAWADate], [EducationAndTraining], [EducationAndTrainingDate], [Internship], [InternshipDate], [Apprenticeship], [ApprenticeshipDate], [Entrepreneurship], [EntrepreneurshipDate], [EmploymentPrep], [EmploymentPrepDate], [OTPrep], [OTPrepDate], [ExitInterview], [ExitInterviewDate], [CreatedOn], [CreatedBy], [ModifiedBy], [BCPermInEligibility], [CCPermInEligibility], [M2EligibilityDate], [CDREligibilityDate], [ExitSeparationCode], [ExitSeparationSubCode])
Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question. -
Oracle query - Merging multiple rows into a single row output
Hi All,
I have to have a multiple row output to be converted into a single row output.My current output looks as follows:
ID YR INC_CODE OFFN SCHOOLNO
8006 2002 00175 SC03 12
8006 2002 00175 DC06 12
8006 2002 00175 DC03 12
8006 2002 00175 DC02 12
ID,INCIDENT CODE,OFFENSE are all Primary keys
So I need the output as follows:(IN ONE ROW)
ID YR INC_CODE OFFN1 OFFN2 OFFN3 OFFN4 SCHOOLNO
8006 2002 00175 SC03 DC06 DC03 DC02 12
Can you help me on this since have been spinning the wheel and this has to be a query since will have couple of tables join to produce a materialized view.
Thanks in advanceHi Nigel,
Thanks for the reply I tested out the portion having the decode and I get the output as follows:
ID YR INC_CODE OFFN1 OFFN2 OFFN3 OFFN4 OFFN5
8982 2002 2175 DOC01 -----------------------
8982 2002 2175 DOC02-------------------
8982 2002 2175 DOC03------------
8982 2002 2175 DOC06-------
8982 2002 2175 SCV03
There is no value as max for OFFN and each INC_CODE MAY HAVE UP TO A MAX OF 5 OFFN.My query is as follows:
select distinct STU_STUDENT_ID, INC_BEG_SCH_YR,INC_INCIDENT_CODE
, decode(rank() over (partition by INC_CODE order by OFFN),1,OFFN,null) as offn1
, decode(rank() over (partition by INC_CODE order by OFFN),2,OFFN,null) as offn2
, decode(rank() over (partition by INC_CODE order by OFFN),3,OFFN,null) as offn3
, decode(rank() over (partition by INC_CODE order by OFFN),4,OFFN,null) as offn4
, decode(rank() over (partition by INC_CODE order by OFFN),5,OFFN,null) as offn5
from stu_offn where
stu_offn.ID = '8982' and stu_offn.INC_CODE = '2175'
(****Where clause is just given to just check a value)
So as you know I need to just have all the OFFN in a single row ie as follows:
ID YR INC_CODE OFFN1 OFFN2 OFFN3 OFFN4 OFFN5
8982 2002 2175 DOC01 DOC02 DOC03 DOC06 SCV03
Can you just give me a step by step procedure to go through this and the table in this case is just 'STU_OFFN'
Thanks for the earlier reply appreciate it!
****Sending this again to show the exact way the output is coming -
Customizing Sharepoint Calendar Week Group View to display multiple weeks in a single row
Hi,
SharePoint Calendar's Week Group View is useful for comparing multiple co-worker's schedule, and we have a business needs to be able to view the schedule for with the date range of more than one week at a time between co-workers for planning purposes, is
there a way (code or no-code) to manipulate the date/week range so that the calendar display more than 7 days in a single row?Hi,
As there is no such OOTB feature, I would suggest that you can change the calendar scope to “Month” or create a Gantt view to display more weeks in a view.
Or you can try to create a custom calendar web part to meet your requirement.
Here are some samples of custom calendar web part for your reference:
http://www.codeproject.com/Articles/108676/SharePoint-Custom-Calendar
http://gunnarpeipman.com/2009/01/creating-sharepoint-global-calendar/
https://blog.metrostarsystems.com/2013/10/21/creating-a-custom-sharepoint-calendar-rollup/
Best regards
Patrick Liang
TechNet Community Support -
Inserting table in web form/ Inserting multiple cells in a single row
Dear Mr Johnson,
Thanks for your early reply.
I am rather disappointed .....as I need to distribute my form urgently with a table insertion capability.
I had purchased Adobe webform central subscription with the idea that a paid subscription will fetch me the full editing capability of the Adobe form central web forms.
Please inform me as to when this vital update regarding the table insertion/ multiple cells insertion in a single row capability (update) will be functional and available for our use as today is 26th of January, 2013.
Kindly reply ASAP.
Thanks,
with kind regards,
Dr AliSee this thread from two days ago where Randy Swineford of Adobe says that it is expected to be added at the end of January: http://forums.adobe.com/thread/1140470?tstart=0
I don't know if it will include a table tool. -
Multiple row as a single row in a column
Hi,
I want to select Multiple rows into a single line in 'Single Column Table' .
For ex:
Employee table has only one column , named as empname . it has three rows
Select empname from emp;
empname
thambi
peter
antony
My expected result: thambi,peter,antonyHow do I ask a question on the forums?
https://forums.oracle.com/forums/thread.jspa?threadID=2174552#9360002 -
Multiple clobs in a single row of data
I have several clobs in a single row of data and have created a procedure where I attempt to display the first 4k of each clob.
using a for loop cursor I select all of the clobs in a row at the same time and then I use dbms_lob.read to get the first 4k of data.
For the first lob of each row everything works fine but when I attempt to dbms_lob.read the second one I get an "ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275" and I'm not sure why?
does anyone know of an example where two or more clobs are selected and then converted to 4K varchars?
sample columns for the table:
SPECIALREQUIREMENTSS CLOB
REFERENCERANGE CLOB
ALERTVALUE CLOB
REFERENCELAB VARCHAR2(50 CHAR)
TESTINCLUDES CLOB
LASTUPDATE DATE
sample code (I removed some code for clairity - this produces the same error):
create or replace
procedure test_lobs as
v_lab_blob blob;
v_lobamt binary_integer := 32767;
v_lobpos pls_integer := 1;
v_labrec labman.lab_testingdata%rowtype;
v_buffer varchar2(32767) :='';
v_start_left number;
begin
-- *** housekeeping
dbms_lob.createtemporary(v_labrec.testincludes,TRUE);
dbms_lob.createtemporary(v_labrec.specialrequirementss,TRUE);
Plpdf.init;
Plpdf.NewPage;
Plpdf.SetColor4Drawing(66,66,66);
Plpdf.SetColor4Filling(180,180,180);
v_start_left := Plpdf.GetPageWidth-Plpdf.GetPageRightSpace;
-- *** select the test name for shaded printing
for x in (select indexnumber, test from labman.lab_testingdata where test like 'A%') loop
-- *** select the test data for printing
select * into v_labrec from labman.lab_testingdata where indexnumber = x.indexnumber;
-- *** test includes
if dbms_lob.getlength(v_labrec.testincludes) > 0 or v_labrec.testincludes is not null then
Plpdf.SetPrintFont('Arial','B',8);
Plpdf.LineBreak(.1);
Plpdf.PrintCell(25,5,'Test Includes:',0,0,'R',0,null,0);
Plpdf.SetPrintFont('Arial',null,8);
if dbms_lob.getlength(v_labrec.testincludes) > 32767 then
v_buffer := '*** error - text is greater than 32k ***';
else
v_lobamt := 32767;
v_buffer := '';
dbms_lob.read(v_labrec.testincludes,v_lobamt,v_lobpos,v_buffer);
end if;
Plpdf.SetLeftMargin(Plpdf.GetCurrentX);
Plpdf.PrintFlowingText(5,v_buffer,null,0);
Plpdf.SetLeftMargin(v_start_left);
Plpdf.lineBreak;
end if;
-- *** special requirements
Plpdf.SetPrintFont('Arial','B',8);
Plpdf.LineBreak(.1);
Plpdf.PrintCell(25,5,'Special Requirements:',0,0,'R',0,null,0);
Plpdf.SetPrintFont('Arial',null,8);
if dbms_lob.getlength(v_labrec.specialrequirementss) > 32767 then
v_buffer := '*** error - text is greater than 32k ***';
elsif dbms_lob.getlength(v_labrec.specialrequirementss) = 0 then
v_buffer := '';
else
v_lobamt := 32767;
v_buffer := '';
dbms_lob.read(v_labrec.specialrequirementss,v_lobamt,v_lobpos,v_buffer);
end if;
Plpdf.SetLeftMargin(Plpdf.GetCurrentX);
Plpdf.PrintFlowingText(5,v_buffer,null,0);
Plpdf.SetLeftMargin(v_start_left);
Plpdf.lineBreak;
commit;
end loop;
Plpdf.SendDoc(v_lab_blob);
-- store the PDF document
delete from store_blob;
commit;
INSERT INTO STORE_BLOB (blob_file, created_date)
VALUES (v_lab_blob, SYSDATE);
COMMIT;
end test_lobs;didn't think that checking for a length of zero and null would produce two different results - should have known better.
Thanks for your help!
elsif dbms_lob.getlength(v_labrec.specialrequirementss) = 0
or v_labrec.specialrequirementss is null then -
Showing multiple Objects in a single row in Gantt Chart
Hi,
I am wokring on extending the cPro4.5 gantt chart.
I have a tree hierarchy which I want to display on the Gantt Chart. But my need is to display all the children and its parent in single row i.e. in a new row bove the Poject row in the gantt tree (hierarchy shown on the left side) of existing chart.
Is it possible with the Gantt chart?
If yes, then where and how do I pass this information to the transformation I call in the end to convert the abap tables into XML file which is finally shown on the gantt.
Kindly guide.
Regards,
VarunHi Varum,
Sorry but I think I don't understand your requirement. Do you need see on the left of your gantt project structure?
Thanks,
Sara -
Merge multiple rows to get single row result
Hi,
Below is the sample data from my table USERINFO-
personid userid username orgid
1234 1235 TOM 1
2345 2346 HARRY 1
1111 2222 BOND 2
3333 4444 BERY 2
Now I want a query which can give me the following result-
personid userid username personid userid username orgid
1234 1235 TOM 2345 2346 HARRY 1
1111 2222 BOND 3333 4444 BERY 2
i.e., two records belonging to the same orgid should be merged into a single row resulset.
Please let me know the SQL query to get the desired result.
ThanksSQL> select * from test_otn;
PERSONID USERID USERNAME ORGID
1234 1235 TOM 1
2345 2346 HARRY 1
1111 2222 BOND 2
3333 4444 BERY 2
SQL> select max(decode(rn, 1, personid, null)) person_id1,
2 max(decode(rn, 2, personid, null)) person_id2,
3 max(decode(rn, 1, userid, null)) user_id1,
4 max(decode(rn, 2, userid, null)) user_id2,
5 max(decode(rn, 1, username, null)) username1,
6 max(decode(rn, 2, username, null)) username2,
7 orgid
8 from
9 (select row_number() over (partition by orgid order by orgid) rn,
10 personid, userid, username, orgid from test_otn)
11 group by orgid
12 /
PERSON_ID1 PERSON_ID2 USER_ID1 USER_ID2 USERNAME1 USERNAME2 ORGID
1234 2345 1235 2346 TOM HARRY 1
1111 3333 2222 4444 BOND BERY 2
Thx,
SriDHAR -
Need Multiple rows in a single Row in ALV
Hi Experts,
Here is the example which i want to implement. Please suggest the best.
This is what I have now in ALV.
ID Name ActionType ActionDt
1 aaa Joining 01.02.2011
1 aaa Seperation 05.05.2011
2 bbb Joining 01.04.2011
2 bbb Seperation 25.05.2011
This is what I need.
ID Name ActionDt ActionType(Join) ActionDt ActionType(Seperation)
1 aaa 01.02.2011 Joining 05.05.2011 Seperation
2 bbb 01.04.2011 Joining 25.05.2011 Seperation
Thanks in Advance,
Dinesh
Moderator message : Spec dumping is not allowed, search for available information or show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Aug 19, 2011 2:06 PMHi,
Here are the steps how you can do it.
1. Create a table.
2. In the Library palette, click the Standard category and drag the Table object into a cell in the main table.
Note: If you selected Donu2019t Show This Again in the Insert Table dialog box, when you select the Table object from the Library palette, LiveCycle Designer automatically inserts a table with the same number of columns and rows that you inserted the last time you used the Insert Table dialog box.
3. In the Insert Table dialog box, enter the number of columns and rows. You can enter a maximum of 20 columns and 50 rows. You can add more columns and rows after the table is created by using the Insert commands on the Table menu.
4. To add a header row, select Include Header Row In Table.
5. To add a footer row, select the Include Footer Row In Table.
6. Click OK.
Regards
Runal -
IXMLDOMDocumentPtr save method is saving the z:row tags in single row.
When i am trying to create a IXMLDOMDocumentPtr and using appendchild populating the domdocument object and finally saving it to the xmlfile the appended rows comes in a single row if we open in notepad.
here is the code snippet:
IXMLDOMElementPtr pXMLDOMElement;
pXMLDOMElement = pXMLDOMNodeRSData->appendChild(pXMLDOMDoc->createElement("z:row"));
pXMLDOMElement->setAttribute("PARAMETERS_KEY", bstrParamKey);
pXMLDOMElement->setAttribute("PARAMETERS_SECTION", paramOrder);
pXMLDOMElement->setAttribute("PARAMETERS_VALUE", paramValue);
pXMLDOMElement->setAttribute("DESCRIPTION", paramDesc);
hr = pXMLDOMDoc->save(tszFilePath);
shown as below:
<z:row PARAMETERS_KEY="ECL_PROFILE_ID" PARAMETERS_SECTION="100" PARAMETERS_VALUE="1" DESCRIPTION="Sucursal CLP"/><z:row PARAMETERS_KEY="ECL_PROFILE_ID" PARAMETERS_SECTION="101" PARAMETERS_VALUE="1"
DESCRIPTION="Sucursal USD"/>Please reply...
Maybe you are looking for
-
How do I remove old e-mail addresses from the Mail Memory?
I have friends who have changed the e-mail addresses, and quite some time ago also. But everytime I write their name in the address field, it still brings up the old address as an option. And if I'm not paying attention it sends to the old address. I
-
HI, I am trying to trigger a workflow whenever a contract is created against the Requisition. I put the trace on(SWELS) and created a contract and got BOR object FREBUS2012 and Event CREATED. But when i am using this BOR object and Event in the start
-
I have the most recent update.
-
Providing links to view information in different languages
Hi All, In one of my iViews which displays some company related information, I have to provide links "Read in French", "Read in Spanish". These links basically should show the translated content for the respective links. Can any one suggest how to cr
-
Accessing variables in Trigger (e.g. NoTransaction, NoInserts)
Hi, I have a table where a process writes n DELETEs and m INSERTs. The commit is called at the end of the process, and lets call this commit a transaction (trx1). I have a trigger set on the table that fires when either a DELETE or INSERT occurs. I a