Can somebody explain this?

This would look better if it were in a fixed width font (viewable at [http://sites.google.com/site/jbo5112/oracle_problem]), but this is a direct copy out of my sqlplus window. I have not altered a single thing with my tables, querries, omitted anything, added anything, or relocated anything. I even made a copy of the table that was giving me problems, renaming some columns, removing other colums, and adding an id field so I wouldn't show important information. I still seem get the same strange problem below.
As far as I can tell, the two sum_1's should match and the two sum_2's should match. However, making a third table didn't show the problem. Am I missing something or has oracle lost its marbles? Please help me, I've wasted many, many long days trying to fix our data, and can't sort out what is right anymore.
SQL> describe my_table_name;
Name Null? Type
ID NUMBER
AOC NUMBER(9)
AOM NUMBER
ATC NUMBER(9)
ATM NUMBER
ROC NUMBER(9)
ROM NUMBER
RTC NUMBER(9)
RTM NUMBER
SQL> select
2 sum(aoc+roc + atc+rtc) sum_1a,
3 sum(aoc+roc)+sum(atc+rtc) sum_1b,
4 sum(aom+rom + atm+rtm) sum_2a,
5 sum(aom+rom)+sum(atm+rtm) sum_2b
6 from my_table_name;
SUM_1A SUM_1B SUM_2A SUM_2B
1169352 6857438 384755.106 13222465.8
Elapsed: 00:00:01.42
SQL> create table my_table as (select id, aoc col1, aom col2, atc col3, atm col4, roc col5, rom col6, rtc col7, rtm col8 from my_table_name);
Table created.
Elapsed: 00:00:02.01
SQL> select
2 sum(col1+col3 + col5+col7) sum_1a,
3 sum(col1+col3)+sum(col5+col7) sum_1b,
4 sum(col2+col4 + col6+col8) sum_2a,
5 sum(col2+col4)+sum(col6+col8) sum_2b
6 from my_table;
SUM_1A SUM_1B SUM_2A SUM_2B
1169352 1169352 384755.106 384755.106
Elapsed: 00:00:00.93
SQL>

You can just wrap \ tags around the code
As for the NULL values 1+1+null is undefined because null is undefined.  It's only in aggregate functions that Oracle is allowed to discard NULL values and just sum the non-null rows.
Justin
Edited by: Justin Cave on Feb 20, 2009 7:20 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Can somebody explain this store procedure

    Hi there
    can somebody explain me this Oracle store procedure, I am not able to figure it out anything from this SP :(
    CREATE OR REPLACE PROCEDURE MyDummySchema.MyDummyStoreProcedure
    (a_created_by_proc SomethingDummy.CREATED_BY_PROC%TYPE)
    as
    BEGIN
    /* Set up your global variables */
    XYZ_FORMAT.g_s_created_by_proc := a_created_by_proc;
    XYZ_FORMAT.g_d_current_time := sysdate;
    XYZ_GENERATEEODQUEUE.XYZ_GENERATEQUEUE;
    XYZ_PROCESSQUEUE.XYZ_PROCESSTRADES;
    XYZ_SYNC_SOMETHING(a_created_by_proc);
    END MyDummyStoreProcedure;

    Here
    XYZ_FORMAT, XYZ_GENERATEEODQUEUE, XYZ_PROCESSQUEUE
    are package names;
    XYZ_SYNC_SOMETHING is another PL/SQL procedure name; the procedure takes one parameter;
    XYZ_FORMAT.g_s_created_by_proc, XYZ_FORMAT.g_d_current_time are global variables defined in the package XYZ_FORMAT, in package definition part of it;
    XYZ_GENERATEEODQUEUE.XYZ_GENERATEQUEUE,
    XYZ_PROCESSQUEUE.XYZ_PROCESSTRADES are stored procedures w/o parameters definned in packages XYZ_GENERATEEODQUEUE and XYZ_PROCESSQUEUE respectively.
    But only the author [hopefully] knows what is the point of all this stuff :)

  • Can somebody explain this strange method overloading behavior

    Please check the following code out......
    Snippet 1) compiles while Snippet 2) does not. Can someone explain. Thanks in advance for your help.
    Snippet 1)
    public class AQuestion
    public void method(Object o)
    System.out.println("Object Verion");
    public void method(String s)
    System.out.println("String Version");
    public static void main(String args[])
    AQuestion question = new AQuestion();
    question.method(null);
    // second version of this code.....
    Snippet 2)
    public class AQuestion
    public void method(StringBuffer sb)
    System.out.println("StringBuffer Verion");
    public void method(String s)
    System.out.println("String Version");
    public static void main(String args[])
    AQuestion question = new AQuestion();
    question.method(null);

    foo( SuperClass parm ) {}
    foo( SubClass parm ) {}
    Now somewhere in your code you do this:
    SuperClass myVar = new SubClass();
    foo( myVar );Which one do you want the JVM to call? Well, you want
    it to call the more specific one.
    So it calls foo( SubClass ). But if you sayNo, it doesnt. At compile time the compiler cannot know the complete type of myVar. It can only assure that myVar is of the type SuperClass. And it inserts no dynamic type-checking. And therefore it calls foo(SuperClass).
    It also does that if myVar is null (no dynamic type checking).
    SuperClass myVar = null;
    foo( myVar );
    foo(SuperClass) is called !!!
    foo(null);
    foo(SubClass) is called.
    SuperClass myVar = new SubClass();
    foo( myVar );
    SuperClass myVar = new SuperClass();
    foo( myVar );
    Can you cast myVar as an instance of SuperClass?
    yes.
    Can you cast myVar as an instance of SubClass?
    No.
    This is true of null; null can be cast as SuperClass
    or SubClass.
    No I dont think so. because null doesnt provide any method specified in SuperClass. Thus there can't be done a type cast. Null must be treated specially. It simply fits every class type at compile time.
    If the static (known at compile time) type of a parameter is known (not null) then the method with exactly the same parameter type is called or the one with the most specific parameter type in the line of inheritance of the given parameter - independent from the dynamic (known at runtime) type of the given parameter. If the parameter is null and if there is only one "line of inheritance" then null matches the most specific type by definition. If there are more "lines of inheritance" for the parameters then null would match each most specific type, and thus its not clear which method to use.
    I think this has nothin to do with type casts.

  • CNAME vs Domain Forwarding - Can somebody explain this to me?

    Currently I have several domain names and hosted space at GoDaddy. I publish to a folder and upload to GoDaddy. I also have a .Mac account. I'd edit the html so that the GoDaddy site would still have the Apple slide shows, and so forth...
    Now that iWeb '08 has the CNAME functionality, I guess I'll terminate the GoDaddy hosting and use just the .Mac account. I've got quite a mess to undo here...
    Now the questions, how does CNAME differ from domain forwarding & masking? What do I need to tell GoDaddy to make all this happen? I searched their help and the CNAME part was a bit vague.

    I too need an answer to the same question as I have a domain name with another registrar and they say the cname is name specific which web.mac.com certainly is not ??????
    Message was edited by: Paul Murrant for spelling

  • My daughter's stolen iPhone is CCing her eMail.  Can you explain this?

    My daughter had her brand-new (2 days old) iPhone stolen in Baltimore, MD last summer at a concert.  Recently, she has started recieving email  (on a gmail account that must have been entered/configured somehow) from the phone. Since this is Verizon CDMA phone (no removable SIM  - true?)  we believe the thief is using the phone more or less as an iPod Touch - using it on WiFi - they are sending all kinds of email bearing photo attachments and etc. to their family members.... and my daughter is getting a copy of all the messages on her Gmail account.   The thief apparently does not realize  there is a copy of their
    e-mails being forwarded somewhere.
    Can somebody explain what may be going on here  and what was configured  that is causing the phone to now send a copy of every email to a gmail acct?   I can post the header information from one such message if that would be helpful. 
    We got the phone disabled (I thought)  and replaced  soon after the incident - but I would still like to send the police to retreive the stolen phone - just to teach them a lesson.     Any ideas how this might be occurring and/or how I  miight be able to take advantage of the situation?    The header info has the IP address of the sender (presumably a router IP address... we'd have to get that provider to give up who the IP was leased to at that point in time, etc. ) 
    Any ideas on this bizarre  'iPhone back from the dead'  situation ?
    Thanks in advance.

    Did she have the Passcode lock enabled on her iPhone?
    If not, was she accessing her Gmail account with the iPhone's Mail app?
    If she was accessing her Gmail account with the iPhone's Mail app and she did not have the Passcode lock enabled on her iPhone, did she change the password for her Gmail account after her iPhone was stolen?

  • Can somebody explain how dunning & hold are linked toghter

    In the IMG, i can not find out How dunning are linked with academic hold in the student file and can somebody explain how dunning is linked with academic hold.
    I defined hold type in IMG but i can not find out how to link with hold type with dunnng ?.
    regards,
    jin dal

    Dear Song,
    Answers to your queries are given below:
    Sample function module:
    u2022 Is only used as a template for creating the standard function modules to be carried out
    u2022 Defines the interface that is binding for the standard function modules
    u2022 Describes in its documentation what the underlying event can be used for
    Standard function module:
    Name of application-specific standard function module that can be carried out at a given time.
    The standard function module interface corresponds to the sample function module, which it must match exactly.
    Active function module:
    Function module which is to be called for the specified event.
    If you don't want to take printout then use Functional module 340 as Event 0340 is called when all data is read for a dunning notice.
    You can use standard function module FMCA_DUNNING_READ_ITEMS_0340 for this purpose.
    Hope it will solve your query.
    Warm Regards
    Vinod Kumar

  • Can somebody explain how ABC analysis is done ?

    Hi Experts,
                         Can somebody explain how ABC analysis is done . If I use MC40 transaction there I have 4option but I can use either one of those . For second option , Usage value as number we can directly specify cost and accordingly system will classify materials In A, B and C category .
    I have question on 1st 3 rd and 4 th option . How system will classify materials if These option is used .
    Please explain with examples .
    Points will be rewarded .
    Thanks in advance !
    Neal

    Hi Sir ,
                     Thanks again , I would explain what I have understood .
    MC 40 . Option selected is Usage value with value put are 70 , 20 , and 10 .
    Suppose I have 3 mat in plant
                  Stock         Value
    1) X        100 kg      1000   ( for 1 kg from MM)
    2) Y          20 PC      2300 
    3) Z          30  lt      40000
    Now how would system classify these items ? Will it consider price or only consumption /qty ? or both ?
    Please explain with the same figures . Again the 90 days period you said , is it taken automatically ? because on this T code there is no option for entering time period .
    Neal

  • Can somebody explain what the Radix number is in Character

    I am looking for a good way of converting numbers to characters and I was reading up on the Character API, and they are using this term Radix, and I don't understand what that is all about. Can somebody explain what the radix is for?

    Wait a second I tried this code out and this is the output
    System.err.println(Character.digit('a', 10));and i get a -1, which means "not a valid digit in the specified radix.
    Then I tried other combinations like
    System.err.println(Character.digit('a', 11));
    System.err.println(Character.digit('b', 12));
    System.err.println(Character.digit('c', 13));and they all work, and but with only those sequential characters and numbers. So right now I am very confused as to what this radix, or this function serves. Can somebody explain?

  • Can somebody explain to me how I can detect that an internet connection exists (VB)?

    Can somebody explain to me how I can detect that an internet connection exists (VB)?
    Peter Goossens

    There is no reliable way. Better test whether you can go to where you want to go. And be prepared to support proxies, even the complex ones that require authentication. 
    System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable reports your local connectivity regardless of whether one of your connected networks has Internet access.
    Microsoft's Network Awareness API (the one used in control panel\network and sharing center) use a connection test to a web site setup by Microsoft. But your customers could be behind cooperative firewalls that make this test unusable even when Internet
    access is available though other means (e.g. via a local proxy server). If you want to connect to your own web site, then you can skip that and just connect to your web site instead. Even if you were able to connect to Microsoft's web site there is no guarantee
    your web site would be accessible in the same network.
    Visual C++ MVP

  • Can anyone explain this to me, please. It's a static section question.

    Can anyone explain this to me, please. It's a static section question.
    I came across the following style of programming recently and I would like to know what the Static section is actually doing in the class. Thx.
    Here is the code.
    public class ClassA {
         private static Hashtable ClassAList = new Hashtable();
         private ClassB cB;
         private Vector goodLink;
         private Hashtable classCList;
         static
              ClassA cA = new ClassA();
              ClassAList.put("whatever", cA);
         public static ClassA getClassA()
              return (ClassA) ClassAList.get("whatever");

    hi,
    The static section shall be loaded before it's constructor is called. (i.e at the time of loading the class). Therefore making it available for any other objects to call.
    hope this clarifies ur question
    prasanna

  • Can soemone explain this code to me

    can someone explain this code to me
    import javax.swing.*;
    import BreezySwing.*;
    import java.util.Random;
    public class PennyPinch extends GBFrame
         private JButton enterButton;
         private JTextArea outputArea;
         private int[][] board = {{1,1,1,1,1},{1,2,2,2,1},{1,2,3,2,1},{1,2,2,2,1},{1,1,1,1,1}};
         private boolean[][] landing = new boolean[5][5];
         private int total;
         public PennyPinch()
         enterButton = addButton ("Pitch",2,1,1,1);
         outputArea = addTextArea("",4,1,3,4);
         public void pitch()
              Random generator = new Random();          
              int randomRow = generator.nextInt(5);
              int randomColumn = generator.nextInt(5);
              total += board[randomRow][randomColumn];
              landing[randomRow][randomColumn] = true;
         public void buttonClicked (JButton buttonObj)
              pitch();
              displayList(board, outputArea);
         private void displayList(int a[][], JTextArea output)
    output.setText("");
              for (int row = 0; row < 5; row++)
    for (int col = 0; col < 5; col++){
    if(landing[row][col] ==true)
                                  output.append(Format.justify('r',"P", 3) + " ");
                                  if (col == 4)
    output.append("\n");
                             else
                             output.append(Format.justify('r', a[row][col], 3) + " ");
                             if (col == 4)
    output.append("\n");                    }
              output.append("the total is " + total);
         public static void main (String[] args)
    PennyPinch theGUI = new PennyPinch();
    theGUI.setSize (300, 300);
    theGUI.setVisible(true);
    }

    Knowing toilets or studying under George?What kind pervert are you?
    What is written in public toilets o/c!Ah yes I see, I found example questions.
    2:3.4 please complete the following well known saying
    by filling in the blank
    Whilst you are reading what I put
    You are blank on your foot
    2:3.5 Upon seeing the announcement 'Toilet
    tennis' and following the instruction ' please
    see other wall for details' what is the standard
    message on the other wall.2:3.4. is the correct answer 'micturating' ?
    2:3.5. I believe the answer is Ibidem.

  • Can anyone explain this: Numeric or Value Error Line 1

    I have a stored procedure that starts out like so:
    PROCEDURE test_proc(param1 IN VARCHAR2, param2 IN VARCHAR2, param3 OUT
    SYS_REFCURSOR) IS
    v_var varchar2(5);
    BEGIN
    SELECT * FROM. . .
    The procedure tested fine in PL/SQL Developer. When calling from
    ODP.NET like so. . .
    OracleCommand cmd = new OracleCommand("test_proc", <connection>);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("param1", "somevalue");
    cmd.Parameters.Add("param2", "XX");
    cmd.Parameters.Add("param3", OracleDbType.RefCursor,
    ParameterDirection.Output);
    DataSet ds = new DataSet();
    OracleDataAdapter da = new OracleDataAdapter(cmd);
    con.Open();
    da.fill(ds);
    con.Close();
    . . .the procedure executed as expected. If I changed the value of
    param2 to "XXX" or any value three chars long I got the "ORA-06502:
    Numeric or Value Error at Line 1" error.
    After beating my head against the wall for hours, I tried changing the
    size of v_var to 50, and the error disappeared. Mind you, the error
    was being thrown long before v_var was being set further down in the
    proc. Even more interesting is that the possible values of v_var were
    all less than 5 chars wide. Most interesting: the value of p_param2 had nothing whatever to do with v_var.
    Can anyone explain this?

    Hi,
    Is your database 9206 by chance? Re: Error ORA-06502 PL/SQL
    Cheers,
    Greg

  • Can somebody explain to me how java and xml are related?

    Hi guys
    im new to java and xml.Been reading a lot regarding java and don't seem to have a problem with it...
    the problem is the xml part...im doing a simple GUI project using swing(online store) and i have to convert it to xml
    I have absolutely NO IDEA why i must convert my java to xml and have no idea how to do that.I been reading on the net that xml is a exten~ markup language and it is better and useful.
    Can somebody explain to me in layman terms
    1)how is java and xml related in?
    2)why do ppl want to convert java to xml when they can just stick to java
    3)what is actually xml...
    4)Do i need a program to create xml like i need jcreater to create java application
    5)How do we actually convert?is there any links that you guys could tell me?
    thank you
    tomleo

    im new to java and xml.Been reading a lot regarding
    java and don't seem to have a problem with it...Okay.
    the problem is the xml part...im doing a simple GUI
    project using swing(online store) and i have to
    o convert it to xmlYou have to? So presumably somebody in a position of authority told you that?
    I have absolutely NO IDEA why i must convert my java
    to xml and have no idea how to do that.I been reading
    on the net that xml is a exten~ markup language and
    it is better and useful.I have no idea either (besides which, it doesn't make sense). But why ask us? Somebody told you to do that, ask them why.
    Sure, XML is useful. But it isn't a programming language so it can't be used as a substitute for Java.
    Can somebody explain to me in layman terms
    1)how is java and xml related in?They aren't related, except perhaps in that they are both used in computers.
    2)why do ppl want to convert java to xml when they
    can just stick to javaThey don't.
    3)what is actually xml...Start here for numerous definitions:
    http://www.google.ca/search?hl=en&lr=&oi=defmore&q=define:XML
    4)Do i need a program to create xml like i need
    jcreater to create java applicationNo, XML is just text. But then Java code is just text too.
    5)How do we actually convert?is there any links that
    you guys could tell me?You don't convert Java to XML. My guess is that because you don't know much about Java or XML, you have misinterpreted something that somebody told you.

  • Can anyone explain this query.?

    Can anyone explain this query.?
    select nvl(s.p_id,q.p_id),nvl(s.p_type,q.p_type),nvl(s.p_line,q.p_line),
    nvl(s.sales2004,0),nvl(s.sales2005,0),nvl(q.quota2004,0),nvl(q.quota2005,0)
    from sales s
    full outer join quota q on(s.p_id = q.p_id and s.p_type=q.p_type and s.p_line=q.p_line)

    from sales s full outer join quota qTable quota is outer joined to table sales , if there are no matching records in table quota then also the query retuns the sales record with null values for the corresponding quota record columns
    NVL() has been used to handle such cases

  • HT3275 Please can anyone explain this to me

    Please can anyone explain this to me - thank you -
    Time Machine couldn't complete the backup to time capsule - The backup disk image “/Volumes/Data-1/Alyson’s iMac.sparsebundle” is already in use.

    The explanation is a long standing bug in Lion and Mountain Lion, but what you might really be asking is how to fix the problem.
    Pull the power cord from the back of the Time Capsule
    Wait a few minutes
    Plug the power cord back in
    If that does not fix the problem you will need to dig deeper.  See #C12 in Pondini's excellent Time Machine - Troubleshooting.
    http://pondini.org/TM/Troubleshooting.html

