How to get the summation of a record over time
i have a database. i insert salary every month into my table.i want the total of each employee's salary to be populated in another table, so that at the end of every month, i will have the current total salary of each employee populating this table which will be there as another data. when i insert the value into a column of a table (such as employees table), i want the current value to be added automatically to the previous value such that at the end of every month i will know the total salary received by each employee just by looking at this table.
how do i achieve this objective?
thanks.
this example might be of help:
SQL> select * from emp_sal_log;
EMPNO SAL_DATE SALARY
A 09-AUG-06 1400
A 23-AUG-06 1500
A 06-SEP-06 1600
A 20-SEP-06 1700
B 20-SEP-06 1600
SQL> declare
2 cursor c1 is
3 select a.empno, a.sal_date, a.salary, a.rowid,
4 row_number() over (partition by a.empno order by a.sal_date) rn
5 from emp_sal_log a;
6
7 vRnCtr Number := 0;
8 vPrevRowId Varchar2(40);
9 begin
10 for c1_rec in c1 loop
11 vRnCtr := c1_rec.rn + 1;
12 if c1_rec.rn = 1 then
13 -- nothing to process since it is the first transaction
14 -- for a given employee
15 null;
16 else
17 update emp_sal_log
18 set salary = salary + c1_rec.salary
19 where rowid = vPrevRowID;
20 commit;
21 end if;
22 vPrevRowId := c1_rec.rowid;
23 end loop;
24 end;
25 /
PL/SQL procedure successfully completed.
SQL> select * from emp_sal_log;
EMPNO SAL_DATE SALARY
A 09-AUG-06 2900
A 23-AUG-06 3100
A 06-SEP-06 3300
A 20-SEP-06 1700
B 20-SEP-06 1600
SQL>
Similar Messages
-
How to get the sample repository data of over 6000 records for products
Hi,
I have MDM installed and ready to use with the standard 9 repositories provided by SAP. I was wondering if I can get the unarchive .a2a file with the sample data of records (I think over 6000 records) for the Products repository. I have tried to bring in the two .a2a product files that I have, but it was giving version inconsistent errors. How do and where do I get the real sample data (not the one we can create in data manager) correct version provided by SAP, so that I can get my hands on SAP data manager funtionality.
Thanks in advance,
N@v!n KHi Navin,
Business Content archives that are provided by SAP for MDM do not come with the sample data.
In the bsuiness content ,if you unzip the file you will see the a2a archive of the rep as provided by SAP and the import /export maps and the lookup data file.
There is no main records that SAP provide with the sap content it is basically the data modell that SAP provides so that the foundation is set for you and you can now import and work with the data.
However if you wish to use the demo repository or the training rep from Inquera then you will same some sample data already loaded in MDM rep to work upon.
Regarding the version problem
Check the MDM version of the business content rep with the MDM server you are using .They have to match to work correctly.
You can work with a lower archives of the rep(say SP04) with an Upgraded MDM server (say SP06) by using the Update Repository option in the context menu of the MDM server in Console.
But the vice versa is not possible.
Check you MDM server version by clicking on the MDM server and see its details in the right side record detail pane.
To know more on the demo and Inquera rep kinldy view the below links:
https://www.sdn.sap.com/irj/sdn/nw-demomodel#section21 (Demo Rep)
http://www.inquera.com/InqueraCatalog/CustomerLogin.asp(Demo Rep from Inquera you need to register and they will mail you)
Hope It Helped
Thanks & Regards
Simona Pinto -
How to get the key values of record in ADF Read-only Form?
Hi
I am using ADF Business Component VO.
I have a search page( ADF Search Form) and I am displaying the results of the search in a ADF Read-Only Table( only few columns are shown) .Then by selecting a record and clicking on the button 'View' , I am navigating to a different page(ADF Read-Only Form) to show all the columns of the table for the selected record.
In the second page, I have one more button 'view child details'.Now when I click on this view child details button, I have to show another page(ADF Read-Only Form) which fetches the data from one of the child tables of parent record.
My idea is to create a ViewLink between the parent and child tables.( I have more than 15 child tables for a parent table).
Is there anyother way to achieve this functionality?
Please respond ASAP.
Thanks in advance.
~Sivaji..
Message was edited by:
Sivaji...the bossSijav,
ASAP?
Anyway - yes, you can do this with a view link. When you add the child table to the application model, make sure you actually add it as a child of the parent table instance (select the parent VO first, then use the shuttle to add it). This way, the parent->child relationship should be coordinated for you automatically. You should not need to get the key values manually.
Then, when you create the page to show the detail table, make sure you use the child table that is shown as a child of the parent table in the data control palette (expand parent table to see the child).
Hope this helps,
John -
How to get the first and last record
Hai All
I have table called T1 and there are more than 8 lakhs records and i have a column called Timestamp so i need to get the first record value and time stampvalue and last record and time stamp value so that i can conclude that For Example
form 13 june to 15 june data are here
Kind Regards
SrikkanthMSomething like this can also indicate the first and last rows as you query...
SQL> select empno, ename, hiredate
2 ,case row_number() over (order by hiredate)
3 when 1 then 'First Row'
4 when count(*) over () then 'Last Row'
5 end as flag
6 from emp;
EMPNO ENAME HIREDATE FLAG
7369 SMITH 17/12/1980 00:00:00 First Row
7499 ALLEN 20/02/1981 00:00:00
7521 WARD 22/02/1981 00:00:00
7566 JONES 02/04/1981 00:00:00
7698 BLAKE 01/05/1981 00:00:00
7782 CLARK 09/06/1981 00:00:00
7844 TURNER 08/09/1981 00:00:00
7654 MARTIN 28/09/1981 00:00:00
7839 KING 17/11/1981 00:00:00
7900 JAMES 03/12/1981 00:00:00
7902 FORD 03/12/1981 00:00:00
7934 MILLER 23/01/1982 00:00:00
7788 SCOTT 19/04/1987 00:00:00
7876 ADAMS 23/05/1987 00:00:00 Last Row
14 rows selected.
SQL> -
How to get the blending mode to carry over to the next comp.
Hey all.
I have a project going that involves several comps, and one of those comps involves setting the transfer mode of some layers to add, in order to get rid of the black background. The problem is, when i drop this comp into another comp, the black is back, and I need to set the transfer mode again, which messes with the colors of all the other objects in the previous comp.
Is there a way to make sure that once a transfer mode is selected, that it stays that way even when the comp is dropped into another comp?
Thanksand one of those comps involves setting the transfer mode of some layers to add, in order to get rid of the black background.
Well, no offense, but that's a rubbish workflow. If you need genuine transparency, then create it properly. It's as simple as that. Use Shift Channels, the Channel Combiner or any other effects to "unmultiply" your layers or rewire channels. Doesn't even matter whether you do it on your source layers or the combined result of your additively blended layers - whichever works best to give the desired look.
Mylenium -
How to get the of last Exicution date and time of a program
Hi all ,
Is there any table which stores the last exicution Time And Date of a report.
plz give me the table which stores above details.Check out STAT and STAD transactions or
try table D010SINF -
How to Get the Current Workitem id at runtime
Hi All,
I have a scenario, where request pending with a user who has already resigned the organization. The requirement is that we need to provide a report
of the request and with whom it is pending with along with the workitem id with a forward push button.
So that if the user identifies that a request is pending with someone he can click the record and press for the forward button and a pop-up to be showed where he can enter the userid to whom he needs to forward it.
In this scenario can anyone tell me how to get the current workitem id at run time and to save it to a custom table.
I tried with method before workitem execution, but here i am not getting the current workitem id.
Can you please suggest a good solution for this.
Thanks and Regards,
BalajiKarri,
I think i can explain you with an example.
Here is my Scenario.
A user has raised a Gate pass and it went to all approval's and got approved and the material is also sent out from the plant. Lets take the date as 1.1.2013 (A Warehouse person have done the checking and sent out of the plant).
On 1.3.2013 some of the material has been returned and a material inward request has been raised and now the warehouse person has to do a inward checking and to sent it back for the initiator for the approval, but the warehouse person has resigned the organization on 1.2.2013, now the workitem is pending with the warehouse person who has already resigned.
My scenario is once the material inward request is created and before the workitem is delivered to the warehouse person i need to get the workitem id and to store the workitem some where.
So that in future if any warehouse dept head wants to forward the workitem which are lying in the person inbox who has already resigned he can do it via a report using this workitem id.
So, can anyone help how to get the dialog workitem id before the workitem creation or execution. I tried with "method before workitem execution" but my break point is not triggering at this point.
Thanks and Regards,
Balaji -
How can I get the number of distinct records that each field of a DB table has?
Hi everyone,
I would like to know how to get he number of distinct records that each field of a DB table has. When tracing a SQL statement either in ST12 or ST05, in the plan execution, if the sentence made useage of an index, then I can click in the index name and see this kind of information (no. of distinct values for each field of that index).
Can I do something like this but with the whole fields of a table?
What I have found until now is in Tx ST10; I search for whatever kind of table statistics and then use the function of "Analyze table" (which takes me to Tx DB05). In here, I can enter a table and up to 5 fields in order to get the information that I want.
Is there any other way to do this?
Regards,
David RezaHi David,
You can export the same to excel and sort as per requirement.
Sorry is that what you are looking for ?
Regards,
Deepanshu Sharma -
How to get the total record count in ODI
Hi
I have the interface the are file to DB.
The format is like this..
HEADER
DETAIL
TRAILER
Now will write the contains of file to DB,
But i have to insert the total count ie numberof record written from file to DB in my Trailer record.
can you tell me how can i get the total count of records in file and write it to trailer?
Also, I want the interface to rollback the data if something fails will loading the data from file., ie. if there are 100 records in file and 50 got transfer and something fails i want to rollabck the 50 records from DB.???
Thanks :)Hi
You can design a flow for Full load flow and incremental flow from flat file to Table.
Create a table at target database like.. (create table with last_execution and palce the V_FULL_LOAD value and LAST_EXECUTION_DT columns in last_execution table)
Add faltfile as table in model, create a variable as V_FULL_LOAD and make sure that the default values is 01-01-1900
Create one more variable like V_LAST_EXECUTION_DATE (in this variable write a case statement that if V_FULL_LOAD value is 'Y" then full load should happen and same time you should check that V_FULL_LOAD column is balnk then write insert statment else write update statement to update last_execution_dt column, similar for 'N')
please provide your *personal mail ID*, i will send a doc file realted to your query.
we have to tables present in work repository (SNP_STEP and STEP_LOG tables) using tables we can get how many records are inserted/updated and we can find how many records are not transfer and gor error.
Thanks
Phani -
How can i get the rowNumber of a record in a table ?
How can i get the rowNumber of a record in a table ?
Marcel,
Please consult the "Tables" chapter in the UIX Developer's Guide. You can search for a method titled "doSelectionEvent" that will indicate how to deal with table selections.
Hope this helps,
Ryan Pollock -
How to get the individual records
Table A
SNO DAY_FROM DAY_TO
1 1 3
Result:
DAY_FROM DAY_TO
1 3
2 3
3 3
Above mentioned Table DAY_TO value is 3 ,
So in that How to get the 3 individual records for above mentioned row.
Thanks in advance.
Edited by: UserK on Sep 11, 2009 8:14 AM1 with t as
2 ( select 1 day_from, 3 day_to from dual)
3 select day_from +level -1 day_from, day_to
4 from t
5* connect by level <= day_to
SQL>
SQL>/
DAY_FROM DAY_TO
1 3
2 3
3 3 -
How to get the previous record value in the current record plz help me...
In my sql how to get the previous record value...
in table i m having the field called Date i want find the difference b/w 2nd record date value with first record date... plz any one help me to know this i m waiting for ur reply....
Thanx in Advance
with regards
kotreshFirst of this not hte mysql or database forum so don;t repeate again.
to get diff between two date in mysql use date_format() to convert them to date if they r not date type
then use - (minus)to get diff. -
How to get the table with no. of records after filter in webdynpro
Dear Gurus,
How to get the table with no. of records after filter in webdynpro?
Thanks in advance.
SankarHello Sankar,
Please explain your requirement clearly so that we can help you easily.
To get the table records from your context node use method get_static_attributes_table()
data lo_nd_mynode type ref to if_wd_context_node.
data lt_atrributes_table type wd_this->elements_mynode.
lo_nd_mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ).
lo_nd_mynode->get_static_attributes_table( importing table = lt_atrributes_table ).
Note: You should have already defined your context node as a Dictionary Structure.
BR,
RAM -
How to get the records of the particluar day when delta laod failed (Urgent
Hello BW Gurus,
We are facing one serious issue. Here is the scenario.
1st time the Delta was init and for next consective two loads delta ran sucessfully... then next time delta got failed and the status is in red..... even though system started next delta loading and it has fetched the records and status is in green but not activated ,,,,,its happening still past one month so almost there are 20 requests which are to be get activatetd.
How to resolve this issue.
<b>And how to get the records of the partilcular day when the delta got failed.
</b>
Anyone have come across with this strange issue then help me out and i will rewarrd the points.
Urs,
Raki.Hi
Can you provide more details about your extractor and data targets.
Are you loading delta to an ODS ??
If you are loading to an ODS, The only solution i can see is to get the missing delta records via FULL UPDATE. Because if you delete the error request from ODS it will also delete the 20 successful requests above it.
Cheers
Praveen
null -
How to get the records which has a specified x/y coordinates
Hi,
How to get the records which has a specified x/y coordinates. I have a table which has street data. And another table has a point data. Now I just want to get the records from street data which includes the points in the point data table. Can any one give your suggestions
Thanks and Regards
AravindanAravinda,
If you want to find the line segments which intersect the given
set of points, you can do that with SDO_RELATE.
siva
Maybe you are looking for
-
Dependency between Sun Cluster 2.2 and Sun hardware ?
I am evaluating Sun Cluster 2.2 for the usage as clustering software within our project. Can anybody say me, if there is a dependency between Sun Cluster 2.2 and Sun hardware ? Can I use Sun Cluster 2.2 with other hardware platforms running Sun Solar
-
CO Account Assignment: Profit Centers and Cost Centers Assignment
Hello Experts, I am trying to understand profit/cost center assignment at the contract level. My client has requirement to assign them based on utility type. So I was wondering should I assign them during move-in at contract? Any suggestions would be
-
Checking NVRAM ? whats this
I have a P965 Planinum board and this system hase been running for several months now. This morning it came up with Checking NVRAm at boot up and stoped there. I rebooted and it went away. I did get this this a couple days ago also, again I had to re
-
¿what user should own ICM profiles and stuff?
I'm trying to install the foo2zjs printer driver however, it fails in the make install, because it tries to install some files (ICM Profiles) and giving them to the lp user (using the install command). However, arch doesn't have this user. I know I c
-
I have a client who would like to edit an InDesign file in the Cloud. Is this possible? I could not find any tools in the Cloud that supports this. Though, I thought this was a benefit of having it in the cloud that people didn't need to have InDesig