SQL: fill the same value, until it gets another NOT NULL value

It's my main table

CREATE TABLE MAIN (EMPNO INTEGER, DATE OF EFF_DT);
INS IN HAND VALUES(1,'2013-01-01');
INS IN HAND VALUES(1,'2013-03-01');
INS IN HAND VALUES(1,'2013-05-01');
INS IN HAND VALUES(1,'2013-07-01');
INS IN HAND VALUES(1,'2013-09-01');
INS IN HAND VALUES(1,'2014-01-01');


It's my table of choice

CREATE TABLE LKP (EMPNO INTEGER, TYPE_CD VARCHAR (10), EFF_DT DATE);
INS IN LKP VALUES(1,'A','2013-01-01');
INS IN LKP VALUES(1,'B','2014-01-01');

My query:

SALT
M.EMPNO AS MAIN_EMP,
M.EFF_DT AS MAIN_DT,
L.TYPE_CD
HAND M LEFT JOIN LKP L ON M.EMPNO = L.EMPNO AND M.EFF_DT = L.EFF_DT

Result:
MAIN_EMP MAIN_DT TYPE_CD
2013-01-01 1A
1 01-03-2013?
1 05-01-2013?
1 01-07-2013?
1 01-09-2013?
2014-01-01 1, B

Expected result: (I need to get the same value, until I have a new value of research)

MAIN_EMP MAIN_DT TYPE_CD
2013-01-01 1A
2013-03-01 1A
2013-05-01 1A
2013-07-01 1A
2013-09-01 1A
2014-01-01 1, B

Please help me in this regard.

Concerning

KVB

RaminHashimzade wrote:

For 11g (ignores null values)

SELECT M.EMPNO AS MAIN_EMP,

M.EFF_DT AS MAIN_DT,

NVL (L.TYPE_CD, lag(L.TYPE_CD ignore nulls) over (partition by M.EMPNO of M.EFF_DT order)) TYPE_CD

HAND M

LEFT JOIN LKP L

ON M.EMPNO = L.EMPNO

AND M.EFF_DT = L.EFF_DT

order by 2

----

Ramin Hashimzade

It's not only 11g, which is also 10g

Tags: Database

