query in the statement box

Hello

No presentation below in where clause generated by the reporting tool

11.2.0.3

WHERE

CASE WHEN TRIM (array. COL_flag) = 'C '.

THEN 'Y '.

ON THE OTHER

« N »

END <>'C '.

returns 5 rows where the flag is actually on C

If you TABLE. COL_FLAG <>'C' returns the correct number of lines.

What Miss me?

Thank you

and what I think that you say, it's that your reporting tool only apply conditions for the columns and expressions that are in the WHERE clause. That sounds like a pretty poor reporting tool - but this is probably not something you can change. For later use, maybe you should see if it is possible to select all the columns you need to filter, but hide them from appearing in the output?

But you don't need that here. It is not clear to me from your messages if you try to retrieve rows where col_flag = 'C', or lines where col_flag! = « C ». You can do the first like this:

where

-CASE when table.col_flag = 'C '.

THEN 'Y '.

ON THE OTHER

« N »

END = 'Y '.

and the second like this:

where

-CASE when table.col_flag = 'C '.

THEN 'Y '.

ON THE OTHER

« N »

END = ' don't

Tags: Database

Similar Questions

  • 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.

  • Consolidation of multiple columns by using the statement box

    Hello

    I have 4 columns

    Column_A, Column_B, Column_C, Column_D

    I created Column_E IE

    ALTER Table My_Table
    ADD)
    Column_E varchar2 (100)
    )

    Data in columns A - D are either 'Y', ' no or (null)

    What is necessary is the following: if it is a 'Y' in ONE of the columns A to D then place 'Y' in Column_E place in the case "n" in Column_E. This must be done for all the lines of my_table

    Thank you!!!

    Banner:
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> with test_data as
      2      (
      3      select 'N' a, 'N' b, 'N' c, 'N' d from dual union all
      4      select 'N' a, null b, 'Y' c, 'N' d from dual union all
      5      select null a, 'N' b, 'N' c, null d from dual union all
      6      select 'N' a, 'Y' b, 'N' c, 'N' d from dual union all
      7      select null a, null b, 'N' c, 'Y' d from dual
      8      )
      9  select t.*,
     10      case when instr(a||b||c||d,'Y') > 0 then  'Y' else 'N' end
     11  from test_data t;
    
    A B C D C
    - - - - -
    N N N N N
    N   Y N Y
      N N   N
    N Y N N Y
        N Y Y
    

    Please note that it helps if you provide test data as shown in this example.

  • passing multiple values from the query in the select statement of the procedure

    I am collecting IDS to select education agreement from the date of rental values and then I would pass the result of the query in the statement select to get the result.
    data type for the contract id is of type varchar and date of rental there is more than one id to contract for most of the time. Help, please. Thank you

    CREATE OR REPLACE PROCEDURE abstract_menu (p_letting   IN     VARCHAR2,
                                               p_results      OUT SYS_REFCURSOR)
    IS
       v_contractId   VARCHAR2 (40);
    
    SELECT lcontid
      INTO v_contractId
      FROM letprop
     WHERE datestat IS NOT NULL AND letting = p_letting AND letstat <> 'R';
    
    
    BEGIN
       OPEN p_results FOR
            SELECT DISTINCT
                      SUBSTR (l.letting, 3, 2)
                   || '-'
                   || SUBSTR (l.letting, 5, 2)
                   || '-'
                   || SUBSTR (l.letting, 1, 2)
                      lettingdate,
                   l.lcontid contractid,
                   SUBSTR (q.cprojnum, 1, 10) projectnumber,
                   DECODE (TRIM (MIN (j.route)), NULL, 'N/A', TRIM (MIN (j.route)))
                      routenumber,
                   L.DATESTAT statusdate,
                   L.LETSTAT lettingstatus,
                   (q.cdescr) jobdescription,
                   INITCAP (q.clocat1 || q.clocat2) LOCATION
              FROM vendor v,
                   vendaddr r,
                   letprop l,
                   planhold p,
                   proposal q,
                   project j,
                   propproj k,
                   bidlet bd
             WHERE     v.vendor = r.vendor
                   AND k.contid = q.contid
                   AND k.pcn = j.pcn
                   AND l.lcontid = k.contid
                   AND p.vendor = v.vendor
                   AND l.letting = p.letting
                   AND l.lcontid IN v_contactid  "**************This is where I would like to pass the contract id from the above select statement***********'"
                   AND l.CALL = p.CALL
                   AND r.addrnum = p.billto
                   AND bd.letting = l.letting
          GROUP BY q.cdescr,
                   q.clocat1,
                   q.clocat2,
                   bd.letting,
                   l.letting,
                   l.lcontid,
                   q.cprojnum,
                   L.LETSTAT,
                   L.DATESTAT
          ORDER BY lettingdate;
    
    end;

    user9196150 wrote:
    AND l.lcontid IN v_contactid ' * this is where I would like to pass the id of the select statement above contract * ""»

    CREATE OR REPLACE PROCEDURE abstract_menu (p_letting   IN     VARCHAR2,
                                               p_results      OUT SYS_REFCURSOR)
    IS
    BEGIN
       OPEN p_results FOR
            SELECT DISTINCT
                      SUBSTR (l.letting, 3, 2)
                   || '-'
                   || SUBSTR (l.letting, 5, 2)
                   || '-'
                   || SUBSTR (l.letting, 1, 2)
                      lettingdate,
                   l.lcontid contractid,
                   SUBSTR (q.cprojnum, 1, 10) projectnumber,
                   DECODE (TRIM (MIN (j.route)), NULL, 'N/A', TRIM (MIN (j.route)))
                      routenumber,
                   L.DATESTAT statusdate,
                   L.LETSTAT lettingstatus,
                   (q.cdescr) jobdescription,
                   INITCAP (q.clocat1 || q.clocat2) LOCATION
              FROM vendor v,
                   vendaddr r,
                   letprop l,
                   planhold p,
                   proposal q,
                   project j,
                   propproj k,
                   bidlet bd
             WHERE     v.vendor = r.vendor
                   AND k.contid = q.contid
                   AND k.pcn = j.pcn
                   AND l.lcontid = k.contid
                   AND p.vendor = v.vendor
                   AND l.letting = p.letting
                   AND l.lcontid IN (
                                     SELECT  ll.lcontid
                                       FROM  letprop ll
                                       WHERE ll.datestat IS NOT NULL AND ll.letting = p_letting AND ll.letstat  'R'
                                    )
                   AND l.CALL = p.CALL
                   AND r.addrnum = p.billto
                   AND bd.letting = l.letting
          GROUP BY q.cdescr,
                   q.clocat1,
                   q.clocat2,
                   bd.letting,
                   l.letting,
                   l.lcontid,
                   q.cprojnum,
                   L.LETSTAT,
                   L.DATESTAT
          ORDER BY lettingdate;
    
    end;
    /
    

    SY.

  • How can I reset my R7000 in the State in which I out took it of the box?

    How can I reset my R7000 in the State in which I out took it of the box? Why am I asking? The latest version of the firmware has destroyed the connectivity and performance of my router. I'll have to deal with the devices that can not connect, devices that fall, extremely poor performance, etc. It's just a disaster.

    I've been with Netgear 5-6 years and had to do something last night, I have never had to do before - I had to go back to an earlier version of the firmware. Honestly, very little worked well. The previous version of the software has a few hiccups here and there, but the new version is just a nightmare.

    Now that I have applied even if an earlier version of the firmware, I can still see some of the latest options which were not there before. I have taken note that the firmware was now the prior publication, but the GUI is still the current version.

    Just to give a time frame on my Nexus 5 running 802.11ac, prior to the current version, I could peg 90Mbps +. Since the new version, the best I can do standing right next to the router is 24Mpbs +. Even after the restoration of the previous firmware, the speed is always the same.

    So, I want to return the router to the shape that when I took it out of the box, apply the previous firmware and reset up if necessary. I want to just my router back prior to the most recent release that destroyed. Once again, that the release had a few hiccups, but it was still usable.

    The 30-30-30 reset method works on most routers out there, but not on the R7000...
    The correct way to reset your R7000 at the exit of the State of the box is...

    Download the original version of Netgear R7000 Support HP http://downloadcenter.netgear.com/en/product/R7000(Firmware Version 1.0.0.96)

    Reset and flash back of any Stockfirmware on the original Stockfirmware:

    Power on the router
    Wait a few seconds
    Press Reset for 5-8 seconds max! **
    connect to 192.168.1.1
    Flash the original FW
    now that the router restarts
    Wait a few seconds
    Press Reset for 5-8 seconds max! **

    * After each reboot, the first login on StockFW screen should show something like "refresh the settings or the settings of loading.

    Now, it's as out of the Box.

    Reset and flash back to any DD - WRT FW to Stockfirmware initial:

    Power on the router
    Wait a few seconds
    Telnet to the router
    Run the commands:
    'clear the NVRAM '.
    'reboot '.
    Wait a few seconds
    connect to 192.168.1.1
    Flash the original Stockfirmware through the Administration tab (if the upgrade fails and the site is not available, try another browser such as Firefox, chrome, safari)
    now that the router restarts
    Wait a few seconds
    Press Reset for 5-8 seconds max! **

    * After each reboot, the first login on StockFW screen should show something like "refresh the settings or the settings of loading.

    Now, it's as out of the Box.

    I have reflashed several R7000 to initial Stockfirmware as the last FW with Beamforming was not stable enough after several days/weeks testing... The FW showed massive connection drops after 24 hours and only a reboot of the router fixed it (tested on 3 x R7000)

    The connection has dropped from 1300 to 66-256 after several hours...-. -.

    Now I'm waiting a new FW version with corrections of Wifi of Netgear.

  • XP hangs at startup and the dialog box provides the following: a problem has prevented Windows to check exactly the State of this computer

    I am rebuilding a system that has been attacked by several viruses and had to rebuild XP using the Windows installation disc.  After completing the repair, I was greeted by the XP logon screen and I tried to log in as administrator. The standard screen grass-hill appears followed by a Windows dialog box to activate product indicating "a problem has prevented windows to check exactly the State of this computer.  To keep your copy of windows must be activated with Microsoft. You want to activate Windows now? "If I choose 'No', then Windows drives me back to the login screen.  If I choose "Yes" then Windows does nothing - activation does not occur and XP does not start... the system just hangs.   I also tried to open a session without failure, but he said that I could not activate safe mode and started back me to the login screen.  I am able to get to a command prompt, if I select Mode safe mode with prompt at startup.  FYI, I am able to view the structure of this version XP Directory when I configure the HARD disk as a slave on another system drive.  Any help to resolve this matter will be highly appreciated.

    I have exactly the same problem and after 2 days of searching and trying stuff found on the internet, I have solved this problem.

    At my computer configuration: Windows XP sp3 with IExplorer 8, but had to go back to the repair facility after that some system files have been corrupted, do not know why.
    My repair CD installation was: Windows XP sp2

    In my view, the main problem is that after the installation of repair, the system obtained in conflict of existing versions of IExplorer 7 and 8. IE 7 & 8A prevented the application of activation of MS (OOBE) of working after the installation of repair, the OOBE application silently chrashed and prevented the logon process.

    I couldn't connect even in safe mode, BUT with failure + command prompt, safe mode I managed to log on! So, choose the mode without failure + command promt in the trunk. Then open a session with success. Then close the command prompt and press CTRL + ALT + DEL to Task Manager. In task manager launches the new application "c:" and answer 'No' to the following question, and after an error message you c: drive open and you'll have office. You can close the System Restore Wizard who opened. Then go to c:\windows\ie7\spuninst and run spuninst.exe. Do the same to c:\windows\ie8\spuninst. After you have uninstalled both, restart windows, and after the first issue of activation, you should get the big activation dialog box.

    I have spent a lot more time, because I was told that uninstall IE7 and IE8 is possible to do this via the command prompt. I did, but it has not fixed my problem. Then I tried a thousand other tricks at the same time.

    Please let us now if this helped you.

  • PPR (get the State of the check box)

    Hi all

    I have a requirement in my search page I have a column with the box and the next is the button.

    My requirement is therefore now if the box is checked then button should allow other button should turn off.

    for this, I do partial rendering, but how to capture the State of the check box for the page.

    Please do the necessary help.

    Kind regards

    Sangu

    Hello

    Use the code below to get the value of the checkbox.

    Try

    {

    OAMessageCheckBoxBean cb = (OAMessageCheckBoxBean) webBean.findChildRecurssive ("CheckBoxItemId")

    Test string = cb.getvalue (pageContext) m:System.NET.SocketAddress.ToString ();

    }

    catch (System.Exception e)

    {

    String test = "";

    }

    BR, 906099

  • Save the State of a combo box

    I created a listbox control that has a number of items in there and then I created 'Up' and 'Arrows' to allow the user to move the items in the listbox control to specify the order they want. The problem I have is when I save the document that the State of the list box is not preserved. Here is the code that I used to record allow the user to move the elements upwards or downwards. Please let me know if it is possible to save the State or if I need to find another solution to this requirement.

    Try

    {

    if(ListBox1.selectedIndex>0)

    {

    var selectedItem = ListBox1.items.nodes.item (ListBox1.selectedIndex)

    ListBox1.items.nodes.insert (selectedItem, ListBox1.items.nodes.item(ListBox1.selectedIndex-1))

    }

    } catch (e)

    {

    app.alert(e+'');

    }

    Usually by checking the setting automatically for the "backup script changes to registration form" option in the properties of the form and the default tab.

    Thank you

    Srini

  • Decode the statement inside the box

    Can we use Decode statement inside a CASE statement as below - show

    It gives an error - the better to write with any error

    create or replace
    test run (a varchar2) RETURN VARCHAR2
    is
    m varchar2 (20);
    Start
    m : =
    CASE
    WHEN a (IN)
    '1009 '-(soon obsolete)
    "1010"
    , ' 1019 "
    '1051'
    , "XGP.
    "XSC")
    (SELECT DECODE(v_lef_cd,'NAM','71','GLB','99','01') in the of THE DOUBLE m)
    (-) THEN '01' - UNITED STATES
    WHEN a (IN)
    ' 1069' - South Africa
    , "SAO" - South Africa
    , 'HIS' - South Africa
    ) THEN '26' - South Africa

    ANOTHER NULL
    END;
    return m;
    end;

    Hello

    user575932 wrote:
    Thanks for your reply... I would be happy if my problem is completely resolved

    In the code below in the ELSE part... (When the value NULL is written) I have check for more condition using IF/ELSE or DECODE...

    SQL > l
    1 DECLARE
    v_var1 2 VARCHAR2 (20);
    3 model VARCHAR2 (20): = 'X '.
    4 BEGIN
    v_var1 5: = dummy BOX WHEN ('X', 'y')
    6 THEN CASE model WHEN = 'X' THEN 'HELLO WORLD '.
    7. OTHER SIDE (_ NULL);
    8 DBMS_OUTPUT. Put_line (v_var1);
    9 END;
    10.

    Sorry, it's impossible. You cannot place the executable statements in PL/SQL (as IF...) ELSE or SELECT... INTO) in the middle of the CASE expression.

    You can get some desired using the results
    (1) IF... Else constantly, instead of CASE (this would allow you to do a SELECT... If you really want to use DECODE INTO), or
    (2) nested CASE expressions, as I showed above, or by
    (3) reformulating the expression BOX so it shouldn't be a nested DECODE or CASE, as I showed earlier

  • How to generalize the statement below box?

    I have below logical case that I need to remove the coding hard of the year field based on the ranges of the year below. Perhaps using another function and make more generic?

    insp_dt = Date
    po_id = Varchar2 (5)
    SELECT 
     DISTINCT DECODE(SUBSTR(UPPER(a.PO_ID),1,1),'S','SP','U','SU','F','FA','H','HO')||
        CASE 
      WHEN TO_CHAR (a.insp_dt,'YYYY') < 1999
                THEN '9'
      WHEN TO_CHAR (a.insp_dt,'YYYY') between 1999 and 2008
                THEN '0'
      WHEN TO_CHAR (a.insp_dt,'YYYY') between 2009 and 2018
                THEN '1'
      WHEN TO_CHAR (a.insp_dt,'YYYY') between 2019 and 2028
                THEN '2'
      WHEN TO_CHAR (a.insp_dt,'YYYY') > 2028
                THEN 'x' END ||substr(a.po_id,2,1) AS season_year
     FROM MAP.finished_goods_audit a
    Expected result for season_year is:

    SP06 (SP + 0 + 6 obtained from the instruction box for spring 2006)
    SU10 (SU + 1 + 0 obtained in the instruction box for summer 2010)
    HO99 (HO + 9 + 9 from the instruction box for holiday 1999)

    What picking the third character in the string of the YEAR?

    SUBSTR(TO_CHAR(a.insp_dt,'YYYY'),3,1)
    
  • Gray out or disable the text box

    Hello

    I have a drop-down list called CN_Entry_Initials with options of a "C" or a "N". I also called Part_Number to enter a part number in a text box. I want the text box part number be grayed out or disabled until a "C" or an "N" was chosen out of the CN_Entry_Initials of the menu drop down. I have this operation, except that I can't add it to almost anything. I think it's something to do with the way in which I have if statement for this disabled text box, or do I have to change the touch of a button "submit it". Does anyone know how to fix this? Below is the javascript and the drop down menu code menu and the text of the box as well as to add it or submit button. There are additional stuff in Javascript I have on the page, but I don't need to worry about those things because they do not work properly. I have the code text box disabled in the upper part of the javascript in the verify() function code. Thank you.

    < SCRIPT LANGUAGE = "JavaScript" >

    <!-original: Wayne Nolting ([email protected])->

    <!-this script and many more are available free online to->

    <!-begin

    verify() function

    {

    If (document.getElementById('CN_Entry_Initials').value is 'C'

    || document.getElementById('CN_Entry_Initials').value == "N")

    document.getElementById('Part_Number').disabled = false;

    on the other

    document.getElementById('Part_Number').disabled = true;

    }

    {

    var PartNum = document. AddECNumber.Part_Number.value;

    var regularExpression = new RegExp(/[cC][0-9]/); regular expression to search for a letter C followed by a number

    If (RegularExpression.test (partnum) & & document.) AddECNumber.CN_Entry_Initials.value == "N" & & document. AddECNumber.Validation_Qty.value == "") {//this returns true if the entry passes the regular expression

    Alert ('enter an amount of Validation for this new custom');

    }

    Another yew (document. AddECNumber.CN_Entry_Initials.value == "N" & & document. AddECNumber.P_Drive_Docs_Initials.value == 'i') {//this returns true if the entry passes the regular expression

    Alert ("you cannot select 'i' for the docs to remove for a new game");

    }

    Another yew (document. AddECNumber.CN_Entry_Initials.value == "" & & document. AddECNumber.SW_Model_Only.value == '0') {//this returns true if the entry passes the regular expression

    Alert ("ECO type required - ew Select (N) or (C) Hanger for eco topic');

    }

    Another yew (document. AddECNumber.PNR_BOM_Change_Only.value == '1' & & document. AddECNumber.CN_Entry_Initials.value! = 'C' & & (document). AddECNumber.Release_Status_Initials.value == "U".

    || document. AddECNumber.Release_Status_Initials.value == "N")) {//this returns true if the entry passes the regular expression

    Alert ("ECO type required - select C Hanger for eco section and select N release status if PNR/BOM change only is Yes");

    }

    Another yew (document. AddECNumber.PNR_BOM_Change_Only.value == '1' & & document. AddECNumber.CN_Entry_Initials.value == 'C' & & document. AddECNumber.Release_Status_Initials.value == 'U') {//this returns true if the entry passes the regular expression

    Alert ("ECO type required - select C Hanger for eco section and select N release status if PNR/BOM change only is Yes");

    }

    Another yew (document. AddECNumber.Doc_Changes_Only.value == '1' & & document. AddECNumber.CN_Entry_Initials.value! = 'C') {//this returns true if the entry passes the regular expression

    Alert ("ECO" type required - Select (C) Hanger for eco section Doc changes only being Yes');

    }

    <!-ElseIf (text). AddECNumber.P_Drive_Docs_Initials.value is 'i')

    'Eco_search.cfm' = Self.Location; ->

    on the other

    {

    document. AddECNumber.submit ();

    }

    }

    -> End

    < /script >

    < name cfform = "AddECNumber" action = "add_new_ec_number_action.cfm" method = "post" > "

    < b >

    < class td = "├editer" align = "right" > change or new entry: < table >

    < td >

    < select name = "CN_Entry_Initials" id = "CN_Entry_Initials" onchange = "verify (); ">

    < option value = "" > select < / option >

    <! - FILL the BOX WITH P_Drive_Docs_Initials FIELDS - >

    < CFOUTPUT QUERY = "ShowCNEntryInitials" >

    < option value = "#CN_Entry_Initials #" > #CN_Entry_Initials #.

    < / CFOUTPUT >

    < / select >

    < table >

    < /tr >

    < b >

    < class td = "├editer" align = "right" valign = "middle" > part number: < br > < h6 > (25 characters limit) < / h6 > < table >

    < td > < input type = "text" name = "Part_Number" id = "Part_Number" maxlength = "25" size = "27" disabled = "disabled" > < table >

    < td > < textarea name = cols "Description" = "30" rows = "3" > < / textarea > < table >

    < /tr >

    < input type = "button" value = "Add" onclick = "verify (); ">

    < / cfform >

    Thank you.

    Andy


    Seems that the braces "{" Javascript function are incorrect, the audit function performs only the feature of toggling the Part_Number text box which is the reason why the alert function worked when you added it in here.

    What you can do is to create a separate function which just active / disable the Part_Number text box and add it to the onchange event of the area of selection.

  • query based on a box of test input

    query based on a box of test input

    Hello
    I have this html input box and I want a query based on what I put in the input output box. What should I do now.

    Thank you


    < form id = "form1" name = "form1" method = "post" action = "" >
    < label > enter id < input type = "text" name = "textfield" / >
    < / label >
    < / make >

    I posted this as an example of what can be done, and it should work as written. However, the part 'living dangerously' is because only by using this model, as written would allow someone run a query in your database, including queries DELETE and UPDATE, without restriction. It's actually a simplified form of the one that I developed for one of my applications, as this one did a management condition and State of login, etc that I don't understand, in order to keep things simple. The one I posted is wide open , so use with caution.

    Phil

  • Distinct count in the instruction box

    -------------------------------------------------------------------------------------------------
    SELECT A.P_ID,
    B.P_NAME,
    C.P_DESC,

    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC (ADD_MONTHS (LAST_DAY (SYSDATE),-4) + 1) AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)),-1)
    AND A.M_ID IS NOT NULL
    THEN 1
    0 OTHERWISE
    END) AS COUNT,
    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC (ADD_MONTHS (LAST_DAY (SYSDATE),-4) + 1) AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)),-1)
    AND A.M_ID IS NOT NULL
    THEN COUNT (DISTINCT A.M_ID)
    0 OTHERWISE
    END) AS UNIQUE_COUNT, / * is not possible * /.
    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)), - 1).
    THEN A.AMT_1
    0 OTHERWISE
    END) AS TOTAL_AMT_1,
    SUM (CASE
    WHEN A.DATE BETWEEN TRUNC(SYSDATE,'YEAR') AND ADD_MONTHS (LAST_DAY (TO_DATE (SYSDATE)), - 1).
    THEN A.AMT_2
    0 OTHERWISE
    END) AS TOTAL_AMT_2

    FROM TABLE_A A,.
    TABLE_B B,.
    C TABLE_C


    WHERE A.P_ID = B.P_ID
    AND B.PT_ID = C.PT_ID
    A.P_ID GROUP,
    B.P_NAME,
    C.P_DESC

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

    Hello

    It is a simplified version of my request.
    I'm doing 4 things here,
    1. the County A.M_ID
    2 County has separate .M_ID, is where I have a problem.
    3 and 4. It is just the sum of 2 diff columns.

    Note that the dates for the County and the amt are different and I can't hard-code the.
    Can someone help me step of distinct count?
    This query runs also a bit slow.
    So all suggestions, comments are welcome.
    Note: TABLE_A REB 700 million, TABLE_B 4 million and TABLE_c is located only 500 RECS
    Thank you!

    Advantage of the fact that aggregate functions more ignore nulls, you could do something like:

    SELECT a.p_id, b.p_name, c.p_desc,
           COUNT(CASE WHEN a.date BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(sysdate),-4) + 1) AND
                                          ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) AND
                           a.m_id IS NOT NULL THEN m_id END) AS countall,
           COUNT(DISTINCT CASE WHEN a.date BETWEEN TRUNC(ADD_MONTHS(LAST_DAY(sysdate),-4) + 1) AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) AND
                         a.m_id IS NOT NULL THEN a.m_id END) AS unique_count, /* entirely possible */
           SUM(CASE WHEN a.date BETWEEN TRUNC(sysdate,'YEAR') AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) THEN a.amt_1
                    ELSE 0 END) AS total_amt_1,
           SUM(CASE WHEN A.DATE BETWEEN TRUNC(sysdate,'YEAR') AND
                                        ADD_MONTHS(LAST_DAY(TO_DATE(sysdate)),-1) THEN A.AMT_2
                    ELSE 0 END) AS TOTAL_AMT_2
    FROM table_a a, table_b b, table_c c
    WHERE a.p_id = b.p_id and
          b.pt_id = c.pt_id
    GROUP BY a.p_id, b.p_name, c.p_desc
    

    The two statements inside the COUNTY box return a.m_id or NULL. A simplified test case is:

    SQL> WITH t as (
      2     SELECT 1 m_id, 9 dt FROM dual UNION ALL
      3     SELECT 1 m_id, 6 dt FROM dual UNION ALL
      4     SELECT 2 m_id, 9 dt FROM dual UNION ALL
      5     SELECT 2 m_id, 6 dt FROM dual UNION ALL
      6     SELECT 1 m_id, 5 dt FROM dual UNION ALL
      7     SELECT 2 m_id, 5 dt FROM dual UNION ALL
      8     SELECT null m_id, 9 dt FROM dual)
      9  SELECT count(CASE WHEN dt BETWEEN 6 and 9 THEN m_id end) cid,
     10         count(distinct CASE WHEN dt BETWEEN 6 and 9 THEN m_id end) cdid
     11  FROM t;
    
           CID       CDID
    ---------- ----------
             4          2
    

    I'm not entirely sure that you really need the IS NOT NULL predicate a.m_id in the instructions BOX, but I left it for more security.
    John

  • Alter the State of Session? -Apex form publishes text with null value

    Recently I discovered a problem with our Apex facility in which all selected as source for a text field value will eventually be displayed as a null value in the database.
    We run APEX version 3.2 in an Oracle 10.2.0.4 database using Oracle HTTP Server from 10 g companion disc.

    At first glance, everything seems to work as expected; I created a simple table called "oracle_sr" with 2 columns, as both not null:

    SQL > desc capacity.oracle_sr
    Name Null? Type
    ORACLE_SR_ID NOT NULL NUMBER
    TIMESTAMP NOT NULL DATE

    In APEX, the form wizard has been used to create a form on this table.
    After execution of the pages and you enter a value for the timestamp field, I can create folders without problem.

    The question arises when I choose a source for the timestamp field value.
    All the source options causes the same error (including a static value) so I'll focus on the SQL query to the source as:

    Select sysdate double;

    This should replace the date system in the area of text timestamp when the page is executed.
    As expected, the value appears in the text box, but when I submit the form to create the folder I get the error:

    ORA-01400: cannot insert NULL into ('ABILITY'. "" "" ORACLE_SR '. "" TIMESTAMP")

    I have worked with APEX for quite awhile and have successfully used this technique in many applications but just to begin to see this error in recent days. What's particularly odd about this message is by default postings "not null" created by the form wizard sees timestamp class as having a value. Session state information included below reports a value yet the database is to launch the ORA-01400.

    Someone has a similar problem? I have spent a good amount of time to try looking for this problem but can't seem to find any similar messages.

    I have included the release of my test page, debugging from what I see, it seems to be a value associated with the filed timestamp:

    0.00: a C C E P t: request = "CRΘER."
    0.00: metadata: go look up the definition and application shortcuts
    0.00: NLS: wwv_flow.g_flow_language_derived_from = FLOW_PRIMARY_LANGUAGE: wwv_flow.g_browser_language = en - us
    0.00: alter session set nls_language = "AMERICAN."
    0.00: alter session set nls_territory = 'AMERICA '.
    0.00: NLS: CSV charset = WE8MSWIN1252
    0.00:... "NLS: decimal separator Set =". »
    0.00:... NLS: Set NLS Group separator = ",".
    0.00:... NLS: Date Format Set = "DD-MON-RR.
    0.01:... Setting session time_zone in-06: 00
    0.01: setting NLS_DATE_FORMAT application date format: DD-MON-RR
    0.01:... NLS: Date Format Set = "DD-MON-RR.
    0.01: fetch database session state
    0.01:... Check the owner of the 2303701116904676 session
    0.01: setting NLS_DATE_FORMAT application date format: DD-MON-RR
    0.02:... NLS: Date Format Set = "DD-MON-RR.
    0.02:... Check for expiration of the session:
    0.02:... Metadata: Page Fetch, calculation, process and branch
    0.02: session: extract information from session header
    0.02:... Metadata: Retrieve the attributes of the page for application 109, page 50
    0.02:... Validate page affinity point.
    0.02:... Check off the items hidden_protected.
    0.03:... Check authorization security systems
    0.03: session state: Save elements of form and p_arg_values
    0.03: *... Session state: you save newValue of the object "P50_ORACLE_SR_ID" = "" "escape_on_input ="N"* 0.03: *..." " Session state: you save the object "P50_TIMESTAMP" = newValue ' 26 May 09 "" escape_on_input = "N" * ""»
    0.03:... Session state: Save "P0_CURRENT_PERSONNEL_ID" - registration of same value: "1."
    0.03:... Session state: Save "P0_OFFSET" - registration of same value: "0".
    0.03:... Session state: Save "P0_ACTIVE_WEEK" - registration of same value: "24 May 09".
    0.03: point of treatment: ON_SUBMIT_BEFORE_COMPUTATION
    0.03: branch point: BEFORE_COMPUTATION
    0.03: point of calculation: AFTER_SUBMIT
    0.03: tabs: make the connection for the tab queries
    0.03: branch point: BEFORE_VALIDATION
    0.03: perform validations:
    0.03:... Point Not Null Validation: P50_TIMESTAMP
    0.04: branch point: BEFORE_PROCESSING
    0.04: point of treatment: AFTER_SUBMIT
    0.04:... Process 'PK get': PLSQL (AFTER_SUBMIT) declare function get_pk return varchar2 is begin C1 in (select ORACLE_SR_SEQ.nextval double next_val) loop return c1.next_val; end loop; end; Start: P50_ORACLE_SR_ID: = get_pk; end;
    0.04:... * session state: saved point new value "P50_ORACLE_SR_ID" = "6."
    0.04:... Treat "Line of ORACLE_SR process": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER #:ORACLE_SR:P50_ORACLE_SR_ID:ORACLE_SR_ID | IUD
    0.04: see the error page...
    0.04: execute rollback...

    ORA-01400: cannot insert NULL into ('ABILITY'. "" "" ORACLE_SR '. "" TIMESTAMP")

    Cannot process the row in the ORACLE_SR table.
    Back by demand.

    Any thoughts would be appreciated.

    Thank you

    Justin.

    If you have changed the Source Type of an element of database column to something else, so he cannot participate in the automated line choreography Fetch/automatic line processing (DML). You must leave the Type of Source, as it was and change the default value of the element fill when the ARF process retrieves a null value for the column.

    Scott

  • Problem with variable referencing of presentation (KEY Date) in the instruction box

    Hello

    I'm trying to reference variables of presentation created on a Date column in the instruction box to one of the columns in the query, as shown below:

    -case when '-citation details. "" "Created" between ' @{of} {1999-1-1}' and ' @{until} {2999-1-1} "then"-quote Metrics. " "" end of number of citations.

    I m getting a view displays error message with the following error message:

    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 17001] Oracle error code: 1861, message: ORA-01861: literal does not match the format string to the call of the OIC OCIStmtExecute

    SQL issued: SELECT "-quote Types '." Name of level 2 Saw_0', case when '-citation details. "" Created "between" 01/04/2009 ' and ' 15 / 04/2009 ' then '-quote Metrics ' "." number of citations"end saw_1"(unit) - CATALOGUE of quotes"WHERE"-citation details "". "" Date of creation"BETWEEN timestamp ' 2009-04-01 00:00:00 ' timestamp AND ' 2009-04-15 00:00:00 ' ORDER BY saw_0


    When I created the prompt on the date field, I put the following in the command prompt:
    Cast ("-time".) Day)

    When I apply a filter on the query using these variables, it works fine.

    If anyone has faced this kind of question earlier and have a resolution, please help me.

    Thank you
    Kitenge

    Hello.

    Select the double - A NON-VALIDE MONTHS TO_DATE('1999-1-1','mm/dd/yyyy')

    Try this:

    OLD: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {1999-1-1} ", mm/dd/yyyy)
    NEW: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {01/01/1999} ", mm/dd/yyyy)

    and

    OLD: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {2999-1-1} ", mm/dd/yyyy)
    NEW: EVALUATE ('TO_DATE (%1, %2)', ' @{of} {1, 1, 2999} ", mm/dd/yyyy)

    and if not ok after that, after an error in query SQL of NQQuery.log.

    Kind regards

    Goran Ocko

    http://108obiee.blogspot.com/

Maybe you are looking for

  • HP ProBook s 4530: hard reset and factory reset the same thing?

    Hello I wanted to know if the hard reset and factory reset are the same things? my laptop does not light and I discovered that I can reset hard, but I don't want any of my data on HDD to erase. is this possible? (I stop before so there is no data on

  • HP LaserJet P1102W: Bluetooth capable?

    I have a HP LaserJet P1102W, which is wireless and USB, but I want to use it as a bluetooth printer. The USB will not accept a Bluetooth adapter to use in this way? I thought of doing something like that to plug into the USB port: http://www.Amazon.c

  • Question of the M10 firmware update

    I will try to update my firmware M10.  I read the instructions on the download and installation but am not well if I'm going to lose my current settings of the router during the process. If so, is that what comes easy key?  Sorry, I'm quite ignorant

  • [EC] PowerEdge R905 server leave no

    Buongiorno, HO a server DELL PowerEdge R905 che non parte. Gli alimentatori sono e accesi con led verde, he leads sul front di accensione blinka per 5 secondi e poi sta 40/50 secondi spento ed it e senza any written acceso frontal sul display. Ho tri

  • Extending from CheckboxField

    I have this image selector I use because I'm stuck with 4.6.1 and FilePicker does not make an appearance until 5.0.0. So I extended the CheckboxField class and written methods of painting and the layout with this code protected void paint (Graphics p