Maybe you are looking for

  • Security for Administrator Role in 11.1 and Upgrades

    Our Essbase is still on 6.5 with three applications/DB. I'd like to know: 1. How much efforts to upgrade to 11.1. What are the most time consuming tasks in such upgrade. 2. Can admin role be set up for ONLY one application/db, including user security

  • Calendar week numbers in Yosemite do not show entirely in Year View

    Sorry to say this but I'm actually a bit shocked at Apple's quality control to be posting this bug. Bugs are one thing but this is, in my view, absolutely unacceptable. Calendar Week Numbers are truncated in the Year View. Only the first digit is sho

  • Can you force a link inside a .pdf to open the "linked to" document in a new window?

    When I have a link inside my .pdf document - linking to another .pdf document or to a Word document - how can I force the linked-to document to open in a new window? I have a web site (business internal, so unfortunately I cannot point to it).  My HT

  • How do I add an add on not listed using 3.6 version

    I must use version 3.6 for my job and I must add an application that I have downloaded, however, i see nowhere I can add the the file as an add on. I accidentally downloaded 5.0 version and had the option but don't see the option in ver 3.6

  • IFRS stock valuation

    Hi experts, I am working on the IFRS valuation approach using the ckmlcpavr cockpit. I read the articles but nobody mentioned about external ending inventory valuation. "According to IAS, the lesser of the historical costs and the net realizable valu