Row concatenation with SUM
my tables;
SQL> desc emp_pay
Name
EMP_CODE
EMP_ALLW_CODE
EMP_ALLW_START_DT
EMP_ALLW_UPTO_DT
EMP_ALLW_AMT
SQL> desc emp_mast
Name
EMP_CODE
EMP_NAME
EMP_GRADE_CODE
EMP_DOB
EMP_JOIN_DATE
EMP_DEPT_CODE
SQL> desc ALLW_MAST
Name
ALLW_CODE
ALLW_DESC
SQL> select * FROM EMp_PAY;
EMP_CO EMP_AL EMP_ALLW_S EMP_ALLW_U EMP_ALLW_AMT
01 A01 01/01/2008 31/12/2008 3000.000
01 A02 01/01/2008 31/12/2008 300.000
01 A03 01/01/2008 31/12/2008 150.000
01 D01 01/01/2008 31/12/2008 15.000
02 A01 01/01/2008 31/12/2008 1500.000
02 A02 01/01/2008 31/12/2008 180.000
02 A03 01/01/2008 31/12/2008 50.000
02 A04 01/01/2008 31/12/2008 100.000
02 D01 01/01/2008 31/12/2008 10.000
03 A01 01/01/2008 31/12/2008 2500.000
03 A02 01/01/2008 31/12/2008 500.000
03 A03 01/01/2008 31/12/2008 200.000
03 D01 01/01/2008 31/12/2008 12.000
04 A01 01/01/2008 31/12/2008 2000.000
04 A02 01/01/2008 31/12/2008 250.000
04 A03 01/01/2008 31/12/2008 180.000
04 A04 01/01/2008 31/12/2008 150.000
04 A05 01/01/2008 31/12/2008 50.000
04 D01 01/01/2008 31/12/2008 11.500
05 A01 01/01/2008 31/12/2008 950.000
05 A02 01/01/2008 31/12/2008 150.000
05 A03 01/01/2008 31/12/2008 125.000
05 A04 01/01/2008 31/12/2008 75.000
i want to display result in 2 ways;
(1)
EMP_CODE ENAME Allw_Code and Allw_Desc and emp_allw_amt netSAL
01 EMP1 A01 Basic 3000 + A02 HRA 300 + A03 TRPT 150 - D01 CONTR 15 3435
02 EMP2 A01 Basic 1500 + A02 HRA 180 + A03 TRPT 50 + A04 ELEC 100 - D01 CONTR 10 1820
03 EMP3 A01 Basic 2500 + A02 HRA 500 + A03 TRPT 200 - D01 CONTR 12 3188
04 EMP4 A01 Basic 2000 + A02 HRA 250 + A03 TRPT 180 + A04 ELEC + 150 A05 WTR 50 - D01 CONTR 11.5 2618.5
05 EMP5 A01 Basic 950 + A02 HRA 150 + A03 TRPT 125 + A04 ELEC 75 1300 [Not contributing, so NO dedc. (D01)]
(2) Earnings (A01, A02, A03...) separate Column..and Deductions (D01...) separate Column. deductions can be more than 1.
EMP_CODE ENAME Allw_Code and Allw_Desc and emp_allw_amt Total Earnings Deductions Total deductions netSAL
01 EMP1 A01 Basic 3000 + A02 HRA 300 + A03 TRPT 150 3450.000 D01 CONTR 15 15.000 3435.000
02 EMP2 A01 Basic 1500 + A02 HRA 180 + A03 TRPT 50 + A04 ELEC 100 1830.000 D01 CONTR 10 15.000 1820.000
03 EMP3 A01 Basic 2500 + A02 HRA 500 + A03 TRPT 200 3200.000 D01 CONTR 12 12.000 3188.000
04 EMP4 A01 Basic 2000 + A02 HRA 250 + A03 TRPT 180 + A04 ELEC + 150 A05 WTR 50 2630.000 D01 CONTR 11.5 11.500 2618.500
05 EMP5 A01 Basic 950 + A02 HRA 150 + A03 TRPT 125 + A04 ELEC 75 1300.000 1300.000 [Not contributing, so NO dedc. (D01)]
another situation, i have 2 tables;
Table 1
Parent ID
Parent Name
Amount
table 2
DPND_CODE
DPND_NAME
DPND_RELAT_CODE
DPND_DOB
DPND_YN
DPND_SHARE_AMOUNT
DPND_BANK_CODE
DPND_BANK_AC_NO
DPND_AGENT_CODE
the query should check for the WHERE condition that dpnd_yn "Y"
Parent ID Parent Name Amount
001 emp1 200.000
001_01 emp1_chld1 50.000
001_02 emp1_chld2 50.000
001_03 emp1_chld3 50.000
001_04 emp1_chld4 50.000
.
Solution for (1):
with tbl as (
select '01' emp_co, 'A01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 3000.000 EMP_ALLW_AMT from dual
union all
select '01' emp_co, 'A02' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 300.000 EMP_ALLW_AMT from dual
union all
select '01' emp_co, 'A03' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 150.000 EMP_ALLW_AMT from dual
union all
select '01' emp_co, 'D01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 15.000 EMP_ALLW_AMT from dual
union all
select '02' emp_co, 'A01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 1500.000 EMP_ALLW_AMT from dual
union all
select '02' emp_co, 'A02' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 180.000 EMP_ALLW_AMT from dual
union all
select '02' emp_co, 'A03' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 50.000 EMP_ALLW_AMT from dual
union all
select '02' emp_co, 'A04' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 100.000 EMP_ALLW_AMT from dual
union all
select '02' emp_co, 'D01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 10.000 EMP_ALLW_AMT from dual
union all
select '03' emp_co, 'A01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 2500.000 EMP_ALLW_AMT from dual
union all
select '03' emp_co, 'A02' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 500.000 EMP_ALLW_AMT from dual
union all
select '03' emp_co, 'A03' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 200.000 EMP_ALLW_AMT from dual
union all
select '03' emp_co, 'D01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 12.000 EMP_ALLW_AMT from dual
union all
select '04' emp_co, 'A01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 2000.000 EMP_ALLW_AMT from dual
union all
select '04' emp_co, 'A02' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 250.000 EMP_ALLW_AMT from dual
union all
select '04' emp_co, 'A03' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 180.000 EMP_ALLW_AMT from dual
union all
select '04' emp_co, 'A04' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 150.000 EMP_ALLW_AMT from dual
union all
select '04' emp_co, 'A05' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 50.000 EMP_ALLW_AMT from dual
union all
select '04' emp_co, 'D01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 11.500 EMP_ALLW_AMT from dual
union all
select '05' emp_co, 'A01' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 950.000 EMP_ALLW_AMT from dual
union all
select '05' emp_co, 'A02' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 150.000 EMP_ALLW_AMT from dual
union all
select '05' emp_co, 'A03' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 125.000 EMP_ALLW_AMT from dual
union all
select '05' emp_co, 'A04' EMP_AL, to_date('01/01/2008', 'dd/mm/yyyy') EMP_ALLW_S, to_date('31/12/2008', 'dd/mm/yyyy') EMP_ALLW_U, 75.000 EMP_ALLW_AMT from dual
select emp_co emp_code, 'EMP' || to_char(rownum) ename, result_, netsal - emp_allw_amt*2 as netsal from (
select a.*, replace(substr(sys_connecT_by_path (output, '%'), 2), '%', ' ') result_
from(
select emp_co, emp_al, emp_allw_s, emp_allw_u, case when instr(emp_al,'D') = 0 then 0 else emp_allw_amt end emp_allw_amt,
decode(emp_al, 'A01', 'A01 Basic ' || emp_allw_amt,
'A02', '+ A02 HRA ' || emp_allw_amt,
'A03', ' + A03 TRPT ' || emp_allw_amt,
'A04', '+ A04 ELEC ' || emp_allw_amt,
'D01','- D01 CONTR ' || emp_allw_amt) as output,
row_number() over (partition by emp_co order by emp_al) as rn,
count(1) over (partition by emp_co) max_ ,
sum(emp_allw_amt) over (partition by emp_co) netsal from tbl
) a
start with rn = 1
connect by prior emp_co = emp_co
and prior rn = rn - 1
)b
where rn = max_
EMP_CODE ENAME RESULT_ NETSAL
01 EMP1 A01 Basic 3000 + A02 HRA 300 + A03 TRPT 150 - D01 CONTR 15 3435
02 EMP2 A01 Basic 1500 + A02 HRA 180 + A03 TRPT 50 + A04 ELEC 100 - D01 CONTR 10 1820
03 EMP3 A01 Basic 2500 + A02 HRA 500 + A03 TRPT 200 - D01 CONTR 12 3188
04 EMP4 A01 Basic 2000 + A02 HRA 250 + A03 TRPT 180 + A04 ELEC 150 - D01 CONTR 11.5 2618,5
05 EMP5 A01 Basic 950 + A02 HRA 150 + A03 TRPT 125 + A04 ELEC 75 1300Edited by: qube on Oct 27, 2008 1:06 PM
Similar Messages
-
GL - Balances do not match with sum of Items
Hi,
I have a requirement in which I am pulling opening, closing balance and a list of all transactions (or items ) on a daily basis from GL to a flat file, and then loading in a third-party tool . Now, the issue is sum of all items (gl_je_lines ) should match with the diference of closing and opening balances.
I reconcilied the items with Oracle's Journal Report. Items are matching.
I also confirmed that closing balance of previous day matches with the opening balance of current date.
But, ( closing balance ) - (opening balance) does not match with sum(items)
I am using gl_daily _balances for opening and closing balance.
Waiting for your inputs/suggestions..
YoginiHi,
Thanks for the reply.
I am not using GL_INTERFACE. The tables I am using for Daily balances are:
gl_daily_balances
gl_code_combinations
chart_of_accounts
And for the items, I am using gl_je_lines, gl_je_headers.
Also, I am interested in Entered Amount in GBP as the Functional Currency is GBP and there are many transacitons in different foreign currencies.
More updates : I found that I have calculate the Entered Amount in GBP from all Converted/Transferred/Entered amounts in different currencies.
So, I tried the following :
(Select Sum(end_of_date_balance)
from gl_daily_balances
where Currency_code = 'GBP'
and currency_type = 'U'
and accounting_date = sysdate -1 --Opening balance
MINUS
( Select Sum(end_of_date_balance)
from gl_daily_balances
where Currency_code = 'GBP'
and currency_type = 'C'
and accounting_date = sysdate -1 --Opening balance
This way, I got opening and closing balance, but still the differernce between opening and closing balance is not matching with the sum of Items.
Any suggestions / inputs are highly appreciated.
Yogini -
Hello,
I have a workflow that needs to be repeated every month and I'd like to optimize it.
1. DB table in SQL Server 2008 looks something like this:
TABLE [CONTRACTS_GCO_LVL2](
[CONTRACTS_BP_ID] [varchar](50),
[Flag 1] [int] ,
[Flag 2] [int] ,
[Flag 3] [int] ,
2. I bring this table into my BOE IDT 4.0.3 and drag it into object folder. All INT columns become dimensions. This is not what I want. These are 1/0 flags for me and I need them to be measures with SUM aggregation.
3. I select all these INT sourced dimensios and right click on them with "Turn into measure with aggregation function - SUM"
The problem is that step #3 is unbelievably slow. I need to spend hours doing this as I have thousands of these flags. I end up selecting all dimensions from one screen and converting them at the same time. This takes 4-5 minutes. IDT runs on a Win 2008 R2 Enterprise server with 32 GB RAM and 4 CPUs.
In Universe Designer there used to be external strategies that allowed some customization of how the objects get automatically created from DB tables. I know there are no strategies in r4 (External strategy for tables) but is there anything else to make this process faster?
Thank you all!
NatasaHrm, I'm suspecting that perhaps it has to do something with setting CHAR fields. Some of the fields in this table are CHAR but I don't see a call in my PreparedStatement that can set a char, only a String, so that's what I've been using, but it may be that that's not the right thing to do. I'm running Java 1.5.10, and looking through the API there doesn't seem to be anything specifically for char.
-
GL Account Key displays Chart of accounts concatenated with GL Account
Hi,
When we pull the GL Account Key object into a WEBI report, the Chart of Account value is concatenating with the GL Account number like ABDA/253616. In Bex Query, choosing the Chart of accounts and GL Account in the Analyser gives only the number value of the GL Account 253616.
How do we resolve this issue.
Thanks,
AnuHi,
We had a similar problem, and we fixed it by using a variable.
Create a variable (e.g. GL Account) with the following formula:
=tonumber(replace([L01_GL_ACC_Key];"ABDA/";""))
where,
[L01_GL_ACC_Key] = Original Account key with the Chart of Accounts
"ABDA/" The piece of the account that you want removed
The formula will convert your account number to a number by replacing the "ABDA/" with a blank (the "" in the formula)
Note: There is no space between the two quotation marks
You can now use the variable in your report instead of the original account key.
Regards,
Sias -
Select distinct rows only and also remove the distinct rows tied with anyother records.
HI Team,
I need query on below requirment:
In my table any value comes with UN in one field alone, i need to select that row. but UN value comes with anyother row i want to reject that UN row.
For example:
EmployeeID
Name
Speciality
1
John
UN
1
John
KH
2
Mony
UN
3
Kash
UN
3
Kash
UI
I need a Final result
1 John KH
2 Mony UN
3 Kash UI. Need to reject UN value combined with anyother row aand also If any row comes with UN value alone need to incude resultset.One more option:
declare @tabl table(EmployeeID int,Name varchar(10),Speciality varchar(10));
insert into @tabl values
(1 ,'John','UN'),
(1 ,'John','KH'),
(2 ,'Mony','UN'),
(3 ,'Kash','UN'),
(3 ,'Kash','UI'),
(4 ,'Cat','UN'),
(4 ,'Cat','UT');
with cte as (SELECT *,
count(case when Speciality ='UN' then NULL else 1 end) OVER (PARTITION BY EMployeeID,Name,Speciality ) AS RN1,
count(case when Speciality ='UN' then NULL else 1 end) OVER (PARTITION BY EMployeeID,Name ) as rn2
FROM @tabl)
select EmployeeID,Name,Speciality from cte where RN1=rn2 -
ALV Grid default values for new rows added with Add/Insert buttons
Hi!
Help, please, to find a way how to set default values for new rows added with Add/Insert buttons in
ALV Grid.I have found salution:
ALV Grid u2013 Insert row function
Sometimes we need to assign some default values when we create a new row in a grid using standard ALV Append row button. In our scenario we will see how to assign default values to Airline Code (CARRID), Flight Connection Number (CONNID) and Flight date (FLDATE) when a new row is created. To do that we need to handle DATA_CHANGED event in the program like mentioned below.
Definition of a class:
Code:
CLASS lcl_event_receiver DEFINITION
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed
e_ucomm.
ENDCLASS. "lcl_event_receiver DEFINITION
Implementation of a class:
Code:
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DATA_CHANGED.
DATA: dl_ins_row TYPE lvc_s_moce. " Insert Row
FIELD-SYMBOLS: <fs> TYPE table. " Output table
Loop at the inserted rows table and assign default values
LOOP AT er_data_changed->mt_inserted_rows INTO dl_ins_row.
ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
loop at <fs> into ls_outtab.
ls_outtab-carrid = 'LH'.
ls_outtab-connid = '400'.
ls_outtab-fldate = sy-datum.
MODIFY <fs> FROM ls_outtab INDEX sy-tabix.
endloop.
endloop.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
Register the events to trigger DATA_CHANGED event when a new row is created.
Code:
CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED. -
Getting top 9, aggregating the rest - challenge with SUM
Dear,
I'd like to get the top 9 customers and aggregate the remaining to one number.
My query is:
select k.kundenid, k.KDNR, k.FIRMA_1, sum(a.auftrag_total)
from auftrag a, kunden k
where a.kunde_id=k.kundenid and
TO_CHAR(a.DATUM,'YYYY')=TO_CHAR(sysdate,'YYYY')
group by k.kundenid, k.KDNR, k.FIRMA_1
order by 4 desc
I have tried with DENSE_RANK() but it gets complicated to combine this with SUM()
Can someone help?
Kind regards..........LorenzI seem to have hit a bug in XE on windows XP. The following query should work but the 10th record only includes the 10th ranked total, not the total of 10 thru 16.
If I change the with statement to a create table, the query works. Also, if I just use the second half of the union all I get the correct results. The combination of with and union/union all seems to fail.
create table auftrag(kunde_id number, kdnr varchar2(20), datum date, auftrag_total number);
insert into auftrag (select 1 kunde_id, 'cust1' kdnr, sysdate datum, 1200 auftrag_total from dual);
insert into auftrag (select 1 kunde_id, 'cust1' kdnr, sysdate datum, 600 auftrag_total from dual);
insert into auftrag (select 2 kunde_id, 'cust2' kdnr, sysdate datum, 1600 auftrag_total from dual);
insert into auftrag (select 2 kunde_id, 'cust2' kdnr, sysdate datum, 700 auftrag_total from dual);
insert into auftrag (select 3 kunde_id, 'cust3' kdnr, sysdate datum, 500 auftrag_total from dual);
insert into auftrag (select 3 kunde_id, 'cust3' kdnr, sysdate datum, 1300 auftrag_total from dual);
insert into auftrag (select 4 kunde_id, 'cust4' kdnr, sysdate datum, 200 auftrag_total from dual);
insert into auftrag (select 5 kunde_id, 'cust5' kdnr, sysdate datum, 1500 auftrag_total from dual);
insert into auftrag (select 6 kunde_id, 'cust6' kdnr, sysdate datum, 800 auftrag_total from dual);
insert into auftrag (select 7 kunde_id, 'cust7' kdnr, sysdate datum, 1400 auftrag_total from dual);
insert into auftrag (select 8 kunde_id, 'cust8' kdnr, sysdate datum, 300 auftrag_total from dual);
insert into auftrag (select 9 kunde_id, 'cust9' kdnr, sysdate datum, 2000 auftrag_total from dual);
insert into auftrag (select 10 kunde_id, 'cust10' kdnr, sysdate datum, 1900 auftrag_total from dual);
insert into auftrag (select 11 kunde_id, 'cust11' kdnr, sysdate datum, 400 auftrag_total from dual);
insert into auftrag (select 12 kunde_id, 'cust12' kdnr, sysdate datum, 1800 auftrag_total from dual);
insert into auftrag (select 13 kunde_id, 'cust13' kdnr, sysdate datum, 900 auftrag_total from dual);
insert into auftrag (select 14 kunde_id, 'cust14' kdnr, sysdate datum, 1000 auftrag_total from dual);
insert into auftrag (select 15 kunde_id, 'cust15' kdnr, sysdate datum, 1700 auftrag_total from dual);
insert into auftrag (select 16 kunde_id, 'cust16' kdnr, sysdate datum, 100 auftrag_total from dual);
create table kunden(kundenid number, firma_1 varchar2(20));
insert into kunden (select 1 kundenid, 'desc1' firma_1 from dual);
insert into kunden (select 2 kundenid, 'desc2' firma_1 from dual);
insert into kunden (select 3 kundenid, 'desc3' firma_1 from dual);
insert into kunden (select 4 kundenid, 'desc4' firma_1 from dual);
insert into kunden (select 5 kundenid, 'desc5' firma_1 from dual);
insert into kunden (select 6 kundenid, 'desc6' firma_1 from dual);
insert into kunden (select 7 kundenid, 'desc7' firma_1 from dual);
insert into kunden (select 8 kundenid, 'desc8' firma_1 from dual);
insert into kunden (select 9 kundenid, 'desc9' firma_1 from dual);
insert into kunden (select 10 kundenid, 'desc10' firma_1 from dual);
insert into kunden (select 11 kundenid, 'desc11' firma_1 from dual);
insert into kunden (select 12 kundenid, 'desc12' firma_1 from dual);
insert into kunden (select 13 kundenid, 'desc13' firma_1 from dual);
insert into kunden (select 14 kundenid, 'desc14' firma_1 from dual);
insert into kunden (select 15 kundenid, 'desc15' firma_1 from dual);
insert into kunden (select 16 kundenid, 'desc16' firma_1 from dual);
commit;
with t_rank as (
select to_char(kunde_id) kunde_id, kdnr, firma_1, sum(auftrag_total) sum_at,
row_number() over (order by sum(auftrag_total) desc) rn
from auftrag, kunden
where kunde_id = kundenid
and trunc(datum,'y') = trunc(sysdate,'y')
group by kunde_id, kdnr, firma_1)
select *
from t_rank
where rn <= 9
union all
select 'Rest', 'Rest', 'Rest', sum(sum_at), 10
from t_rank
where rn > 9
order by 5 -
Sum Encrypt does not recognize a copy of a file through linux to Mac 0S9. How decrypt this file with Sum Encrypt?
Hello, and welcome to Apple Support Communities!
I am not familiar with the program that you list, however files in OS 9 use things called Resource Forks (rather than file extensions) for filetype and creator.
If you sent a file through Linux these resource forks probably got stripped and now the file is nothing to your Macintosh.
It is best to BinHex your files (.hqx) before leaving the HFS file system so that their resource forks are preserved.
Regards,
Ryan -
Table name should be concatenated with month & year eg.product_may09
hello all,
I have to take a backup of table on monthly basis. for this table name should be concatenated with previous month and year eg., product_may09.. I tried with Create table stmnt its not working anyone please help.It would be very generous from you if you would provide us with versions, what you did and what's not working (maybe an error message?)...
Anyway; If I got you right you want to create a backup table with the same structure and data as in your base table?
maybe this:
forms_ddl('create table product_'||to_char(sysdate, 'monyy')||' as select * from product');fits your requirement. This creates you a table with the same structure and data as your basetable (except the primary/foreign keys, indices and trigger you have on the basetable).
But if you have to do this every month by hand I'd go for a database job which runs once a month with the above statement. In database procedures you have to use execute immediate instead of forms_ddl; usage is the same (except execute immediate raises intelligent exceptions in contrary to forms_ddl). take a look at http://tahiti.oracle.com and search after dbms_job or dbms_scheduler (depending the database version you use which you also didn't mention)
regards -
Show row/column with empty dimension values.
I have 2 columns where 1 column is dimension and 1 column is measure. I need to hide the row when the dimension is empty.
What I did is at the block I UN-TICK "Show row/column with empty dimension values". But it didnt works.
Thanks.click on the block and add a filter with condition dimension isnotnull. this will eliminate the dimension rows with empty values.
Thanks,
karthik -
Deployment of JAVA-Patches with SUM failed, MOPZ has downloaded malicious code
some time ago, we did an upgrade of our doublestack PI-System from NW-PI-700-SPS18 to NW-PI-731-SPS05.
Now, i wanted to upgrade this PI-system from NW-PI-731-SPS05 to NW-PI-731-SPS07.
with SUM 1.0 SP10 PL4 we are now failing in the Execution-phase (Downtime):
Error in phase 5.6. execution (downtime) of the JAVA-Part
F ********************************************************************************
F *** ERROR => Node 'deployment' failed with exit code 67.
F ***
F *** Please see section 'Failures in the 'deploying offline components' phase'
F *** in SAP Note 1316652 for additional information and trouble shooting advice.
F ********************************************************************************
and the instance could not start up anymore !?
in sap-note 1316652 there is mentioned a separate sap-note 1550641 for this error
http://service.sap.com/sap/support/notes/1316652
in sap-note 1550641 - Update fails-Node 'deployment' failed with exit code 67.
http://service.sap.com/sap/support/notes/1550641
Solution:
A fix cannot be deployed as a patch, because the deployer itself is broken.
The solution is to reset a back up state of the system, to download the new version of the stack from SAP Marketplace, and to rerun the update/upgrade procedure.
i downloaded the patch-stack (with Solman MOPZ) some days ago,
so MOPZ did download the malicious code of deployment components..... ?!
so what to do?Hi,
sorry for my late reply,
but the whole story needs a lot of time (nearly 2 month) and finally ends successfully.
first: (summary) the main-title of this thread is wrong,
it was not MOPZ or Solman download, what caused this issue.
the problem was caused by a remaining (old) sapxmltoolkit.jar in the java-bootstrap folder
details are coming ...
(all dates in yyyy-mm-dd)
=========================================
2014-05-16 at 13:04 CET:
SUM upgrade hangs with java-server did not start (in phase 5.2. Execution = downtime)
i opend OSS-ticket with several details + logs attached and opened the connection to our system.
SAP-Ticket, prio_Medium (because it is "only" a sandbox issue),
2014-05-30 at 20:21 CET:
1."sign-of-live" from sap-support,
Asking for additional logfiles from the work-directory of the sap-system
2014-06-02 at 11:14 CET:
my Answer to the questions and adding the demanded logfiles.
2014-06-02 at 21:57 CET:
2.answer from SAP-support, asking to repeat the last SUM-step, to see, if the issue is still there
2014-06-03 at 10:22 CET:
my answer after repeating SUM-step and attaching new logfiles.
2014-06-03 at 21:18 CET:
3.answer from SAP-support, i should check if system is up and running, if hostname, port-no is correct.
2014-06-03 at 10:22 CET:
my answer: hostname + portnr are o.k. - but system still did not startup (java-server)
2014-06-04 at 19:30 CET:
4.answer from SAP-support, delivering an upload-URL, could not read attached splitted .zip-files of log-files
2014-06-05 at 07:28 CET:
i did collect all logfiles again and uploaded them to the 1.upload-URL
2014-06-05 at 16:48 CET:
5.answer from SAP-support, give hint to sap-note: 1550641 - Update fails-Node 'deployment' failed with exit code 67
2014-06-06 at 10:17 CET:
i answered that (in my opinion) the mentioned sap-note did not match the issue (only to NW-7.00) ,
because i did not have to change anything, only i should do a restore from tape and start SUM from the beginning,
i insisted in more and deeper investigations by SAP-support.
2014-06-06 at 19:00 CET:
6.answer of SAP-support: moving the ticket to the next support-level (developm.support)
2014-06-09 at 10:11 CET:
7.answer from SAP-support: asking for new submittion of logfiles of work-dir.
2014-06-10 at 08:39 CET:
asking for a new upload-URL because of large logfiles
2014-06-10 at 17:31 CET:
8.answer from SAP-support: providing an new upload-URL
2014-06-10 at 17:53 CET:
i did collect all logfiles again and uploaded them to the 2.upload-URL
2014-06-12 at 09:07 CET:
9.answer from SAP-support: asking for more details, listings of directory-content of ..../j2ee/cluster/...
2014-06-12 at 10:23 CET:
i did collect all dir-infos and attached a doc to the ticket
2014-06-19 at 10:11 CET:
10.answer from SAP-support: asking for WTS-connection to start investigate and debung on our systems
2014-06-23 at 10:44 CET:
i answered, and provided WTS-connection info
2014-06-26 at 13:12 CET:
11.answer from SAP-support: could not see a running SID-engine, no SAP-MC, no directory, no folder, where is the engine?
2014-06-27 at 08:01 CET:
i answered, and provided detailed server-info and WTS-connection info,
remembering that SID is in SUM-downtime and java-server is not running, because could not be startet,
2014-06-30 at 14:01 CET:
12.answer from SAP-support: asking for an installed java6-sdk(jdk), the java6-jre is not enough to debug.
2014-07-02 at 11:40 CET:
my answer after installing java6-sdk on the WTS-server,
2014-07-07 at 15:11 CET:
13.answer from SAP-support: after debugging found an very old sapxmltoolkit.jar in the java-bootstrap folder
moving the ticket to SUM-support - java-developm-support.
2014-07-09 at 08:36 CET:
14.answer from SAP-support: (SUM-support - java-developm-support) asking for attaching the SUM stack-xml file to the ticket.
2014-07-09 at 14:32 CET:
16.answer from SAP-support: asking to remove the sapxmltoolkit.jar from the java-bootstrap folder and restart SUM (repeat last step)
2014-07-09 at 15:00 CET:
i am happy to get the solution to this issue,
after removing the .jar file from java-bootstrap folder, SUM restart last step,
the SUM-phase execution continues to run, java-server could start, ....
.... finally SUM ended successfully.
==================================
remarks:
formerly, we did a copy of that mentioned sapxmltoolkit.jar to the java-bootstrap folder (in March 2013) because of investigation PI-processes
after upgrading from NW-7.00 to NW-7.31, to get PI-system running after upgrade to NW-7.31
but maybe that formerly issues were caused by other things, cache or so ...
and since then (March 2013) we could start/stop that PI-system several times without any problem, only SUM-upgrade could not ......
i really understand that investigating problems in SAP-software (e.g. SUM-process, java-startup ...) is not easy and could have many causes.
but in summary this SUM-downtime was really large (55 days of downtime) , because of sandbox-system we want to investigate this time,
to get the solution to this issue.
if some SAP people want to look for speed-up options in the whole support-process, the OSS_ticket-no is: ( 459757 / 2014 )
Thanks to SAP-support (for the helpful solution)
Christoph -
Multiple row subquery with like operator
can any1 give me an example where we can use a multiple row subquery with the like operator.I read it can be used but when i tried it gives the following error
select * from gagan_emp where ename like (select ename from gagan_emp where deptno=10)
ERROR at line 1:
ORA-01427: single-row subquery returns more than one rowThe right part of 'LIKE' is permitted only single value expression
(including subquery that returns single value),
is not permitted multiple values.
-- Examples (but.... not so good)
select * from gagan_emp e0
where exists
(select ename from gagan_emp e1 where deptno=10
and e0.ename like e1.ename)
select * from gagan_emp e0
where exists
(select ename from gagan_emp e1 where deptno=10
and e0.ename = e1.ename)
select * from gagan_emp e0
where ename = any
(select ename from gagan_emp e1 where deptno=10)
select * from gagan_emp
where ename like
(select ename from gagan_emp e1 where deptno=10 and rownum=1)
; -
Multi-Row panorama with Photomerge ...
Hi,
does somebody has experiences with stitching multi-row panoramas with CS4's photomerge?
I always ended up with a very strange viewpoint somewhere into the sky instead of a straight horizont. It's somehow understandable - where should Photomerge know the horizont and the desired viewpoint from.
So, are there any tutorials or hints how to create multi row panoramas with Photomerge - I searched a lot but didn't find any usable. Or do I have to use another tool like PTGui?
Thanks a lot
KonradYes, the first row are image in the orthognal plane around the vertical axis. Stitching them together result in a normal horizontal 360 pano.
But I've a second row above the first one from the upper parts of the sourrounding. And using Photomerge they are not merged together in a way that places the first row in front of the horizont is still the same as for the first row - what's clear, because PS does known nothing about those semantics. -
Multi-row uipdate with an insert into another table [I think]
Folks,
I'm trying to get a multi row region with a checkbox against each row. When a user checks a box I want to insert a corresponding row into another table. So I've tried to simplify the questions and distill the problem down using the EMP table.
So, here goes:
I have table EMPS, which looks like this:
EMPNO Number
FIRSTNAME Varchar2(9)
LASTNAME Varchar2(10)
HIREDATE Date
I have table EMP_CANDIDATES, which looks like this:
EMPNO Number
SELECTION_DATE Date
NOTES Varchar2(53)
- I want to create a multi-row region based on EMPS, with a checkbox on each employee row.
- The user should be able to select any number of employees in the region and then press submit.
- on-submit there needs to be a process, which inserts a record into EMP_CANDIDATES for each checked employee.
I've tried pre-populating a collection with the EMPS records and using apex_item.checkbox to produce a checkbox, using this code:
=============
if apex_collection.collection_exists(p_collection_name=>'EMPS') then
apex_collection.delete_collection(p_collection_name=>'EMPS');
end if;
apex_collection.create_collection_from_query(
p_collection_name=>'EMPS',
p_query=>'select
p.empno,
p.hiredate,
p.firstname,
p.lastname,
null selection
from emps p');
=========
I can create a report region on this using tthe following SQL:
select c001 empno
, c002 hiredate
, c003 firstname
, c004 lastname
,apex_item.checkbox(1,c005) selection
from apex_collections
where collection_name ='EMPS'
======
So how do I now get a MRU that will insert a row into EMP_CANDIDATES for each checked row in my region? Or have I gone about this the wrong way?
TFH
DerekHi Derek,
Firstly, your checkbox should be on the c001 field as this is the one that contains your empno.
Then, you need a page process that can be triggered by a button. The process should be set to run "On submit (After computations and validations)" and the PL/SQL code would be something like:
DECLARE
v_empno NUMBER;
BEGIN
IF HTMLDB_APPLICATION.G_F01.COUNT = 0 THEN
raise_application_error(-20001, 'Please select at least one employee!');
END IF;
FOR i IN 1.. HTMLDB_APPLICATION.G_F01.COUNT LOOP
v_empno := TO_NUMBER(HTMLDB_APPLICATION.G_F01(i));
INSERT INTO EMP_CANDIDATES VALUES (v_empno, whateverdate, whatevernotes);
END LOOP;
END;
This will firstly count the items that have been ticked - if there aren't any, the user gets an error message. If there is at least one item ticked, the code will loop through these, get the empno relating to the ticked box and insert a record into the emp_candidates table. Please note that no account is taken here of any validation on this second table - if you need to ensure, for example, uniqueness of records in this table, you will have to update the above to perform this validation.
Regards
Andy -
Query the new inserted but not committed row join with db
Hi,
I have one vo based on two EOs, one is for update and another is for reference. When inserting a new row, is there any way I can retrieve the data from the reference EM based on the join condition for the new inserted row from the reference EO. If the inserted row is committed, it is not an issue. Before the commit, the join is between the memory and db. I tried to set the VO query mode to
ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS|ViewObject.QUERY_MODE_SCAN_UNPOSTED_ENTITY_ROW, it does not get the column values from the reference EO.
If I use sql, I insert row in one table, then join query this table and another table, within the same transaction, I can get the new row joining with other table rows before committing the trans.
Thx
HuI think you don't need to change the query execution mode
check [url http://blogs.oracle.com/shay/entry/whenvalidateitem_trigger_in_ad]When-Validate-Item trigger in ADF with PPR
Maybe you are looking for
-
How to add link with mp3 to iTunes library?
I purchased a song which is actually a link ending in mp3. I want to save it to my itunes library, but when I highlight and right-click on it, it only gives me the option to "save as itunes spoken word." Also how do I make itunes as my default audio
-
PNG transparent image would not show correct color
I am trying to draw some colored string on an transparent png image (24 bit color). I tried to draw red, blue and green color string. The string using blue and green color showed ok. But string drew in red color showed as black. Any idea what's wrong
-
I get no image sent from my iMac to my second monitor using VGA adaptor
I am not getting any image sent from my iMac to my second monitor. I am using a VGA adaptor. Any suggestions?
-
Reading a mac picture CD on a PC
I wish to transfer to a PC running windows XP a whole photo album, or rather a folder containing subfolders of photos. They are in various formats (PICT, jpeg, png). I put them in a CD and tried to view them on the PC, but most of the pics could not
-
Any explanation as to why people can't delete a project with content in it from trash? is there any way to bypass this without having to manually go under the project and subfolders and delete all the content before going back and delete the project?