Help in the ABAP query
Hi Friends,
I am having issue in the ABAP query in the HR report, i can able to change the column Heading in the report, but the same header is not coming in the layout details fields(after executing the ALV report we have layout options where we could not see the same header as in the coulmn heading)
pls help me to solve this issue,
Regards,
boobalan.v
Hi,
Once you have made some changes to the infoset/query, You need to adjust the infoset(SQ02) and then regenerate the query(SQ01)
>Menu->Query/Infoset->More functions->Adjust/Generate program.
Letme know if this is still not reflecting..
Reward if useful
Regards
Shiva
Similar Messages
-
Generation of program code for the ABAP Query
Dear all,
In the creation of the ABAP query, in the final step of SQ01, Query- more functions- generate program is made.
Why the program code is generated for the ABAP query? please give the logical explaination for the same.
Thanks and Regards,
PrashPrash,
a) Do you mean Program code does not have significance in query creation?
No it does not mean this. All queries run based on an ABAP program. In the standard query editing process, when you save and execute the query, you will automatically re-build the existing ABAP program as necessary. You do not need, though, to execute the menu steps you outlined in order to build, maintain, or execute the query. It is only there for special purposes, as outlined above by Jürgen
b) Can we see the program code generated in any transaction?
From any screen, System > Status. Place your cursor on the field in "Program (screen)". Double click.
Rgds,
DB49 -
Need some help with the Select query.
Need some help with the Select query.
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
select single vkorg abgru from ZADS into it_rej.
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
This is causing performance issue. They are asking me to include the where condition for this select query.
What should be my select query here?
Please suggest....
Any suggestion will be apprecaiated!
Regards,
DeveloperHello Everybody!
Thank you for all your response!
I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table
select vkorg abgru from ZADS into it_rej.
Earlier :
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
Now :
DATA : BEGIN OF IT_REJ occurs 0,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
I guess this will fix the issue correct?
PLease suggest!
Regards,
Developer. -
Can we change the ABAP QUERY exists in Global area
Hi All,
I have a requirement to add new column in the ABAP query in layout for that I am changing a ABAP query ME80FN which is calling infoset /SAPQUERY/ME80FN defined in the global area ( Environment->query areas->global area).
1) Can I change this infoset and query
or
2) Do I need to follow any other steps.
If I change the existing query in DEV can I transport this to production.
Please clarify.
Thanks,
JwalaYes. We can change the background of an input field. The way you do this is by editing the theme that webdynpro application uses. To edit the theme, you will need to install NWDS PLUS the theme edit plugin (Available for download from SAP).
Once you have edited the theme, you will need to upload your theme back to application server. You can use the program : BSP_UPDATE_MIMEREPOS to do this.
Bydefault, the theme used by webdynpro applications is :
/SAP/PUBLIC/BC/UR/nw5/themes/sap_tradeshow
You can apply another theme by calling the webdynpro application with a theme parameter. For example, if my webdynpro application name is "zgopaltest", then
<i><b>http://<server>:port/sap/bc/webdynpro/sap/zgopaltest?SAP-EP-THEMEROOT=/SAP/PUBLIC/BC/UR/nw5/themes/sap_tradeshow</b></i>
will apply the sap_tradeshow theme.
Likewise, you can apply diffrent theme. There is another theme that SAP provides. Its called : sap_hcb. Hence, you can apply the theme to the above application by:
<i><b>http://<server>:port/sap/bc/webdynpro/sap/zgopaltest?SAP-EP-THEMEROOT=/SAP/PUBLIC/BC/UR/nw5/themes/sap_hcb</b></i> -
Add a Code to Change the ABAP Query
Hi All,
I have a requirement in which i need to add a check box to a selection screen in ABAP query i inserted this check box in the infoset .The report is using joins from table EKKO,EKPO and EKES and display all the Vendor Confirmation details but when the user clicks on the checkbox which is added on the selection screen the report should only display the latest date Vendor confirmation for each line item of the PO.So i need your help how and where should i add the code for this in the Query???
Result when no Checkbox is ticked
PO LineItem Date
100 1 15.01.2010
100 1 15.02,2010
100 1 15.02.2010
Result when Checkbox is ticked
PO LineItem Date
100 1 15.02,2010
100 1 15.02.2010
Please help!!!
Regards,
KBHI,
After selecting data from tables EKKO,EKPO and EKES in internal table, sort that internal table in descending order of date and in ascending order of PO number and line item and then delete adjacent duplicates from that internal table by comparing PO number and line item. This will give you the latest entry for each PO number and line item.
PFB the sample code..
*--after select query on EKKO, EKPO and EKES
SORT itab po_number ascending line_item ascending date descending.
DELETE ADJACENT DUPLICATES FROM itab COMPARING po_number line_item.
Let's say input file contains following data
PO LineItem Date
100 1 15.01.2010
100 1 15.02.2010
101 1 15.02.2010
101 1 15.02.2010
Above code will give you output as given below :
PO LineItem Date
100 1 15.02.2010
101 1 15.02.2010
Regards,
Pranjali -
i have a table
source table :
create table order(name_a varchar2(100),intid number);
insert into order values('a',1);
insert into order values('b',1);
insert into order values('c',1);
insert into order values('d',1);
insert into order values('e',2);
insert into order values('f',2);
insert into order values('g',2);
i need a query , which result in the below output :
if i look for intid=1 the query should give a,b,c,d
if i look for intid=2 the query should give f,g
ThanksHi,
781649 wrote:
i have a table
source table :
create table order(name_a varchar2(100),intid number);
insert into order values('a',1);
insert into order values('b',1);
insert into order values('c',1);
insert into order values('d',1);
insert into order values('e',2);
insert into order values('f',2);
insert into order values('g',2);Thanks for posting the CREATE TABLE and INSERT statements; it's very helpful.
i need a query , which result in the below output :
if i look for intid=1 the query should give a,b,c,d
if i look for intid=2 the query should give f,gDid you mean <b>e</b>,f,g ?
That's called String Aggregation , and how to do it depends on your version of Oracle, and your exact requirements.
See thie following page for several techniques:
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
If you're using Oracle 10 (or higher), and it's important that the name_a's be in order in the output, then you can do this:
WITH got_r_num AS
SELECT name_a
, intid
, ROW_NUMBER () OVER ( PARTITION BY intid
ORDER BY name_a
) AS r_num
FROM order_table -- ORDER is not a good table name
WHERE intid IN (1) -- Optional
SELECT intid
, SUBSTR ( SYS_CONNECT_BY_PATH (name_a, ',')
, 2
) AS name_a_list
FROM got_r_num
WHERE CONNECT_BY_ISLEAF = 1
START WITH r_num = 1
CONNECT BY r_num = PRIOR r_num + 1
AND intid = PRIOR intid
;Starting in Oracle 11.2, LISTAGG is better.
This does not assume that you are getting the output only for a single intid at a time. You can get any number of them in a suingle query. Of course, that number can be 1 if that's what you want.
Edited by: Frank Kulash on Mar 24, 2011 12:19 PM -
Need help in the following query
Hi ,
I have the following query to pull out data for a particular timeperiod( campaign)
select
da.acct_nr,smas.mrkt_id,smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
,smas.stf_ind,da1.acct_nr,
smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
,smas.stf_ind,da1.acct_nr,prev.*
From cdw.sum_mrkt_acct_sls smas
join codi.dim_acct da
on (smas.mrkt_id = da.mrkt_id and smas.acct_key = da.acct_key)
join codi.dim_acct da1
on (smas.mrkt_id = da1.mrkt_id and smas.UPLN_acct_key = da1.ACCT_KEY)
where smas.acct_key in
select dwnln_acct_key from codi.dim_ldrshp_genlgy
where mrkt_id = 66 and fld_sls_cmpgn_perd_id = 20100304
and root_upln_acct_key = (select acct_key from codi.dim_acct where acct_nr = '0032622' and mrkt_id = 66)
and
smas.mrkt_id = 66
and smas.fld_sls_cmpgn_perd_id = 20100304
and smas.sls_org_key <> -100
order by 1
So this query will pull out data for campaign 20100304
No i want to modify the query to pull out data for 3 such campaigns.
for a smas.acct_key
so data will
smas.acct_key all the data for 1st campaign , all the data for 2nd campaign. all the data for 3rd campaign
Could you please help in modifying this query.
ThanksHow about this ??
select da.acct_nr,
smas.mrkt_id,
smas.fld_sls_cmpgn_perd_id,
smas.acct_key,
smas.upln_acct_key,
smas.awrd_sls_amt,
smas.fld_net_sls_amt,
smas.stf_ind,
da1.acct_nr,
smas.fld_sls_cmpgn_perd_id,
smas.acct_key,
smas.upln_acct_key,
smas.awrd_sls_amt,
smas.fld_net_sls_amt,
smas.stf_ind,
da1.acct_nr,
prev.*
From cdw.sum_mrkt_acct_sls smas
join codi.dim_acct da on (smas.mrkt_id = da.mrkt_id and
smas.acct_key = da.acct_key)
join codi.dim_acct da1 on (smas.mrkt_id = da1.mrkt_id and
smas.UPLN_acct_key = da1.ACCT_KEY)
where smas.acct_key in (select dwnln_acct_key
from codi.dim_ldrshp_genlgy
where mrkt_id = 66
and fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
and root_upln_acct_key =
(select acct_key
from codi.dim_acct
where acct_nr = '0032622'
and mrkt_id = 66))
and smas.mrkt_id = 66
and smas.fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
and smas.sls_org_key - 100
order by 1 -
How to give References for the field in the Abap Query
Dear Freinds,
I am not able to get Text for Cost Centre which iam using in My custom infotype , when iam calling the Custom infotype in abap querry i dont find the T symbol for my field Cost Centre , since i have created in my custom infotype for Cost Centre similar to the infotype 0001. When i look at the
infotype 0001 fields in my abap query i can see that there is T field for P0001-KOSTL and again if i double click on it i can see that in the REFERENCES Tab i can see " Function Module:HR_TXID_KOSTL" . Could any one let me how i can assign to my custom field "Function Module:HR_TXID_KOSTL " in the References Tab.
Regards
divyasolved the problem
-
<p><span style=" font-family: Verdana;">Hi Gurus,</span></p><p> </p><p><span style=" font-family: Verdana;">I am</span> <span style=" font-family: Verdana;">at a learning stage to learn the MDX query.Could anyone help me with some link or book from where i can getthe syntax of some function with examples to understandthem.</span></p><p> </p><p><span style=" font-family: Verdana;">thanks</span></p><p> </p><p> </p>
2 good books are MDX Solutions Second Edition, by George Spofford. This is a very good book, in depth, with a lot of material. George Spofford is also a regular contributor to this site, so if you have questions about any of the material, you could post here and he has proven to be very good about responding to questions.<BR>Another good book is Fast Track to MDX. This is also a good book. It's a quicker read and a little easier to get through then MDX Solutions, but the concepts are more fundamental and not as in depth, I think both books are worth reading.<BR>Other than that, there is a lot of material on this site, tech guides, white papers, etc that should be useful too.<BR><BR>HTH
-
I want to attach application help documentation to an SQ01 query that I have created.
I should be able to view the application help (In the menu <i><b>Help->Application help</b></i>) when I run this query.
Can I know the method ?Well I forgot the table-alias, here now with:
SELECT C.COMB_ID
, C.COMB_NAME
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
FROM COMBINATION C;
As you need exactly 4 subjects, the columns-solution is just fine I would say. -
Need help on the below query.
Hi All,
I've a query given below..
SELECT W.WONUM,
W.STATUS,
WS.CHANGEDATE,
EH.OLD_RATE
FROM
WORKORDER W,
WOSTATUS WS,
ESTIMATE_HEADER@GQMFOF EH
WHERE WS.CHANGEDATE BETWEEN '01-Oct-2009' AND '1-Nov-2009'
AND W.WONUM = WS.WONUM
AND EH.OLD_RATE = 'N'
AND WS.WOSTATUS = 'CLOSE';
I would like to get All the data which status =closed in the month of Oct for Old rate,
So for this i am writing the query above. But not getting the o/p.
It is giving me that " Table/View doesn't exist.
There 2 schemas MAXIMO,GQMMGR..
DBlinks are GQMFOF,MAXFOFNC..
Can anyone help me while writing the above query...
Regards,
gr.A question was asked in your other thread. But the problem was you dint care to give an answer.
Dont open duplicate post.
I need help on the below problem.. -
How to Publish the ABAP query results as csv
Hi,
I have a scenario and need help for the same, I need to query a table in CRM which has the long text information and publish or save the result as a csv file, is it possible? if so please tell me the steps and code if available
Thanks
Akila.RHi,
Two formats of creating a CSV file:
report zrich_0001 .
data: it001 type table of t001 with header line.
data: iout type table of string .
data: xout type string.
field-symbols: <fs>.
select * into table it001 from t001.
loop at it001.
clear xout.
do.
assign component sy-index of structure it001 to <fs>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
xout = <fs>.
else.
concatenate xout <fs> into xout separated by ','.
endif.
enddo.
append xout to iout.
endloop.
call function 'GUI_DOWNLOAD'
exporting
filename = 'C:\test.csv'
tables
data_tab = iout.
report ztest.
type-pools:TRUXS.
data: begin of itab occurs 0,
vbeln like vbap-vbeln,
posnr like vbap-posnr,
end of itab.
data: itab1 type TRUXS_T_TEXT_DATA.
select vbeln
posnr
up to 10 rows
from vbap
into table itab.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
TABLES
I_TAB_SAP_DATA = itab
CHANGING
I_TAB_CONVERTED_DATA = itab1
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\TEMP\TEST.CSV'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1.
Use SE38.
Regards
Subramanian -
I have the table test1 with a date field stored as character 7 field.
(which is for CYYMMDD)
C - century indicator
and there are 3 rows in that table for testing purposes.
One of them has a value 9999999 which is a incorrect value for a given date.
I want to get all the rows with the value grater than 20020101 from that table.
Noted below are my table, values and query I used.
Can anyone help me with this?
create table test1(cr_date char(7);
SQL> desc test1
Name Null? Type
CR_DATE CHAR(7)
SQL> select * from test1;
CR_DATE
9999999
2021009
1980101
3 rows selected.
select
to_number(to_char(to_date((substr(cr_date,2,7)),'RRMMDD'),'RRRRMMDD'))
from test1 where cr_date<>'9999999' and
to_number(to_char(to_date((substr(cr_date,2,7)),'RRMMDD'),'RRRRMMDD'))>20020101
I get this error:
ERROR at line 2:
ORA-01843: not a valid monthBut I don't have the control over this table because this is maintained by a real old
system in the MainframeI didn't say (or at least didn't mean to say) it was your fault. My point was that you need to have error handling in place for non-date values.
Note that Otto's solution will fail if any of the values in cr_date are non-numeric. Given that you have no control over what that column contains and that it is a string column you probably ought to handle that situation, unless you know for certain sure that everything in it will always be a number.
If you want to do so the easiest way would be to write a user defined function that applies a TO_DATE to the input argument and handles invalid dates by returning null or whatever takes your fancy. Other solutions may be more appropriate, depending on what you want to do with the data.
Cheers, APC -
Hi,
I have another query running slow when executed from cognos. It is also not returning any output continues to execute,
with "Union15" as (
select distinct CASE WHEN(substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 1, 4) IS NULL) OR (case substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end IS NULL) THEN NULL ELSE (substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 1, 4)||case substr(to_char(FLOOR("EES_ENERGY_MASTER"."DISC_MON"/100)), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end ) END "QUARTER", "EES_ENERGY_MASTER"."PAT_KEY" "Cases_Using_Energy", 0 "Total_Cases"
from "MDM_DBA"."EES_ENERGY_MASTER" "EES_ENERGY_MASTER", "MDM_DBA"."EES_CONS_PROV" "EES_CONS_PROV"
where "EES_ENERGY_MASTER"."DISC_MON">=2006101 and "EES_ENERGY_MASTER"."PDCT_CAT"='Energy' and substr("EES_ENERGY_MASTER"."ICD_CODE", 1, 2)='68-gyn' and "EES_ENERGY_MASTER"."MANUFACTURER"='EES' and "EES_CONS_PROV"."CONS_06_09_YN" in ('N', 'Y') and "EES_ENERGY_MASTER"."PROV_ID"="EES_CONS_PROV"."PROV_ID" union
select CASE WHEN(substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4) IS NULL) OR (case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end IS NULL) THEN NULL ELSE (substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4)||case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end ) END "QUARTER", 0 "Cases_Using_Energy", count("MVW_EES_ICD_STATS"."CASES") "Total_Cases"
from "MDM_DBA"."MVW_EES_ICD_STATS" "MVW_EES_ICD_STATS", "MDM_DBA"."EES_CONS_PROV" "EES_CONS_PROV", "MDM_DBA"."EES_HOSP_CHG_PROV" "EES_HOSP_CHG_PROV"
where "MVW_EES_ICD_STATS"."DISC_QTR">=20061 and "MVW_EES_ICD_STATS"."ICD_GROUP"='68-gyn' and "EES_CONS_PROV"."CONS_06_09_YN" in ('N', 'Y') and "EES_HOSP_CHG_PROV"."PDCT_CAT"='Energy' and "EES_HOSP_CHG_PROV"."MANUFACTURER"='EES' and "MVW_EES_ICD_STATS"."PROV_ID"="EES_CONS_PROV"."PROV_ID" and "MVW_EES_ICD_STATS"."PROV_ID"="EES_HOSP_CHG_PROV"."PROV_ID"
group by CASE WHEN(substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4) IS NULL) OR (case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end IS NULL) THEN NULL ELSE (substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 1, 4)||case substr(to_char(FLOOR("MVW_EES_ICD_STATS"."DISC_QTR")), 5, 1) when '1' then 'Q1' when '2' then 'Q2' when '3' then 'Q3' when '4' then 'Q4' end ) END)
select "T1"."C0" "levelkey", "T1"."C1" "Cases_Using_Energy", "T0"."C0" "Cases_Using_Energy1", "T1"."C2" "Total_Cases"
from (
select count(distinct "Union15"."Cases_Using_Energy") "C0"
from "Union15") "T0", (
select "Union15"."QUARTER" "C0", count(distinct "Union15"."Cases_Using_Energy") "C1", sum("Union15"."Total_Cases") "C2"
from "Union15"
group by "Union15"."QUARTER") "T1"The explain plan is as follows,
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
| 0 | SELECT STATEMENT | | 1 | 50 | | 22 |
| 2 | TEMP TABLE TRANSFORMATION | | | | | |
| 1 | RECURSIVE EXECUTION | SYS_LE_2_0 | | | | |
| 0 | INSERT STATEMENT | | 3053 | 128K| | 1372 |
| 1 | LOAD AS SELECT | | | | | |
| 2 | SORT UNIQUE | | 3053 | 128K| 376K| 1372 |
| 3 | UNION-ALL | | | | | |
|* 4 | HASH JOIN | | 3052 | 128K| | 185 |
|* 5 | TABLE ACCESS FULL | EES_CONS_PROV | 622 | 3732 | | 2 |
|* 6 | TABLE ACCESS BY INDEX ROWID | EES_ENERGY_MASTER | 3055 | 110K| | 182 |
|* 7 | INDEX RANGE SCAN | IDX_ENERGY_PDCT_CAT | 1978 | | | 2478 |
| 8 | SORT GROUP BY | | 1 | 40 | | 1160 |
|* 9 | TABLE ACCESS BY INDEX ROWID | EES_HOSP_CHG_PROV | 4 | 72 | | 1 |
| 10 | NESTED LOOPS | | 1 | 40 | | 1157 |
| 11 | NESTED LOOPS | | 1 | 22 | | 1156 |
|* 12 | TABLE ACCESS BY INDEX ROWID| MVW_EES_ICD_STATS | 1 | 16 | | 1155 |
|* 13 | INDEX RANGE SCAN | MVWICDSTATS_DISCQTR_IDX | 13M| | | 26068 |
|* 14 | TABLE ACCESS BY INDEX ROWID| EES_CONS_PROV | 1 | 6 | | 1 |
|* 15 | INDEX UNIQUE SCAN | EES_CONS_PROV_PK | 1 | | | |
|* 16 | INDEX RANGE SCAN | PROV_ID_IDX_2 | 65 | | | 1 |
| 3 | MERGE JOIN CARTESIAN | | 1 | 50 | | 22 |
| 4 | VIEW | | 1 | 13 | | 3 |
| 5 | SORT GROUP BY | | 1 | 13 | | |
| 6 | VIEW | | 3053 | 39689 | | 3 |
| 7 | TABLE ACCESS FULL | SYS_TEMP_0FD9D68B3_C112F95D | 3053 | 110K| | 3 |
| 8 | VIEW | | 1 | 37 | | 19 |
| 9 | SORT GROUP BY | | 1 | 37 | | 19 |
| 10 | VIEW | | 3053 | 110K| | 3 |
| 11 | TABLE ACCESS FULL | SYS_TEMP_0FD9D68B3_C112F95D | 3053 | 110K| | 3 |
Predicate Information (identified by operation id):
4 - access("EES_ENERGY_MASTER"."PROV_ID"="EES_CONS_PROV"."PROV_ID")
5 - filter("EES_CONS_PROV"."CONS_06_09_YN"='N' OR "EES_CONS_PROV"."CONS_06_09_YN"='Y')
6 - filter("EES_ENERGY_MASTER"."DISC_MON">=2006101 AND SUBSTR("EES_ENERGY_MASTER"."ICD_CODE",1,2)='68-gyn'
AND "EES_ENERGY_MASTER"."MANUFACTURER"='EES')
7 - access("EES_ENERGY_MASTER"."PDCT_CAT"='Energy')
9 - filter("EES_HOSP_CHG_PROV"."PDCT_CAT"='Energy' AND "EES_HOSP_CHG_PROV"."MANUFACTURER"='EES')
12 - filter("MVW_EES_ICD_STATS"."ICD_GROUP"='68-gyn')
13 - access("MVW_EES_ICD_STATS"."DISC_QTR">=20061 AND "MVW_EES_ICD_STATS"."DISC_QTR" IS NOT NULL)
14 - filter("EES_CONS_PROV"."CONS_06_09_YN"='N' OR "EES_CONS_PROV"."CONS_06_09_YN"='Y')
15 - access("MVW_EES_ICD_STATS"."PROV_ID"="EES_CONS_PROV"."PROV_ID")
16 - access("MVW_EES_ICD_STATS"."PROV_ID"="EES_HOSP_CHG_PROV"."PROV_ID")
Please help with some solution.OK: the third parameter of the SUBSTR function indicates the (maximum) length of the returnd string.
Therefore SUBSTR("EES_ENERGY_MASTER"."ICD_CODE",1,2) could possibly be '68' , but never '68-gyn'.
'68-gyn' is just 4 characters too long.
Urs -
Need help on the below query or Pl-SQL
Hello Every one,
Please let me know if some one can help me out with the below scenario either in pl-sql or sql.
Source Data:
0000253800 0.25 0845A 0900A
0000253800 1 0900A 1000A
0000253800 1 1300P 1400P
0000253800 1 1500P 1600P
0000253800 1 1600P 1700P
Output needed:
0000253800 1.25 0845A 1000A
0000253800 1 1300P 1400P
0000253800 2 1500P 1700P
Thanks in Advance....
Edited by: user12564103 on Dec 11, 2011 5:54 PMHi,
Welcome to the forum!
Depending on your data and your requirements:
WITH got_times AS
SELECT column_1, column_2, column_3, column_4
, TO_DATE ( substr (column_3, 1, 4)
, 'HH24MI'
) AS time_3
, TO_DATE ( SUBSTR (column_4, 1, 4)
, 'HH24MI'
) AS time_4
FROM table_x
, got_grp_id AS
SELECT column_1, column_2, column_3, column_4
, time_3, time_4
, time_4 - SUM (time_4 - time_3) OVER ( PARTITION BY column_1
ORDER BY time_3
) AS grp_id
FROM got_times
SELECT column_1
, SUM (column_2) AS sum_2
, MIN (column_3) KEEP (DENSE_RANK FIRST ORDER BY time_3)
AS min_3
, MAX (column_4) KEEP (DENSE_RANK LAST ORDER BY time_4)
AS max_4
FROM got_grp_id
GROUP BY column_1
, grp_id
ORDER BY column_1
, grp_id
;Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, as well as the results you want from that data. Explain, with specific examples, how you get the results you want from that data.
Always say which version of Oracle you're using. The query above will work in Oracle 9.1 (and higher).
Since this is your first thread, I'll do this for you:
CREATE TABLE table_x
( column_1 NUMBER
, column_2 NUMBER
, column_3 VARCHAR2 (5)
, column_4 VARCHAR2 (5)
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, .25, '0845A', '0900A');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '0900A', '1000A');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '1300P', '1400P');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '1500P', '1600P');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '1600P', '1700P');Column_1 identifes a day.
Column_2 is an amount that I need to total.
Column_3 and column_4 are starting and ending times. We can assume that they are all valid times (in 'HH24MI' format, plus a redundant 'A' or 'P') on the same day, column_3 is always less than column_4, and that the range of two rows for the same value of column_1 never overlap. Column_4 of one row may be equal to column_3 of another rows with the same column_1, but it will never be greater.
Each row of the output represent a contiguous group of rows (each ending exactly when the next one begins) with the same column_1, with the common column_1, the total of column_2, and the range of the group.
For example, the first two rows for a single group, because they have the same value for column_1, and one ends exactly when the other begins (at 9:00 AM). This group represents day 253800, from 8:45 AM to 10:00 AM. The totla of column_2 fro this group is .25 + 1 = 1.25.
The next row (from 1:00 PM to 2:00 PM) is a group all by itself, because there is a gap one either side of it separating it from its nearest neighbor on the same day."
Of course, I'm guessing at lots of things.
Edited by: Frank Kulash on Dec 11, 2011 9:44 PM
Changed TO_DATE calls.
Edited by: Frank Kulash on Dec 11, 2011 9:52 PM
Added sample question.
Maybe you are looking for
-
I seem to have lost the groups from my Address Book in the address book tool in Mail. When I try to address a new email, all my contacts are grouped under all and the other groups found in my Address Book application are missing. Is there a way to ge
-
Hi friends, I got issue regarding to OT.The employee must get OT for 3 week but they have paid only for one week.Here they are paying OT through wagetype.What i assume here i think administator might forgot to update the OT entries for remaining two
-
Hi, Will HttpSession work even if cookies are turned off in the browser? For this, What is the setting in the weblogic server? Thanks, Harish
-
Hi, I've got a problem as we have a stock mismatch between WM & IM as a result of an issue with stock write on for Go Live. When the stock was written into the live box via a 561 mvt, the WM functionality didn't run. Config had to be tweaked to activ
-
Calling multiple DLL from Java and calling same native method
i have two dll files named DLL_1.dll and DLL_2.dll . Both of them contain a native method which has a signature JNIEXPORT void JNICALL Java_Database_Notify (JNIEnv *, jclass); This method is common to both the DLL Now i load both of the DLL's using,