Decode the simple function

Gurus,

Please help me with a decoding function.

doknlbc can be null or different bnuinfc in some occasions.

Select dokkeyi, (doknlbc, null, 'no emp_id', bnuinfc) decoding as dok emp_id, bnu
where doknlbc = bnunamc and dokkeyi in (6545,6525);


Result
EMP_ID DOKKEYI
6545 70348

Result, I want to!
EMP_ID DOKKEYI
6545 70348
6525 no emp_id

Thanks for the help!

Try this:

select dokkeyi, decode(doknlbc,null,'no emp_id',bnuinfc) as emp_id
from dok, bnu
where
     ( doknlbc = bnunamc  or
       doknlbc is null
     )
     and dokkeyi in (6545,6525);

Tags: Database

Similar Questions

  • Decode the simple query

    Decode the query
    Simplified version of the query below.

    SELECT
    d.REG,
    d.DP,
    c.CHANNEL
    Of
    CUSTOMER c,.
    ACCOUNT d
    WHERE c.ID = d.ID
    D.REG GROUP, d.DP, c.CHANNEL


    Channel field in the Customer Table contains several store ID (1 Store, tray 2, tray 3, store 4 etc.) - basically, I want to use decode on the channel field so that instead of all the store ID being issued what is fate of the channel are
    Store 1 = "big".
    Store 2 = 'average '.
    Store 3 = "Small".
    All other stores = 'other '.

    Where the decode to insert statement and what should be the format - attempt below
    DECODE (c.CHANNEL, "keep 1, 'Big', ' Store 2', 'Medium', 'Store' 3', small ', 'Other' ') of

    Hello

    This should be what you are looking for:

    SELECT   d.REG,
             d.DP,
             DECODE (c.CHANNEL, 'Store 1','Large', 'Store 2','Medium', 'Store 3','Small', 'Other') Channel
    FROM     CUSTOMER c,
             ACCOUNT d
    WHERE    c.ID = d.ID
    GROUP BY d.REG,
             d.DP,
             c.CHANNEL
    

    City where to move them in decoding...

  • Decode the help function

    Hello

    I'm new to the development of Oracle.

    MY requirement:

    I need to fill a column "ISMSG" by YES / NO based on the following condition

    When the code = the of ' or 'O'... the 'ISMSG' column should display any other YES no.

    That is, output should be like

    CODE ISMSG

    A NO
    S YES
    S YES
    O YES

    My code for the Decode function:

    CASE
    WHEN s = c.code ' THEN decode (c.code, the of ',' YES, 'NO')
    WHEN c.code = 'o' THEN decode (c.code, 'O', 'YES', 'NO')
    END ISMSG

    My code is correct? If Yes is the best way to do it?
    If this is not the case, correct the code.

    Is there an effective way to do it?

    Thanks in advance.

    Hello

    You can use CASES or DECODE for this; There is no need to use both.
    With the help of CASE:

    SELECT  c.code
    ,     CASE
             WHEN  c.code  IN  ('S', '0')  THEN  'YES'
                                               ELSE  'NO'
         END     AS ismsg
    FROM    table_x   c;
    

    Using DECODE:

    SELECT  c.code
    ,     DECODE ( c.code
                , 'S'      , 'YES'
                , '0'      , 'YES'
                              'NO'
                )          AS ismsg
    FROM    table_x   c;
    

    I suggest that you forget to DECODE and use always the CASE, at least while you are beginner.

    CASE may do everything they can to DECODE. There is a little bit simple, situations where DECODE is a little shorter than the CASE and therefore a bit clearer, but only a little and, as I said, these are just simple situations, and CASE is clear enough in them.
    DECODE is never much shorter or clearer than the CASE. The reverse is not true: there are many situations where the CASE is much, much shorter and lighter than DECODE.

  • decode the simple question

    I had a table called customer_issue_tab that has a column called 'IS_AUTH '.
    If the value of 'IS_AUTH' is true then I should show the line else I need to check the State of the 'CUST_ORDER_TAB' and if the status = 'released' then display the line.

    How can I put these in a select stmt using a DECODING function

    code example would be ideal

    Thank you

    Parsh

    Published by: [email protected] on July 6, 2009 09:28

    Hello

    The answer to "" How do I... using DECODE? ". is always "do not DECODE." If you have to ask, then it's too complicated.
    CASE is the most common to DECODE alternative.

    If you want to use the results in a WHERE clause, why not use the conditions in a WHERE clause, without DECODING?
    Something like that, maybe:
    {code}
    WHERE is_auth = 'TRUE '.
    THERE ARE (SELECT 1 OR)
    OF cust_order_tab
    Situation WHERE = 'product '.
    AND order_no = customer_issue_tab.order_no
    )
    {code}
    If you need help, post a small example of data and the results desired from these data.

  • Decode the query help

    Hello
    I'm new to the development of Oracle.
    Oracle 10 g 2

    My original query:

    SELECT APP, count (*)
    TRANSACTION
    WHERE TYPE in ('ShipmentConfirmPR', 'ShipmentConfirm', 'ShipConfirm')
    and the APP ("SAPPI", "SAPPI", "SAPR3") and INTERVENE ('9320 ', '9332','1208 ')
    GROUP BY APP TYPE
    order of the APP

    the result of this query:
    SAPPI 100
    SAPPI 600
    SAPR3 440

    My requirement
    And I want to have something like output

    LDCS 100
    TSW 600
    PDC 440

    IE.the APPP and STEP combinations. Must return the specified values
    SAPPI & 9320-> LOC (here SAPPI IE APP is the same for both... but it's a coincidence IE APP can be sliced also)
    SAPPI & 9332-> tsw
    SAPR3 & 1208-> pdc

    Options, I tried:
    Query provided by one of the Forum members...
    SELECT THE CHECK BOX
    WHEN APP = "SAPP1" THEN DECODE (step, '9320', 'LSW', '9332', "TSW")
    WHEN APP = "SAPR3" step = '1208' AND 'PDC '.
    END app
    COUNT (*)
    TRANSACTION
    WHERE TYPE in ('ShipmentConfirmPR', 'ShipmentConfirm', 'ShipConfirm')
    AND THE APP ("SAPPI", "SAPPI", "SAPR3")
    AND STEP IN ('9320', '9332', ' 1208')
    GROUP BY APP, STEP
    ORDER OF THE APP.

    EXECUTION PLAN

    | ID | Operation | Name |
    ------------------------------------------------------------------------
    | 0 | SELECT STATEMENT |
    | 1. GROUP SORT BY |
    | 2. INLIST ITERATOR.
    | 3. TABLE ACCESS BY INDEX ROWID | TRANSACTION |
    | 4. INDEX RANGE SCAN | TRANSACTION_IDX |


    The output of the query (as above) must partially match the following query (a particular combination of CLO)

    SELECT count (1)
    TIBCO. TRANSACTION_HISTORY
    WHERE TYPE = 'ShipmentConfirm '.
    and APP in ("SAPPI") and INTERVENE ('9332')


    My Questions:

    1.*There are indexes on all 3 APP passes it's IE, STEP and TYPE *. I don't want a FULL table Scan (as one would use the index). Can change us the query / use of indices, etc. to make it faster?

    2. is the right to approach? Would the use of the concat operator in the function decode work better for my needs?
    Something like

    Select decode (APP |) STEP, 'SAPP9332', 'X') of TRANSACTION_HISTORY where < COND >

    If Yes can you please provide the query?

    3. ANY other approach / request for my requirement.

    Thanks in advance.

    Hello

    user13517642 wrote:
    ... EXECUTION PLAN

    | ID | Operation | Name |
    ------------------------------------------------------------------------
    | 0 | SELECT STATEMENT |
    | 1. GROUP SORT BY |
    | 2. INLIST ITERATOR.
    | 3. TABLE ACCESS BY INDEX ROWID | TRANSACTION |
    | 4. INDEX RANGE SCAN | TRANSACTION_IDX |

    The output of the query (as above) must partially match the following query (a particular combination of CLO)

    SELECT count (1)
    TIBCO. TRANSACTION_HISTORY
    WHERE TYPE = 'ShipmentConfirm '.
    and APP in ("SAPPI") and INTERVENE ('9332')

    My Questions:

    1.*There are indexes on all 3 APP passes it's IE, STEP and TYPE *. I don't want a FULL table Scan (as one would use the index). Can change us the query / use of indices, etc. to make it faster?

    A full table scan might be the fastest way to get results. Do you have any reason to think that it would be faster to go through the index? How selective are the clues? In other words, what is the percentage of rows in the table correspond to each of the values in the WHERE clause?

    2. is the right to approach?

    It depends on what you're trying to do, which is not at all clear to me.

    Would the use of the concat operator in the function decode work better for my needs?
    Something like

    Select decode (APP |) STEP, 'SAPP9332', 'X') of TRANSACTION_HISTORY where

    If you use this approach, look out for the problem Ab asse crevit . For example, if you have these 4 rows and 2 columns:

    str1     str2
    ----     ----
    (NULL)     FOO
    F     OO
    FO     O
    FOO     (NULL)
    

    There are 4 values of distict of str1 (counting NULL) and 4 separate values of str2, str1 but | str2 is the same for each of them. In the above example, it there is no way to know, just by looking at the concatenated string, including str1 and str2 ends begins. Maybe it's not the case for your specific data (for example, if the application is still exactly 5 characters long). otherwise, you may need to add some kind of delimiter, like this

    app || '+' || step
    

    where you know that '+' never occurs in one of these columns.

    3. ANY other approach / request for my requirement.

    CASES, as I mentioned in your previous message:
    Decode the help function
    and as you have used above.

    In this thread, you said "I have to use the decode function. Why? It is a competition of school Etudieeo DECODE is explicitly required? Why you don't want in the best way, what that turns out to be?

    Your WHERE clause:

    AND APP IN ('SAPPI', 'SAPPI', 'SAPR3')
    AND STEP IN ('9320', '9332', '1208')
    

    admits 6 possible combinations of APA and step:

    app     step
    -----     ----
    SAPP1     9320
    SAPP1     9332
    SAPP1     1208
    SAPP3     9320
    SAPP3     9332
    SAPP3     1208
    

    but you are looking for only 3 of these combinations in DECODE it or the expression BOX. (Have 2 copies of 'SAPP1' e list won't do any good, but it does hurt real, either.)
    By the way, is "SAPPI" app with the letter 'I' at the end, or "SAPP1", with the number '1' at the end?

    Published by: Frank Kulash, March 24, 2011 19:44

  • How to use the NVL function in decoding?

    Hi all

    How to use the NVL function in decoding?

    SELECT Decode (Sign (sum (nvl (7), 0)-nvl (sum (5), 0)), - 1, 0, (sum (nvl (7), 0)-nvl (sum (5), 0)) QTY)

    of the double

    Thank you

    You should not do that...

    Greatest (NVL (Sum (Quantity), 0)-NVL (SUM (quantity_received), 0), 0) AS qty_arrival

    will do the same

    HTH

  • Hi, I'm developing a simple mobile app in DW CC 2015 using JQuery Mobile. LIKE I need the list view with description of the product, functionality and image, I would like to connect with database instead of "writing" all the tables in the bearings inside

    Hi, I'm developing a simple mobile app in DW CC 2015 using JQuery Mobile. LIKE I need the list view with description of the product, functionality and image, I would like to connect with database instead of "writing" all the tables in the bearings inside the Jquery page. In the future I would also be able to add, to remove the DB records. Any help, tutorial... Thanks TG

    I would like to connect with the database instead of "writing" all the tables in the bearings inside the Jquery page

    This is usually done with a CMS (content management system). There are commercial products CMS like WordPress, Joomla and perch. You create one or several layouts and then create pages of these page layouts using the CMS. In this way, it is possible to have hundreds of pages, each with unique content, but a page layout that can be managed in a place of sharing.

    CMSs on shelf don't require programming skills. Otherwise, some of us write our own CMS with custom functions, but this requires back-end, as with PHP programming.

  • How to make a simple function on the liberation of a mouse AS3.0?

    so its been a while that I was Flash Professional and I'll have to re - educate myself in almost everything. what I want to do is to create a simple function of the liberation of a mouse click vs what is the command to access freedom I know the click is MouseEvent.CLICK, function, but what is the command to access release on?

    You probably want to use MouseEvent.MOUSE_UP (which is what happens to define the end of a CLICK event)

  • How can I use the BCGTransform function to treat the 16-bit Image?

    Hi ~

    I use LabWindowsCVI8.5 and NI Vision to make the treatment of the Image. When I read the "IMAQ Vision for LabWindowsCVI Reference Manual", I found that the imaqBCGTransform function only supports 8-bit Image, while I do the BCG to turn on 16-bit image. Are there solutions to use the BCGTransform function to deal with the 16-bit Image? Or any other feature that could make the correction Gamma, contrast and brightness on the 16-bit Image?

    Thank you very much!

    because imaqBCGTransform is implemented as a lookup table, we can understand why it is limited to 8-bit images.

    Now let's take a look at the definition of each of this mandate (from the NI Vision Concepts documentation):

    -brightness: a constant added to the components red, green, and blue pixel of color over color, decoding of the process;

    -contrast: a constant multiplication factor applied to the components of the luma and chroma of a pixel of color in color to decoding process.

    -gamma correction: expand high gray-level information in an image while removing information of low level of gray.  (the chapter on lookup tables gives some examples of corrections gamma)

    now that you understand that this transformation is a simple mathematical function, simply calculate the correction for each pixel on your 16-bit images.

    I know not the exact formula used by the imaqBCGTransform function, but you should be able to approach by performing some tests on images 8 bits with the original function... or you can make your own formula... or find one on the net... or you can ask someone at home OR you give the formula...

  • New user trying to create this simple function of Xcode

    I'm a programmer windows trying to learn Xcode / swift.

    How can I get this simple function to work?

    He complains about the pi in the line "access to".

    I hope this is enough information.

    Thank you

    disp_to_acceleration Func (freq: Float, disp: Float)-> {Float

    Let pi = M_PI

    Let accel = disp * 2 * powf (freq * pi, 2.0)

    Back to accel

    }

    Oops error in the post "Let's accel.

  • Where control the summary function in 10.8.5?

    I want applications do not reopen when I restart my machine. I'm running 10.8.5, and when I watched it live, I saw people talking by disabling the Resume function in the General window in system preferences. The problem is my general preferences window is not! It looks like not people of screenshots are displayed. I don't know I'm missing something simple, but: How can ensure me that my various applications don't you open every time that I reboot? I don't mean those in the login items - I have a few utilities in there (like Growl, etc.) and those who are very good.  But what he does now is open to things such as Microsoft Word, Photoshop, etc that are not in my list of Login, but were rather things that I had worked on (but closed!) until I rebooted the machine. Where can I control this behavior in 10.8.5? Here is my general window:

    When you shut down the computer, on the closure of the warning screen, make sure that the box to reopen applications (not exact wording) is not checked.

  • How to get out of the callback function key before it complete the LabwindowsCVI

    Hi all

    In my program I use the command button (called SCAN) to analyze the setting on the serial port. When I press SCAN button callback fuction starts to send command on the series for the scan on the serial port setting. There are 99 order send and read. It takes about 3 minutes. It works very well. Now, I want to stop scanning and exit the callback function that is called by the button SCAN. Now when I press the SCAN button that it completes all 99 recommend and control then come to the interface user. So I'm not able to stop and get out of this loop. Y at - it a why to exit this loop if the user wants to get out? otherwise it will finish the scan.

    -Vishnu

    Hello

    I'll give you 3 options:

    1. If you want to go programaticly you can use simple break when stopping 'event' occur.

    2. If you want to go with a Cancel button, you can use this post:

    http://forums.NI.com/T5/LabWindows-CVI/few-general-CVI-questions-how-the-compiler-works/m-p/1440984

    where I already asked that it is not the recommended option for the panels.

    3. the best option is to use the multi threading separate each button in thread...

  • subtract the error function

    Maybe it's a mistake on my part of basic mathematics, but I'm sure 9 less 2 is 7 and not-2.

    Seriously, someone has come across an instance where the function of subtraction mess up like this (see screenshot)?  I tried to replace the function of subtract several times, and it is impossible that the values are simply by changing so fast that I do not see the true values being passed to the function, because the values are the values of thread retention after that I stopped the program.  If I leave a white VI and just put in the 9-2 it outputs 7, as they are supposed to, is not a problem with the machine.

    I found ways around this problem of course.  For example, if I replace the subtraction function with a composed arithmetic add function and put in a - 2 for the constant it works correctly.  (Note: replace the simple add function and using a constant - 2 does not .)  Also, if I convert the value of the variable (represented by #38 probe in the image) to a double representation, instead of the I32 either, that works too.

    In any case, I'm just curious as to if I am the only one affected by this bug, or maybe someone knows why this bug occurs?

    It is possible that you have found a bug in the behavior of the system of values keep.  Since LV 2010 had some changes in the way the code is compiled, it is possible that it was introduced it there.  If you have the means, try to run your VI in 2009 of LV and see if it has the same behavior with the values to keep power on and off.

    If a person of NEITHER sees what wire and jump in, they can request a copy of your code that you could send their private for them to try and understand what is happening.

  • Continuity of the functions of the basic function generator

    I would use the basic function generator to create a continuous waveform.

    im not sure if Im not run or use the function generator correctly.

    for each iternation of the while loop, I would like to only one point of the exit sinusoid.

    Then the next iternation would produce the next point in the sinwave.

    It seems to keep missing a few points

    I'm not sure why - this.

    It's hard to notice that if the plot is made only show few places for each sampling point.

    I'm fairly certain that that VI uses the current timestamp as the value of x, so whenever your computer receives a bit busy (I'm off / 0, etc.) it is likely to be a small problem.  You can always use the simple sinus with the number of the iteration (optimized for the desired period).

  • Continuity of the functions of the basic function generator and the right time

    I need to create a sine wave, point by point, which will be forwarded to the MIP and finally to a channel of analog output on a PCI-6014

    Ive tried a few different ways to do it, but everyone has some problems with her slider.

    with the 'generator.vi of the base feature.

    and also the "sine waveform.vi.

    There seems to be problems with this lack of points.

    someone helpfully pointed, its very likely windows interrupts the origin of the problem

    Here is a schematic representation of the panels front and rear

    the back panel

    the façade has a few points that are missing

    Another way to do that seems to work better known that the signal "simulate" express vi.

    It's great because it's actually a way of sine 1htz occur at 1htz.

    There are also all the points.

    The problem is that as soon as I put in my request, she grinds to stop.

    Program speed about changes 10khtz less than 1htz when the basic function generator is replaced with this express vi.

    A third idea or concept that has been proposed is to put a programmer to slow the timetable.

    It is once again, works fine, no more points are missed in the plot.

    Yet, he kills again the speed of execution of the program as everything can wait 1ms (or the recripocal of sampling points interval time).

    Someone at - it an idea on how I can get a sine wave in PID, then, in the analog waveform without a huge amount of the efficiency of the program. Im sure this is simple.

    Nevermind

    accedanta do the 2nd option from the top.

    go just to increase the number of samples for now leave the rest of the fastest of the program

Maybe you are looking for