error with the case statement use what void const query

Hi all.

I have found the error in the result set, and then use subqueries and cases of declaration.

Preparation for example.

2 examples of tables creation.
CREATE TABLE T1 
AS
(
    SELECT 1 ID , 1 F1 FROM DUAL
    UNION 
    SELECT 2 ID , 1 F1 FROM DUAL
    UNION 
    SELECT 3 ID , 1 F1 FROM DUAL
) ;

CREATE TABLE T2
AS
(    
    SELECT 2 ID FROM DUAL
    UNION 
    SELECT 3 ID FROM DUAL
) ;
 
This statement returns NULL in subquery
SELECT 
T1.ID, TT2.ID , TT2.ISBUG AS NO_BUG 
FROM T1 
LEFT JOIN
(
SELECT ID , -1 ISBUG FROM T2
)TT2
ON T1.ID = TT2.ID
WHERE TT2.ID IS NULL
 
But this statement (with operator CASE) does NOT return null in subquery
SELECT 
 CASE  WHEN 1 = 1 THEN 1 END AS C1,
T1.ID, TT2.ID , TT2.ISBUG 
FROM T1 
LEFT JOIN
(
SELECT ID , -1 ISBUG FROM T2
)TT2
ON T1.ID = TT2.ID
WHERE TT2.ID IS NULL
 
Why?

Oracle 11.2.0.2.0

Published by: 927438 on 13.04.2012 03:27

Published by: 927438 on 13.04.2012 03:31

Maybe it is related to this one

outer join of 11g with case - strange results statement.

seems to be a bug

Tags: Database