Similar Questions

  • get the index of the same values in table

    Hi guys,.

    I'm trying to get the index of array elements with the same value but it can solve mine.

    my case is:


    array1 = [1,2,3,4]; <-here are the names of the pages, always in the order of CSA (these table I used only to check the results of my work, probably will not be for you but maybe...)

    array2 = [1,1,2,2,2,3,4,4,4]; <-these numbers are random, but always in the CSA order (these are the names of pages for items in table 3)

    array3 = [a, b, g, i, f, e, c, h, d]; <-these are all the values of the elements I want to work with later. number of articles is still the same as in array2, their indexes are corresponding.

    array4 = [];

    I need to remove array3 everything, but one of each issue of array2 (as I will remove duplicates) or push to array4 an article of array3 for each number of the array array2 (as I'm going to ignore duplicates)

    don't know is my desc is clear enough, but the result I get is:

    ex. [a, g, e, c]

    above example for each number of array2 array3 items, but do not have to be first, can be second or third if etc exist, but have to be alone.

    I thought that if I get duplicate values, the index in the array array2 and delete this index in array3 will get what I want, but can not solve.

    You will appreciate all help.

    Thank you

    Try something like this:

    var array2 = [1,1,2,2,2,3,4,4,4];
    var array3 = ["a","b","g","i","f","e","c","h","d"];
    
    var tempArray = [];
    var resultArray = [];
    var n , x ;
    
    for(var n=array2.length-1;n>=0;n--)
    {
        var string = ""+array2[n];
        tempArray[string] = array3[n];
    }
    
    for(x in tempArray)
    {
        resultArray.push(tempArray[x]);
    }
    
    resultArray.reverse();
    // a,g,e,c
    

    Hope, that helps.

    Uwe

  • How can I get a CMYK or Gray scale halftone and replace it with a spot color with the same value of midtones?

    Is it possible that I can select an object or objects that have a value of mixed CMYK or Grayscale, and then select a Spot color and it will keep the same value of midtones as before?

    For example, I have an object that is C: 0 M: 0 Y: 0 k: 20 and I select Reflex Blue. What is happening is it change my object to 100% Reflex Blue. Is there a way to change to automaitically Reflex Blue 20%?

    Another example, I have 3 objects, one is 20 k: the second is 40 k: and the third is KC: 85. I want to select all the objects in three at the same time, select Yellow PANTONE and get them to change yellow PANTONE 20, 40 yellow PANTONE and PANTONE yellow 85.

    Is there a way to do it or I will always have to manually edit each element?

    Thanks for the help.

    Select the elements to recolor

    Edit > edit colors > redefine > follow my screenshots

    I love clicking this button under the entitlement, one place for everything that you color reduction settings.

    Use tinted scale. Exact will give you 100% of the color. The exact word is confusing here, this means that the color of the destination (100% of everything that the color you choose), not a version tinged scale.

    Unfortunately I do not know how to get the exact values of blacks to convert the exact values of spot color. Scale of hues will you get you get you close enough for what you need. In my example that a black 89% converts a 84% of the place, so no exact but alteast I have a range of shades, and sometimes the results are better than accurate, depends on your art.

    Here are my before and after.

  • Only GET records that have the same values of field has the same value in field B

    Have a hard time with below, please help.

    Here's the situation:

    create table cord (identification NUMBER, CM VARCHAR2 (3), PM VARCHAR2 (2));
    insert into string values (1, '002', 'H1');
    insert into string values (2, '006', 'H1');
    insert into string values (3, '004', 'H2');
    insert into string values (4, '006', 'H2');
    insert into string values (5, '004', 'H3');
    insert into string values (6, '004', 'H3');

    I just need to select the folders which, for the SAME value of PM have the same value in CM, in example above, those are recordings with ID (5,6).

    1 and 2 fail because for them CM and PM are different for the same H1, similar on the 3 and 4.

    I don't know if this will help but records are always in 'pairs', which means that there are no cases as

    7. '004' | H4

    8. ' 006' | H4

    9. '005' | H4

    Any ideas are much appreciated.

    Thank you

    See if the following can help...

    select id,cm,pm
        from(
            select t.*
                  ,count(1) over(partition by cm,pm) cnt
                from testt t
            )
        where cnt>1;
    
  • All channels to HAVE it have the same value - NI PCI-6221 and NI PCI-6229

    Hello

    I use the aiex1.cpp example for a multi-channel read with the devices mseries 6221 and 6229.

    This example works for a lane, but other chains have the same value (difference of +-0.001 Volt).

    For example: I put 5 Volt on the first string, and then the other channel are 5 Volt too.

    What should I consider in the configuration?

    Heiko Hello!

    your description looks like the effect you are having 'ghosts '.

    For more information about ghost images and how to get rid of, check out these links:

    http://digital.NI.com/public.nsf/allkb/73CB0FB296814E2286256FFD00028DDF?OpenDocument

    and

    http://digital.NI.com/public.nsf/allkb/C6C7DE575301A379862572DD00480A01?OpenDocument

    Best regards

    Moritz M.

  • inputText and ouputText does not display the same value

    Hello

    JDev 11.1.2.4

    On my page, I have an inputText and outputText bound to the same link of the attribute. The bind value is defined in a value change listener, and then the two components are updated. Say I put in 2009 for the PeriodFrom, the inputText remains empty, but the outputText shows the 2009. How is possible that the two items related to the same link does not show the same value.

    < af:inputText value = "#{bindings." PeriodFrom.inputValue}"required =" #{bindings. " PeriodFrom.hints.mandatory}.

    columns = "#{bindings." PeriodFrom.hints.displayWidth}"shortDesc =" #{bindings. " PeriodFrom.hints.tooltip}"id ="id1 ".

    autoSubmit = "true" simple = "true" >

    < f: validator binding = "#{bindings." PeriodFrom.validator} "/ >"

    < / af:inputText >

    < af:outputText value = "#{bindings." PeriodFrom.inputValue}"id ="ot3"clientComponent ="true"/ >

    Furthermore, I tried to get the RichInputText component and call a getValue on it, and the value returned is 2009. I'm completely lost.

    Thank you

    I made the fragment of page from scratch. I discovered why the update does not work. This is because the selectOneChoice is inside an af:subform. If I remove the subform, the update works correctly.

    shortDesc = "#{bindings." StdcntyCode.hints.tooltip}"id ="soc2"simple ="true"autoSubmit = 'true '.

    valueChangeListener = "#{pageFlowScope.identificationSessionEditBean.countryValueChangeListener}" > "

    columns = "#{bindings." PeriodFrom.hints.displayWidth}"shortDesc =" #{bindings. " PeriodFrom.hints.tooltip}"id ="id1 ".

    autoSubmit = "true" simple = "true" >

    columns = "#{bindings." PeriodTo.hints.displayWidth}"shortDesc =" #{bindings. " PeriodTo.hints.tooltip}"id ="id2 ".

    autoSubmit = "true" simple = "true" >

  • Find the same value in different columns

    Hello

    I'm trying to figure out how I would get the same value in the same row but in different columns. For example, in the table sometimes report the name is the same as the description. I would like to find all the lines where this is the case.

    Thank you

    Name of the report
    Description
    Date
    Time
    Report 1Report 1DelalandeTTTT
    Report 2Billing reportDelalandeTTTT
    Report 3Report 3DelalandeTTTT

    Hello

    Is that what you want?

    SELECT *- or whatever the columns that you want to

    FROM table_x

    WHERE description = report_name

    ;

    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • CFQUERY returns always the same value

    < name cfquery = "qryGetMAXID" datasource = "#Request.DSN #" >

    SELECT

    MAX (FLEET_CON_ID) + 1 as MaxFleetId

    Of

    CONFIGURATION

    < / cfquery >

    < cfset intFLEET_CON_ID = #qryGetMAXID.MaxFleetId #/ >

    < name cfquery = "qryAddOperator" datasource = "" #Request.DSN # "result = 'test' >"

    INSERT INTO

    CONFIGURATION

    (FLEET_CON_ID,

    COL2,

    COL3,

    COL4)

    VALUES

    (#intFLEET_CON_ID #,)

    "ADD OPERATOR."

    "#strCode, #

    ("#strName #")

    < / cfquery >

    the qryGETMAXID query always returns the same value as 18703. I inserted a few values in the database directly. the query should return 18705. When I run the same query in SQL Developer, it returns the correct value. I've not cached the query.

    Please help me.

    Thanks in advance

    Dan and Wolfshade,

    Thanks for the problem.

    I found the problem, then that I insert into the database, I didn't do it. He was thus the same value.

    Sorry...

  • Satellite P300-156 - and the button Return give the same values

    Hello

    I have a satellite P300-156, and it has a numeric keypad.
    I have problems because the Enter key and the Return key give the same values. I believe that it is incorrect.
    Can anyone help.

    Key on the numeric keypad should give an input it does.
    the Enter key on the main keyboard should give a carriage return value, but it gives an input value.

    Usually this does not cause a problem, but with software like photo shop that makes the distinction between a carriage return and a hard fall it does not work.

    Can someone help me please

    Thank you

    Hello

    To my eyes the entry and return keys are the same keys that provides the same functionality.
    I really put t know why you believe that there is something not right

    By the way; Check if you are using the latest version of the BIOS!

  • All channels to HAVE it have the same value

    I use the example for a multichannel AI aiex2.cpp read with mseries NI6280 devices.

    This example works for a lane, but other chains have the same value

    For example: I put 5 Volt on the first string, and then the other channel are 5 Volt too.

    What should I consider in the configuration?

    Hello Beilei,

    I think that you run in theghost of the question.  The other strings that you use are connected to the earth when you connect the first channel to 5V?  If the other channels are floating, they will read the same value as the first string... 5V.

    Steven T.

  • my computer broke down and when return to the setting factory. is the same where I can get my old picture when rear, files, etc etc?

    my computer broke down and when return to the setting factory. is the same where I can get my old picture when rear, files, etc etc?

    Hello

    Recuva worked for posters that have been in your same situation here

    a clean install wipes the hard drive clean of everything

    You cannot undo what you've done

    If you have lost data, you can try this

    http://www.Piriform.com/Recuva

    Read also:

    Since we don't know exactly how you reinstalled it seek a windows.old folder

    How to restore your personal files after you perform a custom Windows Vista or Windows 7 installation

    http://support.Microsoft.com/kb/932912

    or even return to a previous operating system by using the information in file window.old at the link below

    http://support.Microsoft.com/kb/933168

    If the above does not work:

    Try the data recovery experts

    but they are very expensive

  • my wireless connection says "restricted access" no network connection. I used the same key code to get my other computer online

    my wireless connection says "restricted access" no network connection, I used the same key code to get my other computer I can have up to 5 computers online at the same time online.

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hello

    This means that the computer cannot connect to the router.

    Try this process.

    Check the Device Manager for the wireless card valid entry.

    http://www.ezlan.NET/Win7/net_dm.jpg

    If there is no valid entry, remove any entry from fake and re - install the drivers for the wireless card.

    Check network connections to make sure that you have a network icon/entry wireless connection, and that the properties of the icon (right-click on the icon) are correctly configured with the TCP/IPv4 protocol in the properties of network connections.

    http://www.ezlan.NET/Win7/net_connection_tcp.jpg

    Make sure that if there is Wireless Utility a utility vendor is not running with the native Windows wireless utility.

    Make sure you firewall No. preventing / blocks wireless components to join the network.

    Stack TCP/IP work should look like.

    Right-click on the wireless network connection card, select status, details and see if she got an IP address and the rest of the settings.

    http://www.ezlan.NET/Win7/status-NIC.jpg

    Description is the data of the card making.

    The physical address is MAC of the card number.

    The xx must be a number between 0 and 255 (all xx even number).

    YY should be between 0 and 255

    ZZ should be between 0 and 255 (zz all the same number.)

    The date of the lease must be valid at the present time.

    * Note 1. IP that starts with 169.xxx.xxx.xxx isn't valid functional IP.

    * Note 2. There could be an IPv6 entries too. However, they are not functional for Internet or LAN traffic. They are necessary for Win 7 homegroup special configuration.

    ---------------------------------------------------

    Above everything is OK, you must be able to connect to the router.  A window that says connected does not mean that you are really connected. Connection to the router means that you can enter the IP of the router base in an address bar in one go, being able to connect and configure the router menus see. If it is not connected in the log to router from any computer that can connect to the router wirelessly with a wire, disable wireless security, (make sure that the wireless SSID broadcast) is on and try to connect with no. wireless security.

    --------------------------------------------------

    I really checked and configured every thing and it doesn't work.

    Software firewall application that is not configured to allow local traffic (between the computer and the router is also a possible problem.
    some 3rd party software firewall continue to block the same aspects it traffic Local, they are turned Off (disabled). If possible, configure the firewall correctly or completely uninstall to allow a clean flow of local network traffic. If the 3rd party software is uninstalled, or disables, make sure Windows native firewall is active .

    Jack-MVP Windows Networking. WWW.EZLAN.NET

  • User header imported successfully, Impdp import the same user has: b getting object exists error

    Hello

    My scenario

    In our database of prod, we have user A that I recently imported A user in the Test database

    Now I need to import user A user B in the same Test database but get error object exists

    ORA-39151: Table "A.Table_Name" exists

    ORA-31684: Procedure 'A.Proc_Name' exists

    My impdp syntax is the following:

    Impdp USERID =------"/ ACE sysdba\ ' DIRECTORY = DATA_PUMP_DIR DUMPFILE = A.dmp EXCLUDE = USER LOGFILE = A_TO_B_imp.log

    REMAP_SCHEMA = A: B

    REMAP_TABLESPACE = USERS: B

    I thought that this was caused by the fact that the two user B in the database Test with same Tablespace by default, so I created a different tablespace for user B and provided remap tablespace parameter but still getting the same error.

    Please notify.

    Hello

    Seems for some reason any your part of remap_schema is not recognized.

    In the beginning of the impdp log, you should see the command it uses,

    Can you confirm the exact order impdp journal tries to run.

    Also run the impdp since the user of the system.

  • Photos with the same values of position...

    I have a picture with the edited/customized position values (scale, rotation, inclination, perspective, disort, warp)... I have some photos that will be on the different layers and I want that they have the same values as the first (it's stupid to do the same thing with 10 photos...) I tried to duplicate the layers and replacement is contained, but values are lost, so the photos appear in the normal position...

    So how can guys, I do this?

    For this to work properly, all images must be of the same size and resolution.

    1. Integrate the file of the first image.
    2. Layer > Smart object > convert to smart object
    3. Edit > free transform and establish the size, position and orientation... .OK
    4. Cmd + J to create a layer of dupe
    5. Layer > Smart Object > replace content
    6. Choose the following image > replace

    Repeat steps 4-6

  • GL CCID have the same values for Segment

    Is it possible that two different code_combination_id in the same GL_Code_Combination table has the same values for segment.
    It is, when I run the accounts payable balance report trial of the responsibility of the PA, its follow-up of the transactions ID associated with only 1 and not both.
    But, here, for the same Chart_of_Accounts_Id, we can see that there are two Code_combination_id entries, with the same values for segment.
    Can you please let me know if this is possible?

    For example: I'm running the following queries and Segment1, Segment2, Segment3, Segment4, 12855 CCId values Segment5 is the same as Segment1, Segment2, Segment5, Segment4, Segment3 to 13402.

    Select CODE_COMBINATION_ID, CHART_OF_ACCOUNTS_ID,
    SEGMENT1, SEGMENT2 SEGMENT3, SEGMENT4, ENABLED_FLAG, SEGMENT5,
    * of the GL_CODE_COMBINATIONS where CODE_COMBINATION_ID = 12855

    Select CODE_COMBINATION_ID, CHART_OF_ACCOUNTS_ID,
    SEGMENT1, SEGMENT2 SEGMENT3, SEGMENT4, ENABLED_FLAG, SEGMENT5,
    * of the GL_CODE_COMBINATIONS where CODE_COMBINATION_ID = 13402

    CCID - Segment1, Segment2, Segment3, Segment4, Segment5
    -----------------------------------------------------------------------------------------------
    12855 01 000 2220 00000 000
    13402 01 000 2220 00000 000

    I hope you understand.
    Thank you
    Bob

    Hi Bob,

    Can you please check the id of chart of accounts for the two combinations...

    Concerning
    Muthu

    Published by: Muthu on April 30, 2013 02:10

Maybe you are looking for

  • 2d22dx HP 2000: 8gig memory max

    I wonder if it is due to the age and support both if this laptop is not expandable to 8 GB. It has two memory slots in there so why would not be expandable to 16 GB with 8 gig of memory? Or am I maxed out already at the 8 GB I have on it now and is e

  • FPGA loop is not executing

    This seems to be my weekend for stupid problems. Here's another. I built this loop to run on an FPGA. For some reason, it won't work. You can see an obvious reason for that?

  • laser jet pro MFPM177fw color: randomly powers off the power, then press

    My printer is only 18 months old, but since shortly after that I got it, he started putting off and then again when scanning.  The document would be almost finished sweeping and the printer turn itself then again and I have to start the analysis. It

  • How can I access my windows live Messenger

    How can I access my windows live messengers

  • BlackBerry DM 6.1 smartphones does not import encrypted voice Notes

    Bold 9650 v5.0.0.699 Sprint BlackBerry Desktop 6.10_b034_multilingual The new Desktop Manager 6.1 will be important encrypted photos and videos, but not the voice Notes. Everything recorded by the camera, video camera, and Microphone on the media car