Trying to get ending entry into force for the groups of lines
Hello worldI searched the forums, but I can't find a post that is a problem quite like that.
I have some data that looks like this:
ID_NUM EFFECTIVE ALLOC_PERCENT ACCT
---------- --------- ------------- ----
101 01-JUL-11 21 A1
101 01-JUL-11 72 A2
101 01-JUL-11 7 A3
101 01-JUL-12 20 B1
101 01-JUL-12 80 B2
101 01-JAN-13 20 A1
101 01-JAN-13 20 A2
101 01-JAN-13 50 A3
101 01-JAN-13 10 B1
101 01-JUN-13 50 A1
101 01-JUN-13 50 A2
(note: I inserted manually empty lines for clarity)Here's the logic: the lines represent an assignment of percentage on the account for the identification number specified for this entry into force. A new date to cancel the previous, and if any line in the conceptual group is replaced, so they are all.
I'll try to find the date when the effective period of each group ended and which includes in the game so that I can calculate then the number of days in a given line has been effective; something like that;
ID_NUM EFFECTIVE END_DATE ALLOC_PERCENT ACCT
---------- --------- ---------- ------------- ----
101 01-JUL-11 01-JUL-12 21 A1
101 01-JUL-11 01-JUL-12 72 A2
101 01-JUL-11 01-JUL-12 7 A3
101 01-JUL-12 01-JAN-13 20 B1
101 01-JUL-12 01-JAN-13 80 B2
101 01-JAN-13 01-JUN-13 20 A1
101 01-JAN-13 01-JUN-13 20 A2
101 01-JAN-13 01-JUN-13 50 A3
101 01-JAN-13 01-JUN-13 10 B1
101 01-JUN-13 <null> 50 A1
101 01-JUN-13 <null> 50 A2
The end_date of the group is the EFFECTIVE_DATE of the next group (ordered by ID_NUM, EFFECTIVE_DATE).End_date of two rows is zero because there is no group of lines with an effective date the later - in my process, I'll NVL which sysdate so that my calculations of days will be valid.
I tried some analytical queries with LEAD, but I couldn't figure out how to get the next date of the efficient group. I could get the entry into force of the next row, but not the next group. I couldn't specify how many lead lines to look forward, because there is not a number of rows in each group.
How to fill the end_date column?
Here's the code to create the above.
create table t
(id_num number,
effective_date date,
alloc_percent number,
acct_code varchar2(4)
);
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2011',21.0,'A1');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2011',72.0,'A2');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2011',7.0,'A3');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2012',20.0,'B1');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jul-2012',80.0,'B2');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',20.0,'A1');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',20.0,'A2');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',50.0,'A3');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jan-2013',10.0,'B1');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jun-2013',50.0,'A1');
insert into t (id_num,Effective_date,alloc_percent,acct_code) values(101,'01-jun-2013',50.0,'A2');
commit;
select * from t;
Oracle version information:Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production."
AMT for Solaris: 11.2.0.3.0 - Production Version
NLSRTL Version 11.2.0.3.0 - Production
Thank you very much
Hello
Here is one more way to do using lead work.
WITH ds as (id_num, effective_Date, lead (effective_date) select on end_date (id_num order, effective_Date))
t
Id_num group, effective_date)
Select t.*, ds.end_date
DS, t
where t.effective_Date = ds.effective_Date;
Tags: Database
Similar Questions
-
Get a new graphics card for the HP Envy 700-214
Hello
So I tried to get a new graphics card for my HP Envy 700-214, but I'm not aware if this map is compatible or if it would have a negative impact on my system.
http://www.GeForce.com/hardware/desktop-GPUs/GeForce-GTX-750-TI/specifications
I don't want my system to be harmed in any way. Here is the link to the computer.
http://support.HP.com/us-en/document/c04100558
Thank you!
Wolfking98, welcome to the forum.
Here is the video card manufactured by EVGA. It shouldn't harm your system somehow. However, if you have trouble with the installation, you can contact their Technical Support (1-888-880-3842) or online. They were very useful for me. Read the reviews to see what users have to say about it. As you can see, there are a lot of comments and appreciation 5 eggs. You can't do better.
Please click on the Thumbs up button '+' if I helped you and click on "Accept as Solution" If your problem is resolved.
-
I'm trying to get my computer to communicate with the printer so it iis 'tail' documents.
I'm trying to get my computer to communicate with the printer - for the moment that it is 'Queue' documents.
What should I do to get the printer to work?
Hello
1. What is the brand and model of your printer?
2. how you have connected the printer?Download and run the tool Fixit of the article mentioned below and check if this solves the problem.
Problems printing and printing errors:
http://support.Microsoft.com/GP/printing_problemsKind regards
Afzal Taher - Microsoft technical support.
Visit our Microsoft answers feedback Forum and let us know what you think. -
I don't see my external cd in the finder under devices, I can load a blank cd and iTunes says it's white and I can burn songs, then the cd icon appears on the desktop, went into preferences for the finder and ticked the box show the cd. Help please? CD has been disconnected and placed back started loading but no show, iMac says he had an attached cd when I search.
CD/DVD players don't appear that a disk is inserted. It's normal.
-
I get an error code 0xD59 for the update of Service Pack KB2463332? Then he wants to resart my computer for an update failed? Why?
Hello
Click on the below mentioned link to manually install the update on your computer.
Microsoft SQL Server 2005 Express Edition Service Pack 4 for Windows XP.
http://www.Microsoft.com/en-US/Download/details.aspx?ID=184After you install the update, restart your computer and check if the problem is resolved. -
How can I get a driver 64 bits for the mouse?
I installed W7 to xp pro. W7 is a 64-bit operating system, xp is a 32-bit. My mouse (Logitech USB PS/2 optical mouse does not work.) When I check the drivers, they are 32-bit and when I install new drivers, they are also 32-bit. How can I get a driver 64 bits for the mouse?
Original title: mouse drivers
The game, August 28, 2014 16:18:16 + 0000, WILLROSS wrote:
I installed W7 to xp pro. W7 is a 64-bit operating system, xp is a 32-bit. My mouse (Logitech USB PS/2 optical mouse does not work.) When I check the drivers, they are 32-bit and when I install new drivers, they are also 32-bit. How can I get a driver 64 bits for the mouse?
I don't know if there is a driver 64-bit Windows 7 to your
mouse. It's Logitech to decide or not to produce a.
Check on their website to see if it exists. If not, you
are out of luck, but fortunately that a new mouse shouldn't be very
Dear. -
Hello
Need help... When you try to make a Photo montage I get an error "not available for the creation of valid size.
Photoshop Elements 11, Windows 7 PC.
Thank you
-
Question about a query that will be 1 for the first 10 lines, 2 for the
Hi all
I am trying to write a query that will be 1 for the first 10 lines, 2 for the next ten lines and so on.
I tried several approaches such as mod, rank, case but could not get the correct idea.
Grateful if someone can give me a hint on this one.
Ex:
Col1 Col2
1 989
1 120
1 876
2 121
2 456
2 87
1 of 3
3 22
3 333
....................... and so on..
Thank you
MK.How about this:
His past all my tests so far
select trunc((rownum - mod(rownum-1,10))/10)+1 from dual connect by level <= 1000
-
Captivate in 8, can you apply an effect (for example, a transition) for the grouped shapes? (I can apply the effect to a single shape, but when I group forms, I can't understand how).
Hello
It is not possible to apply effects to groups of forms. You can apply the transition from the distribution panel and other properties in the property inspector.
You will need to apply the same effect of the same duration for all objects in a group in this case.
Thank you.
-
In the present implementation by Adobe if you need Lightroom alone, they must obtain and pay for Photoshop also which I'm not interested. Is it possible I can get only Lightroom. ? Help, please.
Just for clarity, the strict answer to your question is 'no': you can't just Lightroom for the same price as the bundle Lr/Photoshop Creative Cloud (CC).
You can buy a stand-alone license for Lightroom only - that's what Don and Elijah helped you to find - but the terms of pricing (and licenses) are entirely different from those that make up the whole of the CC.
Also note, it is likely that Lightroom 6 will come before long (although how long is not known): almost certainly, you will pay for the upgrade to Lr 6 If you are on a stand-alone license, then just 5 to 6 (7 and to...) is included in the price of the set.
-
Question on DNS entries for the grouping and the call
Hey all,.
We test a bunch of highway that has been placed in its own subdomian DNS (for example)
cluster.Domaine.com
With DNS entries:
SRV
_sips._tcp.cluster.domain.com. 86400 IN SRV 5061 1 1 Expressway1.cluster.domain.com.
_sips._tcp.cluster.domain.com. 86400 IN SRV 5061 1 1 Expressway2.cluster.domain.com.
_sip._tcp.cluster.domain.com. 86400 IN SRV 1 1 5060 Expressway1.cluster.domain.com.
_sip._tcp.cluster.domain.com. 86400 IN SRV 1 1 5060 Expressway2.cluster.domain.com.
_h323ls._udp.cluster.domain.com. 86400 IN SRV 1 1 1719 Expressway1.cluster.domain.com.
_h323ls._udp.cluster.domain.com. 86400 IN SRV 1 1 1719 Expressway2.cluster.domain.com.
_h323cs._tcp.cluster.domain.com. 86400 IN SRV 1 1 1720 Expressway1.cluster.domain.com.
_h323cs._tcp.cluster.domain.com. 86400 IN SRV 1 1 1720 Expressway2.cluster.domain.com.
_h323rs._udp.cluster.domain.com. 86400 IN SRV 1 1 1719 Expressway1.cluster.domain.com.
_h323rs._udp.clusterdomain.com. 86400 IN SRV 1 1 1719 Expressway2.cluster.domain.com.
A
Expressway1.cluster.domain.com. IN a x.x.x.x (address IP Expressway1)
Expressway2.cluster.domain.com. IN a x.x.x.x (address IP of Expressway2)
However, I would actual calls placed to the root domain
domain.com
But with these entries DNS pointing to the subdomain of cluster, or I point to the individual counterparts of the cluster (see above). My feeling is that what I should do to the cluster so I need update DNS entries for the main domain if the peer of the cluster changes, such as:
SRV
_sips._tcp.domain.com. Cluster.Domaine.com IN SRV 0 0 5061 3600.
_sip._tcp.domain.com. Cluster.Domaine.com IN SRV 0 0 5060 3600.
But is this correct?
Post edited by: Chris Swinney
Comment added to records showing that they point to
Hi Chris, how are you?
If I remember correct SRV RFC which would be an error because no recursive search of srv would get,
the address at the end of the srv record must be an a record (so also no CNAME).
In your scenario, you can use:
_sips._tcp.domain.com. 86400 IN SRV 5061 1 1 Expressway1.cluster.domain.com.
_sips._tcp.domain.com. 86400 IN SRV 5061 1 1 Expressway2.cluster.domain.com.
_sip._tcp.domain.com. 86400 IN SRV 1 1 5060 Expressway1.cluster.domain.com.
_sip._tcp.domain.com. 86400 IN SRV 1 1 5060 Expressway2.cluster.domain.com.
_h323ls._udp.domain.com. 86400 IN SRV 1 1 1719 Expressway1.cluster.domain.com.
_h323ls._udp.domain.com. 86400 IN SRV 1 1 1719 Expressway2.cluster.domain.com.
_h323cs._tcp.domain.com. 86400 IN SRV 1 1 1720 Expressway1.cluster.domain.com.
_h323cs._tcp.domain.com. 86400 IN SRV 1 1 1720 Expressway2.cluster.domain.com.
_h323rs._udp.domain.com. 86400 IN SRV 1 1 1719 Expressway1.cluster.domain.com.
_h323rs._udp.domain.com. 86400 IN SRV 1 1 1719 Expressway2.cluster.domain.com.
h323cs and rs cannot be used (cs is if you dial the field directly without user @ from the beginning)
RS is used for registration, most of the configurations that I saw live fine without it...
BTW, if it is a copy paste, replace your alone there is an error in the last entry of rs, it lacks one. between the two
cluster and field.
Btw2, I would set a record also has to be cluster.domaine.com at least one of the VCS, it's
very convenient for endpoints no or wrong to support srv records.
-
Get "key to upgrade is for the edition of windows that does not work with Windows Anytime Upgrade"
The PC is running Windows 7 Starter. I'm trying to upgrade to Windows 7 Professional. I bought the card from Windows Anytime Upgrade Key.
When I entered the PK, error, "put key in level is for the edition of windows that does not work with Windows Anytime Upgrade"
Windows 7 Anytime Upgrade fails:
If your getting the following: error: Windows Anytime Upgrade failed
This problem may occur if Windows 7 SP1 was downloaded by Windows Update, but has not yet been installed.
See: http://support.microsoft.com/kb/2660811= Other reasons and possible corrections.
Windows Anytime Upgrade fails with the error:
"every time that the upgrade has failed. Go online to solve the problem.
http://support.Microsoft.com/kb/2658652If Anytime Upgrade still does not work:
Shut down and restart your computer.
Make sure that the Windows updates have been installed.
Download the hotfix that contains a tool called CheckSUR, this tool will look at the package and the maintenance of records and difficulty any data corrupted, the tool is listed under kb947821 he can be found at the following link http://support.microsoft.com/?kbid=947821
If Anytime Upgrade still does not work, turn off the user account control:
1. go in user accounts in Control Panel
2 change user account control settings
3. pull the slider to the level as low as possible
4. restart the PC
5. pass by the "Anytime Upgrade" as usual
Try the following:
1 disable any security software before attempting to upgrade
2. make sure that your computer is updated (devices and applications)
3. disconnect all external devices before installing.
4. check your hard disk for errors:
Click Start
Type: CMD, according to the results, right-click CMD
Click on "Run as Administrator"
At the command prompt, type: chkdsk /f /r
When you restart your system, your computer will be scanned for errors and will try to correct them.
1. click on start, type msconfig in the search box and press ENTER.
User account control permission
If you are prompted for an administrator password or a confirmation, type the password, or click on continue.
2. in the general tab, click Selective startup.
3. under Selective startup, clear the check box load startup items.
4. click on the Services tab, select the hide all Microsoft Services check box, and then click Disable all.
5. click on OK.
6. When you are prompted, click on restart.
7. after the computer starts, check if the problem is resolved.
Also run the Windows 7 Upgrade Advisor:
http://www.Microsoft.com/Windows/Windows-7/Upgrade-Advisor.aspx
Who should I contact if I have problems installing and / or activation of my product key card?
Please contact to the: www.windows7.com/getkeysupport.
If all above fails them, install Windows 7 Service Pack 1, and then try the Express Upgrade:
Learn how to install Windows 7 Service Pack 1 (SP1)
http://Windows.Microsoft.com/en-us/Windows7/learn-how-to-install-Windows-7-Service-Pack-1-SP1If your key is not valid and you will need to change the keys, you may need to Open regedit and remove first the ProductKey value in the following registry key:
HKCU\Software\Microsoft\Windows\CurrentVersion\WindowsAnytimeUpgradeAdditional resources:
-
How do you get a prompt value required for the user who runs the report?
Hello
I have a quarter quick in my report.
I want user must pass a value for him?
How to go?
Thanks in advance!
RCHi RC,.
I don't think you can do a mandatory prompt. To do this, you can create a work around.
1. in the command prompt, add possible value; "Please make a selection to first". You can define a SQL query for the value of Ant show you. View all possible values, and via a 'UNION' Add "Please make a selection to first". Default font. Now, your request will be displayed with nothing.
2. create a "No. Results" - view in your application.
In this way, it is not mandatory, but it forces a user to select a value.
I hope this helps.
Daan Bakboord
http://obibb.WordPress.com -
I get a bunch of junk for the values in a column of time stamp: 0x00000000000265FF
I get a bunch of junk for a time stamp column values:
things like:
0x00000000000265FF
0 x 0000000000026601
0 x 0000000000026602
I expected eligible dates.After reading this I realize my error :)
http://www.sqlteam.com/article/timestamps-vs-datetime-data-types
-
Archiving of trigger of end for the Group again
Hello
I use Oracle 11.2 64 bit
Is there a trigger when a redo log group is archived (archival process is complete)?
Kind regards
GroxyYou can install a log_archive_dest for re - try a destination failed after a few seconds, and also make the optional destination for the whole of the base is not crushing a setback if the destination is unreachable.
Take a look on the doco for log_archive_dest attributes:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14239/log_arch_dest_param.htm#SBYDB01100
I hope this helps.
Thank you
Paul
Maybe you are looking for
-
In the left column of the program is a list of all the e-mail addresses that Thunderbird checks. I want to change the order of the list of e-mail addresses. Some addresses are more important to me than others. I would like than to be at the top of th
-
Satellite A660-07U - cannot install the new display driver
When I got to my laptop, it wouldn't even start the box! So I googled how to get operational and it wouldn't install Windows 7 32 bit, so I installed Windows 7 64 bit and that worked. I am one of the users who is also having their laptop freeze on th
-
NB550D can't get out 'box recovery ".
Hi, had the laptop NB550D for a few months and because things were not right I made a recovery of the system of the HD and now it is stuck in 'Now side system performance' for the last 8 hours? and warns not to interrupt or shut down the computer? Sh
-
Is there a Microsoft fix for corrupted tΓches
Windows vista is to say 7 - Task Scheduler is rites or has been tampered with the option - is it a microsoft fix for this
-
How to take off a screen saver?
Original title - screen saver played a game of Viva Media Alamar games in my computer and the game installed a screensaver on my computer how take off? Thank you very much