Similar Questions

  • Error in the Merge statement using dblink

    Hello

    I am facing the following error when you use the merge statement using the dblink.

    ORA-02069: global_names must be set to true for this operation parameter.

    I can use the same dblink in my select insert and update statements but when I try to use merge then he invites the error said, is also not any syntax error as same statement can be used on the same tables of database instead of dblink.

    Please suggest any help will be much appreciated.

    Thanks in advance

    Hi Aqeel

    If insert and update statements work well through links db, then it should not be a problem with the merge statement. But if you are faced with the question, so please check the entire sql statement with tnsnames on both sides. Please share the tnsnames for the two dbs with dblink ddl.

    Concerning

    Jihane Narain Sylca

  • Defined column ambiguous error with the Merge statement

    Hi guys,.
    I get the ' Error (136,4): PL/SQL: ORA-00918: column ambiguously defined "error with the following query of fusion,
    MERGE INTO Inv_Stk_Trns_Tail a
       USING (SELECT b.*, c.*
       FROM OLR b ,Inv_Stk_Trns_Tail c 
       WHERE b.Trn_Type <> '0'
         AND b.VoucherType IS NOT NULL
         AND b.VoucherType = 'SF'
         AND b.Item_Code = c.Item_Code
         AND c.PROPERTY = 0) src
       ON (a.Sl_No = src.Sl_No and a.Ref_No = src.Ref_No )
       WHEN MATCHED THEN UPDATE SET Item_Avg_Ppr = src.Opn_Avg_Cost,
                                    Rate_Bc = src.Opn_Avg_Cost;
    I tried to solve the problem in a lot of ways, but no use. Please help me solve this problem. If you want more details, I'll give you.
    Thank you
    RAM

    SELECT B.*, c.

    Try all the (necessary) columns on the code and the name of each column a unique alias.

  • call the statement box inside the case statement

    I am writing a program which requires me to run a statement box inside another case statement. Although this sounds like a simple thing, I need to be able to call the case statement using a sequence structure, where s1 sends the true value to the case, s2, a fake. Then I need to record the results of this instruction box in a text file. Attatched is a simplified version of what I'm trying to do. Please note that the way my program runs may not call the case statement without using a sequence structure, two nesting box instructions is not feasible. I hope someone out there can help me because I was stuck trying to find this for awhile.

    Thank you

    LVStudent wrote:

    [...] I can't call the case statement without using a sequence structure

    Yes you can.  You just need to be smart.

    LVStudent wrote:

    I don't think I can use a state machine to fix this.

    I think you probably can.

    With respect to your original post. What are these s1 and s2 are you talking about?  My opinion on the matter, it is that you want to select a case based on the values of several controls Boolean.  If this is correct, I do this:

    Build your Boolean controls in a table, convert the table number and insert it into the structure of your business.  No button pressed = 0, s1 = only 1, s2 = only 2 both = 3.   This works for Boolean values as much as you want and is an easy way to make a decision that depends on many entries.

  • Understand the CASE statement

    I got confused on this CASE

    (1) SELECT BOX WHEN 111 = "111" THEN 'YES' ELSE ' ' END OF THE DOUBLE - YES

    (2) SELECT CASE WHEN COALESCE (111 111) DOESN'T = "111" THEN 'YES' ELSE ' ' END OF THE DOUBLE - YES

    (3) SELECT CASE WHEN COALESCE (111, '111') = '111' THEN 'YES' IS ' ' END OF THE DOUBLE

    ORA-00932: inconsistent data types: expected NUMBER obtained TANK

    What exactly the things happening between 2 & 3. ' nt it implicitly convert as case 2 is because that in case 3, the first value is anyway not null as CAS2... This leads to confusion.

    I have read the Oracle documentation and there is an implicit data type conversion table. It also indicates that can be converted. There is always some confusion raised. Anyone could wrap this confusion?

    No, the function coalesce requires that all entries to be of the same data type because they are arguments of this function.

    Conversion of implicit data type occurs generally when things are compared with operators (as you do in examples 1 and 2.

    There is not many functions/procedures of this nature that the mixed data types and convert them for you.

    So, it is nothing to do with the CASE statements, it's in with him COALESCE function.  It is overloaded for particular data types, but it requires all arguments to be of the same data type.

  • Problem of the CASE statement

    Hi all

    I need to replace the value selected,

    Here's the query... make a mistake... make me ORA-00923: KEYWORD not found or provided.

    Could you please correct me.

    SELECT sper.assettxt =
    CASE
    WHEN (select description of flv fnd_lookup_values where flv.lookup_type = 'ZZCUS_SPER_ASSET_CODES'
    and flv.description = sper.assettxt);
    (select the meaning of flv fnd_lookup_values where flv.lookup_type = 'ZZCUS_SPER_ASSET_CODES'
    and flv.description = sper.assettxt)
    NVL (resp_cat. (Text, 'Total');
    NVL (SUM (DECODE (sper.author_create_ta_interval,' < = 24 h, sper.total, 0)), 0) day1.
    NVL (SUM (DECODE (sper.author_create_ta_interval,' < = 48 but > 24', sper.total, 0)), 0) day2.
    NVL (SUM (DECODE (sper.author_create_ta_interval,' < = 72 but > 48', sper.total, 0)), 0) day 3,.
    NVL (SUM (DECODE (sper.author_create_ta_interval,' > 72 h, sper.total, 0)), 0) day4.
    NVL (SUM (DECODE (sper.author_create_ta_interval, "N/a", sper.total, 0)), 0) 'open ',.
    NVL (SUM (sper.total), 0) "Grand Total".
    (SELECT "point proven" TEXT data)
    OF THE DOUBLE
    UNION
    SELECT "data updated item.
    OF THE DOUBLE
    UNION
    SELECT "other answers.
    Resp_cat FROM DUAL)
    LEFT OUTER JOIN
    (SELECT assettxt,
    s.sper_status_text,
    s.author_create_ta_interval,
    Total COUNT (*)
    OF s zzcus.zzcus_sper_data
    WHERE 1 = 1
    AND s.sper_dates =: P_SR_DATES
    AND s.sper_month = substr(:P_SR_DATES,5,2)
    AND s.customer_id =: P_CUSTOMER_ID
    - AND s.task_inquiry_type AS ' descriptive data Challenge %.
    AND s.assettxt <>'! MAD
    S.assettxt, s.sper_status_text, s.author_create_ta_interval)
    SPER partition by (SPER. ASSETTXT)
    ((CASE
    WHEN sper.sper_status_text = "data confirmed."
    THEN
    "Question confirmed the data.
    WHEN sper.sper_status_text = "updating data"
    THEN
    "Item updated data.
    ON THE OTHER
    "Other answers.
    END) = resp_cat.text)
    GROUP BY ROLLUP (resp_cat.text), sper.assettxt
    ORDER BY sper.assettxt, (CASE resp_cat.text
    WHEN 'confirmed data element' THEN 1
    WHEN 'updated data element' THEN 2
    WHEN "Others" THEN 3
    END)




    I need to replace sper.assettxt with the meaning of fnd_lookup_values table.




    -

    Well, it is interpretation since I'm guessing by your intention with the CASE statement.

    Do you mean

    CASE
    WHEN EXISTS
       (
          SELECT
             description
          FROM
             fnd_lookup_values flv
          WHERE
             flv.lookup_type  ='ZZCUS_SPER_ASSET_CODES'
          AND flv.description =sper.assettxt
       )
       THEN
       (
          SELECT
             meaning
          FROM
             fnd_lookup_values flv
          WHERE
             flv.lookup_type  ='ZZCUS_SPER_ASSET_CODES'
          AND flv.description =sper.assettxt
       )
    END, 
    

    If yes then it is much better represented as

       (
          SELECT
             meaning
          FROM
             fnd_lookup_values flv
          WHERE
             flv.lookup_type  ='ZZCUS_SPER_ASSET_CODES'
          AND flv.description =sper.assettxt
       )
    

    Assuming that the code returns 0 - 1 line (no more and you will get an error).

  • Use the CASE statement in a query of LOV

    Hello

    I wrote a select statement to be used in my list of values query, and it works fine when I run with SQL Developer. But when I put it in the LOV I get the LOV query is invalid error message. Here's the query I use:
    select 
        case when nt.COMMON_NAME is not null then nt.COMMON_NAME || ' (' || nt.TAXON_NAME || ')'
            else nt.TAXON_NAME
        end display_species
       ,case when nt.COMMON_NAME is not null then nt.COMMON_NAME || ' (' || nt.TAXON_NAME || ')'
            else nt.TAXON_NAME
        end return_species
    FROM NBN_TAXON nt
    WHERE lower(nt.INPUT_CATEGORY) = decode(lower(:P312_TAXON_GROUP_ADD), 'fish', 'fishes', lower(:P312_TAXON_GROUP_ADD))     
    order by 1;
    If the CASE statement is the source of the problem?

    Hello

    Try to remove the colon semi at the end.

    See you soon

    Ben

  • 0xC000021A {fatal system error}, the initial session process or the process of the complete system in unexpected ways with the blocking state 0 x 00000000 (0xc0000034 0x001008ac) the system has been halted

    Hello! I got this message from malware (I clicked to delete) in surfing on firefox and after awhile the explorer.exe closes with an error. I try to open the Task Manager and it says explore cannot be found!
    I rebooted and then I got this message "0xC000021A {fatal system error}, the initial session process or the process of the complete system in unexpected ways with the blocking state 0 x 00000000 (0xc0000034 0x001008ac) the system has been halted" and can't get anywhere.
    I can't even go in safe mode, the same error messages appears.

    Hi James,

    You could try the Startup Repair to see if it solves the problem:

    http://Windows.Microsoft.com/en-us/Windows-Vista/startup-repair-frequently-asked-questions

    Chris
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • using members of the cast with the case of the declaration

    Hi guys,.

    can someone guide me how to use a "case _ of" with the members of the cast rather than sprites?

    OK, I see. You can use the case statement and replace the
    Manager executeBranchingMenu for this example.

    ------------------------------------------------------
    on executeBranchingMenu NomMenu, commandName
    commandName case
    ("Item 1, 1"): go to frame "an image tag.
    ("Item 1, 2"): go to frame "a few other image tag.
    -etc.
    cases of termination
    end
    ---------------------------------------------------------

    But there is a solution even more simple that does not require using a case
    Statement at all. Your frame labels just name "Item 1, 1", "Item 1," 2",
    etc and use it. It will save you a lot of unnecessary code.

    ---------------------------------------------
    on executeBranchingMenu NomMenu, commandName
    go frame commandName
    end
    -----------------------------------------------

    Furthermore, nothing new in this example of a film that holds the game
    head back, then you probably want to add code to do this, otherwise, it will be
    jump to the menu. It can be added to the film script.

    --------------------
    on exitFrame
    go part
    end
    -------------------

  • Can I use a hexadecimal string with a case statement?

    Simple question:

    Can I enter a hexadecimal string to a case statement and have the case statement see it as hex?

    I understand that I could convert the hexadecimal string to a number and then enter the hexadecimal number to the case statement but I am curious to know if I could have the case see the string itself as hex without this added feature.

    Would be nice to not have to convert all my numbers throughout my code strings

    Thank you

    -Eric

    How long are the strings? Since you mention convert in numbers, they are probably short and all of same length.

    Are there different possible channels how?

    Case header includes \-codes in the case of a label deal selector As string, so that should be enough for your use. For example this code turns the LED (.. .so that a simple string of "\00\00" of wiring would not be!)

    (See also the last sentence of the "enumerated values" section of the help).

  • locked out of my error of the portable computer, your PC is in offline mode. Please sign in with the last password used on this PC"

    OT: locked out of my laptop.

    Hello, I have an Asus with Windows 8, and last night my friend locked me out of my laptop by pressing on enter far too often. Now I can not connect on my laptop. Whenever I get my password it says "your PC is offline.". Please sign in with the last password used on this PC"and I really need to get inside because I have a great duty that I have to finish and return. I really need help.

    Hello Tiana,

    Thanks for posting your query in Microsoft Community Forum.

    Of course, I understand the feeling of being locked out of computer especially when you have something important lined up.

    In this scenario, you perform Refresh if you have Windows 8 DVD with you.

    How to refresh, reset or restore your PC

    Warning: Apps that you have installed Web sites and DVD will be removed. The applications provided with your PC and applications that you have installed in the Windows store will be resettled. Windows puts a list of apps removed on your desktop after you refresh your PC.

    In case you don't have a disc, you can contact Asus that can help reset the computer to factory settings.

    Contact us - Asus

    Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.

    Thank you.

  • using the case statement


    Hello

    How can I convert a code for the below sql case statement:

    If)

    (length of (tmp_co_orig_val) < = 0 OR tmp_co_orig_val < = 0 OR tmp_co_orig_val == 1 OR tmp_co_orig_val > = 9999999)

    OR

    ((tmp_co_orig_val == 999999 AND (length of (tmp_rcr_orgn_ltv_rt) < = 0 OR tmp_rcr_orgn_ltv_rt < tmp_rcr_orgn_ltv_rt > 1.3 GOLD 0.15)))

    Start

    tmp_collatvalue = «»

    tmp_msg_cd = 115

    end

    Is the case statement below that I wrote is correct. I don't have an environment now to test.  Please advice.

    BOX WHEN (CHAR_LENGTH (tmp_co_orig_val) < = 0 OR tmp_co_orig_val < 0 OR tmp_co_orig_val = 1 OR tmp_co_orig_val = > = 9999999)

    OR (tmp_co_orig_val = 999999 AND (CHAR_LENGTH (tmp_rcr_orgn_ltv_rt) < = 0 OR tmp_rcr_orgn_ltv_rt < tmp_rcr_orgn_ltv_rt > 1.3 GOLD 0.15))

    THEN tmp_collatvalue IS NULL AND tmp_msg_cd = 115

    END

    Hello

    937454 wrote:

    Thanks Frank. Really helps. But I have to write a sql statement

    But can you also specify, if I made a mistake in my code, or it's ok.

    There are no CASES reported in Oracle SQL.

    Oracle SQL has BOX expressions, but they only return a single value.  You cannot set 2 columns in the same expression BOX.

    Perhaps the best thing to do in pure SQL for you is to write a CASE expression, very similar to the CASE statement above, in a subquery and use the results of this in 2 separate expressions of BOX (very simple) in a Super application.

  • Duplicate values are returned by using the case statement

    Hello PL/SQL gurus and experts.

    I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version

    I am currently stuk with problem with the case values in double - displayign

    Once I am using the following query (join of two tables)
    select t.student_nm,
    f.Test_RNK,f.Exam_rnk
    from class_fact f,
    method_dim   t
    where t.method_key = f.class_key 
    AND F.DE='H'
    AND F.Date between '20120101' and '20120631'
    It gives the student name and corresponding test and review

    But if I use it as a query, then it displays a lot of values in double.
    select t.student_nm,
    (case when trim(upper(F.date)) between '20120101' and '20120631' and trim(upper(F.DE)) = 'H' then
                       F.Exam_RNK
                      else
                       0
                    end
                    ) yrrk
     from class_fact f,
    method_dim   t
    where t.method_key = f.class_key 
    I can do stupid mistake but kindly suggest me.

    Thank you

    Why you have removed the bottom two filters in the second query?

    AND F.DE='H'
    AND F.Date between '20120101' and '20120631'
    

    CASE filter your data. USED in your SELECTION list will be only to manipulate these data for the particular column.
    You must keep your filter because it is, if you expect the reords even to return

    Your request must therefore

    select t.student_nm,
    (case when trim(upper(F.date)) between '20120101' and '20120631' and trim(upper(F.DE)) = 'H' then
                       F.Exam_RNK
                      else
                       0
                    end
                    ) yrrk
     from class_fact f,
    method_dim   t
    where t.method_key = f.class_key
    AND F.DE='H'
    AND F.Date between '20120101' and '20120631'
    

    Published by: JAC on October 12, 2012 19:08
    1. is it a running query? You use DATE as column name?
    2. why you store data to date as strings?

  • Password error: your PC is offline. Please sign in with the last password used on this PC.

    I have Windows 8 and you are unable to open a session.  I have reset my password online successfully, but the new password does not work.  The message says: "your computer is offline. Please sign in with the last password used on this computer. "I don't remember last password that I used.   Any ideas?

    Original titile: password is not working on Windows 8

    People it is a very simple and easy solution to this problem! Once you have reset your password from another PC/laptop or any other server for windows 8, you go back to your PC / laptop original where you forgot your password and do the following...

    1. even if you have reset your password, make sure you have an internet connection for this laptop can be wired or WIFI Hotspot even

    2. make sure that connect you using the option under your network settings in the lower left corner of your logg in screen.

    3. Once you are connected then only can type you the new password that you changed.

    NOW, the simple reason for this is that when you have conveniently forgotten your logg in detail on this pc it does not recognize your new password unless it is connected to your online account.

  • When I try to access my account, I get the error message "your PC is offline.". Please sign in with the last password used on this computer".

    Original title: pavilion hp touch smart 15

    whenever I have try & open a session on my HP pavilion TouchSmart 15 PC laptop it says "your PC is offline.". Please sign in with the last password used on this PC "so I did. and it did not work. It's very frustrating because I have school work, which must be complete! Help, please!

    Hello

    Usually this problem is caused if there any changes in the configuration of the keyboard, or due to Internet connection issues. I would like to know some information about this problem, so that we can help you further.

    1. do you have the question started recently?

    2. have you recently changed the password?

    3. have you made changes on the computer before this problem?

    I suggest you to make sure that the caps lock is not activated, if it is enabled, then turn it off and check if that helps.

    If you are still not able to connect to your account using the password, then I suggest you to check the steps mentioned by Cliff_N on December 7, last here:

     
    Please respond with more information on this issue, so that we can better help you.

Maybe you are looking for