Can we run this statement

Can we use this SQL statement and create a sum
select WHSE_DBA.FLIGHT_ACTIVITY.rental_cost,
WHSE_DBA.FUEL_PURCHASE.actual_cost,
WHSE_DBA.FUEL_PURCHASE.unit_cost,
WHSE_DBA.FUEL_PURCHASE.total_cost,
sum(WHSE_DBA.FLIGHT_ACTIVITY.rental_cost+
WHSE_DBA.FUEL_PURCHASE.actual_cost+
WHSE_DBA.FUEL_PURCHASE.unit_cost+
WHSE_DBA.FUEL_PURCHASE.total_cost) as Total_Cost from
WHSE_DBA.FLIGHT_ACTIVITY,
WHSE_DBA.FUEL_PURCHASE
where WHSE_DBA.FLIGHT_ACTIVITY.SRC_CONTROL_NO=WHSE_DBA.FUEL_PURCHASE.SRC_CONTROL_NO
group by
rental_cost,actual_cost,unit_cost,total_cost

Hi,
As Rkhtsen said, one of the columns you're trying to SUM is a VARCHAR2 or other string. If that's the case, and the column is supposed to contain the string representation of a number (a very bad idea because it causes this problem), then you have to figure out what the bad data is, and clean it up.
This function can help.
CREATE OR REPLACE FUNCTION  to_num
    in_num_text  IN  VARCHAR2,
    in_fmt_text  IN  VARCHAR2
                     DEFAULT NULL
RETURN  NUMBER
--  **  t o _ n u m  **
--  to_num returns the value of in_num_text if it is a number in
--    the format specified by in_fmt_text, NULL if it is not.
--  If in_fmt_text is omitted, to_num will return a number if
--    in_num_text is a number in ANY usual format, e.g. '5', '+5',
--    '5.00', '.5e1' all return 5.
IS
BEGIN
    IF  in_fmt_text  IS NULL
    THEN
        RETURN  TO_NUMBER ( in_num_text );
    ELSE
        RETURN  TO_NUMBER ( in_num_text
                          , in_fmt_text
    END IF;
EXCEPTION
    WHEN OTHERS
    THEN
        RETURN  NULL;
END   to_num;
/For example, say that you learn that flight_activity.rental_cost is a VARCHAR2 column. The following query will show all the values from that table that are not valid numbers:
SELECT  rental_cost
FROM    flight_activity
WHERE   rental_cost         IS NOT NULL
  AND   to_num (rental_cost) IS NULL;If this query produces any rows, that's what's causing the problem. (The same problem may exist in other tables, too.) Either fix the rows shown, or, if it's legitimate to ignore them, use to_num (rental_cost) instead of rental_cost in your SUM.

Similar Messages

  • How can i run this query in BI Answers

    Hi,
    pls tell me how can i run this sql statement in BI Answers....???
    select abc_date,abc_asset_desc,sum(nvl(abc_market_val_lcy,0)+nvl(abc_accr_lcy,0)) "total balance" from abc
    group by abc_date,abc_asset_desc;any help would be appriciated.... :-)
    Regards

    Strange question this one.
    normally with Answers you pick the columns you want to report on and the BI server will construct the SQL for you.
    In this example you would need a star with the abc dimension logical table and a logical fact for abc (these can be in the same table), which has a calculated field for 'Total Balance'.
    You then pick the columns you require and Answer and the BI will automatically add the group by.
    Adrian
    Majendi

  • I have an old file that was made by macromedia flash,but I can't run this file in my Windows 7 64-bit ,while I can run it in Windows XP 32-bit

    I have an old file that was made by macromedia flash,but I can't run this file in my Windows 7 64-bit ,while I can run it in Windows XP 32-bit

    Hi momi macrom,
    Have moved your post to the Flash forum. Experts here are better placed to help you.
    Thanks,
    Preran

  • How  can i run this code correctly?

    hello, everybody:
        when  i run the code, i found that it dons't work,so ,i  hope somebody can help me!
        the Ball class is this :
        package {
        import flash.display.Sprite;
        [SWF(width = "550", height = "400")]
        public class Ball extends Sprite {
            private var radius:Number;
            private var color:uint;
            private var vx:Number;
            private var vy:Number;
            public function Ball(radius:Number=40, color:uint=0xff9900,
            vx:Number =0, vy:Number =0) {
                this.radius= radius;
                this.color = color;
                this.vx = vx;
                this.vy = vy;
                init();
            private function init():void {
                graphics.beginFill(color);
                graphics.drawCircle(0,0,radius);
                graphics.endFill();
    and the Chain class code is :
    package {
        import flash.display.Sprite;
        import flash.events.Event;
        [SWF(width = "550", height = "400")]
        public class Chain extends Sprite {
            private var ball0:Ball;
            private var ball1:Ball;
            private var ball2:Ball;
            private var spring:Number = 0.1;
            private var friction:Number = 0.8;
            private var gravity:Number = 5;
            //private var vx:Number =0;
            //private var vy:Number = 0;
            public function Chain() {
                init();
            public function init():void {
                ball0  = new Ball(20);
                addChild(ball0);
                ball1 = new Ball(20);
                addChild(ball1);
                ball2 = new Ball(20);
                addChild(ball2);
                addEventListener(Event.ENTER_FRAME, onEnterFrame);
            private function onEnterFrame(event:Event):void {
                moveBall(ball0, mouseX, mouseY);
                moveBall(ball1, ball0.x, ball0.y);
                moveBall(ball2, ball1.x, ball1.y);
                graphics.clear();
                graphics.lineStyle(1);
                graphics.moveTo(mouseX, mouseY);
                graphics.lineTo(ball0.x, ball0.y);
                graphics.lineTo(ball1.x, ball1.y);
                graphics.lineTo(ball2.x, ball2.y);
            private function moveBall(ball:Ball,
                                      targetX:Number,
                                      targetY:Number):void {
                ball.vx += (targetX - ball.x) * spring;
                ball.vy += (targetY - ball.y) * spring;
                ball.vy += gravity;
                ball.vx *= friction;
                ball.vy *= friction;
                ball.x += vx;
                ball.y += vy;
    thanks every body's help!

    ok, thanks for your reply ! I run this code in the Flex builder 3!and the Ball class and the Chain class are all in the same AS project!
      and i changed the ball.pv property as public in the Ball class, and  the Chain class has no wrong syntactic analysis,but the AS code don't run.so this is the problem.
    2010-04-21
    Fang
    发件人: Ned Murphy <[email protected]>
    发送时间: 2010-04-20 23:01
    主 题: how  can i run this code correctly?
    收件人: fang alvin <[email protected]>
    I don't see that the Ball class has a pv property, or that you even try to access a pv property in the Chain class.  All of the properties in your Ball class are declared as private, so you probably cannot access them directly.  They would need to be public.  Also, I still don't see where you import Ball in the chain class such that it can use it.

  • I developed app in mac 10.6.8 with xcode 3.2.6.how can i run this app in ipad device

    i developed app in mac 10.6.8 with xcode 3.2.6.how can i run this app in ipad device

    actually i planned to get  provisioning profiles from apple by paying 99$ in following website
    https://developer.apple.com/programs/start/ios/ and followed by
    https://developer.apple.com/programs/start/standard/.
    but in last link,following thing were mentioned at bottom -
    Technical Requirements
    You must have an Intel-based Mac running OS X 10.8 Mountain Lion or later to develop and distribute iOS apps and Mac apps.
    but i\m using mac running OS X 10.6.8 snow leopard.
    Doubt:can't i run my app in ipad device?\
    Thank's in advance..

  • I created an application on a machine with Labview 6.01, can I run this application on another machine that has labview 5?

    In the development center we use Labview 6.01, in the testcenter we use labview 5.
    Additionally, in the development center we use a unix version of Labview and in the testcenter a Windows version.

    You can Save with Option to save VIs as version 5.
    Unless your VIs deal with system files in UNIX or Windows (ie. Registry...)
    then you have to develop your VI specificly on that OS, since UNIX and
    Windows have different ways to deal with system files. Mostly, LabVIEW is OS
    independent. I used to have VIs developed from LabVIEW v.3 on UNIX, I can
    still open these files from LV v.4 on Windows. Now I can still work with
    these VIs on LV 6 on Windows.
    Good luck,
    Nam.
    roybra wrote in message
    news:[email protected]..
    > I created an application on a machine with Labview 6.01, can I run
    > this application on another machine that has labview 5?
    >
    > In the development center we use Labview 6.01, in the testcenter we
    > use l
    abview 5.
    >
    > Additionally, in the development center we use a unix version of
    > Labview and in the testcenter a Windows version.

  • Getting a message that I can't run this app on my PC and to contact the pulisher to get a version that I can run

    getting a message that I can't run this app on my PC and to contact the pulisher to get a version that I can ru

    Which Adobe product?
    Which operating system?

  • How many computers can I run this software on?

    The laptop I am currently using is dying. Can I install this on a new computer?         

    Thanks for your help, but the drop down window you posted is nothing like mine. I am running windows 7, 64 bit. I am calling Adobe support tomorrow. My desktop dies completely and I lost Adobe Pro 9 and CS4 before I could deactivate them. I've read that Adobe will deactivate them for me when this happens. I'll ask about the Elements 10 too when I talk to them.
    My laptop is experiencing the same problems as my desktop was, so I know it is only a matter of time before it's gone too. I have Acrobat pro 10 on it, which I can deactivate. If Adobe deactivates Pro 9 and CS4, they'll go on another desktop, which is my workstation, when I get one . BTW, I tried to take a screen shot of my menu, but Adobe will not allow me to, so I can't show you what I was seeing.
    Again, thanks for everything.

  • Siebdev.exe  - Can I run this in batch mode?

    Just so you are aware, I know nothing about siebel. However, in conjuction with a siebel developer who should know; we are trying to invoke siebdev.exe from a CIB server (jenkins specifically).
    However, running the /batchimport option appears to launch a gui; which I'm fairly sure is causing the app to fail via the jenkins batch job on a windows server (we get an event log application fial)
    Can anyone tell me iif it is posisble to run siebdev.exe silently? or at least so it doesnt fire up the gui?
    Appreciate any help that you can offer.
    Many thanks
    dD

    so, further to this
    I setup a windows schedule job, and that appears to run the job fine.
    However, this runs as my admin account rather than as the service (which doesnt have admin access rights to the machine).....
    Do I need admin rights to run this?
    dD

  • I can't run this example in flashbuilder4

    hello. i'm newbie so i read some  example flex, but i'm usually meet error. for example this:
    http://share.megaplus.vn/dl.php/2062988. i know it is flex3 file,but in flashbuilder 4 have support trasition automatic flex3 to flashbuilder4
    i can't run it in flashbuilder4 and if i want it run , how do i make?
    please help me. Thanks

    Hi Phuong,
    Have you tried the horizontal scrollbar at the bottom of the sample. If you slide that back and forth, the carousel will spin around. You can also click on any thumbnail in the carousel to spin it to make that the active selection.
    Cheers,
    Maile

  • Enable-MSDSMAutomaticClaim can't run this silently?

    Hi,
    I am trying to run the following command however, it always asks for a confirmation, but I am trying to run this in a script for automated configuration. is there any way i can run this "silently" which will accept the Yes or All confirmation?
    Enable-MSDSMAutomaticClaim –BusType iSCSI
    thanks
    Steve

    Hi,
    This appeared to work when I ran it as a command (both approaches whether it be separate lines or all in one) however, when i ran it as part of a script it still prompted me for an answer. I am therefore rather confused as to why it would work as a command
    but not in a script. You would have thought all commands which require an answer would include a -Confirm parameter but this appears to not have one.
    Steve
    It appears the documentation is a little sloppy.  
    According to this: 
    http://chinnychukwudozie.com/2013/11/11/configuring-multipath-io-with-multiple-iscsi-connections-using-powershell/
    That's actually a function, not a cmdlet.  And it appears they've not provided a parameter for Confirm.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • I can't run this file

    I tried running this file, but keep on getting this one error message.
    import java.util.*;
    import java.io.*;
    * My first print message for CS 170
    * @author (John Vu)
    * @version (September 11, 2009)
    public class PrintMessage
    // Program-wide input and output streams
    private PrintStream cout = System.out;
    private Scanner cin = new Scanner(System.in);
    * These are the actions my program will perform.
    public void run()
    System.out.println(
    "What is the difference between a ' and a \"?" +
    "Or between a \" and a\"?");
    System.out.println(
    "One is what we see when we're typing our program." +
    "The other is what appears on the \"console\".");
    * The standard Java entry point. DON'T MODIFY.
    * @param args the command-line arguments.
    @SuppressWarnings("null")
    public static void main(String...args)
    PrintMessage app;
    app.run(); (this is line 37)
    Exception in thread "main" java.lang.Error: Unresolved compilation problem:
         The local variable app may not have been initialized
         at PrintMessage.main(PrintMessage.java:37)
    can anyone help me?

    You can't use an object until you initialize it. So it's not:
        PrintMessage app;
        app.run(); // (this is line 37)but:
        PrintMessage app = new PrintMessage();
        app.run(); // (this is line 37)Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?
    To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.
    Another way to do this is to manually place the tags into your code by placing the tag [cod&#101;] above your pasted code and the tag [cod&#101;] below your pasted code like so:
    [cod&#101;]
      // your code goes here
      // notice how the top and bottom tags are different
    [/cod&#101;]Welcome to the sun java forums.
    Edited by: Encephalopathic on Sep 12, 2009 1:02 PM

  • Can't run this version of Aperture with Snow Leopord?!?!

    I decided to do a clean install of Snow Leopard on my MacBook Pro. It went fine and I then tried to re-install Aperture. That went fine. However, when I try and run it, I get a message telling me:
    "You can't use this version of the application Aperture with this version of Mac OS X. You have Aperture 2.1"
    I tried re-installing Aperture, but no joy. This obviously can't be the case. Any idea what is going ok?
    Thanks.

    You said you deleted Aperture from the Applications folder. Maybe the Aperture file that's causing the problem didn't get deleted. You could try zapping it with AppZapper.
    download a trial here:
    http://appzapper.com/
    Not sure if there's a SL version.
    But before you do that, look at this thread, and make sure you don't have the same problem.
    http://discussions.apple.com/thread.jspa?threadID=2179417&tstart=0
    Note: that poster was starting from 1.5.6 not 2.1
    DLS

  • How can i shorten this statement?

    ((Details) thecars.get(i)).set_customer_id(0);
    ((Details) thecars.get(i)).set_mileage(miles);
    ((Details) thecars.get(i)).set_hired(false);How can i shorten this?
    Can i do something like:
      with ((Details) thecars.get(i)) {
              .set_mileage(miles);
              .set_id(id);
      }Any ideas?

    Unless that syntax, or something like it, is one of the new features in 5.0 (I don't think it is, but I'm not really up on all of what's in 5), no you can't do that.
    You can do this though: Details details = (Details)theCars.get(i);
    details.setCustomerId(0);
    details.setMileage(miles);
    details.setHired(false); Note that the method and variable naming convention for Java is to use camel case as I did here.
    Also not that if you're doing this inside a loop that's iterating over a list: for (int i = 0 ; i < theList.size(); i++) {
        // your code here
    } then you should use an Iterator instead of get(i)
    for (Iterator iter = list.iterator(); iter.hasNext();) {
        Details details = (Details)iter.next();
        // rest of code
    } Also, if you are on 5.0, then generics and the enhanced for loop can clean up some of that extra typing. See the 5.0 release notes for details.

  • How can I run this java program? Please help.

    I have jmf installed, sunone running , the file may be in the wrong directory.
    It is in some directory nowhere near the java lang dir.
    When I try to compile or build i cant. I'm off on a basic thing.
    here is the code.
    import     javax.sound.midi.InvalidMidiDataException;
    import     javax.sound.midi.MidiDevice;
    import     javax.sound.midi.MidiSystem;
    import     javax.sound.midi.MidiUnavailableException;
    import     javax.sound.midi.Receiver;
    import     javax.sound.midi.MidiMessage;
    import     javax.sound.midi.ShortMessage;
    import     javax.sound.midi.SysexMessage;
    public class MidiNote
         /**     Flag for debugging messages.
              If true, some messages are dumped to the console
              during operation.
         private static boolean          DEBUG = false;
         public static void main(String[] args)
              try {
                   // TODO: make settable via command line
                   int     nChannel = 0;
                   int     nKey = 0;     // MIDI key number
                   int     nVelocity = 0;
                   *     Time between note on and note off event in
                   *     milliseconds. Note that on most systems, the
                   *     best resolution you can expect are 10 ms.
                   int     nDuration = 0;
                   int     nArgumentIndexOffset = 0;
                   String     strDeviceName = null;
                   if (args.length == 4)
                        strDeviceName = args[0];
                        nArgumentIndexOffset = 1;
                   else if (args.length == 3)
                        nArgumentIndexOffset = 0;
                   else
                        printUsageAndExit();
                   nKey = Integer.parseInt(args[0 + nArgumentIndexOffset]);
                   nKey = Math.min(127, Math.max(0, nKey));
                   nVelocity = Integer.parseInt(args[1 + nArgumentIndexOffset]);
                   nVelocity = Math.min(127, Math.max(0, nVelocity));
                   nDuration = Integer.parseInt(args[2 + nArgumentIndexOffset]);
                   nDuration = Math.max(0, nDuration);
                   MidiDevice     outputDevice = null;
                   Receiver     receiver = null;
                   if (strDeviceName != null)
                        MidiDevice.Info     info = getMidiDeviceInfo(strDeviceName, true);
                        if (info == null)
                             out("no device info found for name " + strDeviceName);
                             System.exit(1);
                        try
                             outputDevice = MidiSystem.getMidiDevice(info);
                             outputDevice.open();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                        if (outputDevice == null)
                             out("wasn't able to retrieve MidiDevice");
                             System.exit(1);
                        try
                             receiver = outputDevice.getReceiver();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                   else
                        /*     We retrieve a Receiver for the default
                             MidiDevice.
                        try
                             receiver = MidiSystem.getReceiver();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                   if (receiver == null)
                        out("wasn't able to retrieve Receiver");
                        System.exit(1);
                   /*     Here, we prepare the MIDI messages to send.
                        Obviously, one is for turning the key on and
                        one for turning it off.
                   MidiMessage     onMessage = null;
                   MidiMessage     offMessage = null;
                   try
                        onMessage = new ShortMessage();
                        offMessage = new ShortMessage();
                        ((ShortMessage) onMessage).setMessage(ShortMessage.NOTE_ON, nChannel, nKey, nVelocity);
                        ((ShortMessage) offMessage).setMessage(ShortMessage.NOTE_OFF, nChannel, nKey);
                        /* test for SysEx messages */
                        //byte[] data = { (byte) 0xF0, (byte) 0xF7, (byte) 0x99, 0x40, 0x7F, 0x40, 0x00 };
                        //onMessage = new SysexMessage();
                        //offMessage = new SysexMessage();
                        //onMessage.setMessage(data, data.length);
                        //offMessage = (SysexMessage) onMessage.clone();
                   catch (InvalidMidiDataException e)
                        if (DEBUG) { out(e); }
                   *     Turn the note on
                   receiver.send(onMessage, -1);
                   *     Wait for the specified amount of time
                   *     (the duration of the note).
                   try
                        Thread.sleep(nDuration);
                   catch (InterruptedException e)
                        if (DEBUG) { out(e); }
                   *     Turn the note off.
                   receiver.send(offMessage, -1);
                   *     Clean up.
                   receiver.close();
                   if (outputDevice != null)
                        outputDevice.close();
              } catch (Throwable t) {
                   out(t);
              System.exit(0);
         private static void printUsageAndExit()
              out("MidiNote: usage:");
              out(" java MidiNote [<device name>] <note number> <velocity> <duration>");
              out(" <device name>\toutput to named device");
              out(" -D\tenables debugging output");
              System.exit(1);
         private static void listDevicesAndExit(boolean forInput, boolean forOutput) {
              if (forInput && !forOutput) {
                   out("Available MIDI IN Devices:");
              else if (!forInput && forOutput) {
                   out("Available MIDI OUT Devices:");
              } else {
                   out("Available MIDI Devices:");
              MidiDevice.Info[]     aInfos = MidiSystem.getMidiDeviceInfo();
              for (int i = 0; i < aInfos.length; i++) {
                   try {
                        MidiDevice     device = MidiSystem.getMidiDevice(aInfos);
                        boolean          bAllowsInput = (device.getMaxTransmitters() != 0);
                        boolean          bAllowsOutput = (device.getMaxReceivers() != 0);
                        if ((bAllowsInput && forInput) || (bAllowsOutput && forOutput)) {
                             out(""+i+" "
                                  +(bAllowsInput?"IN ":" ")
                                  +(bAllowsOutput?"OUT ":" ")
                                  +aInfos[i].getName()+", "
                                  +aInfos[i].getVendor()+", "
                                  +aInfos[i].getVersion()+", "
                                  +aInfos[i].getDescription());
                   catch (MidiUnavailableException e) {
                        // device is obviously not available...
              if (aInfos.length == 0) {
                   out("[No devices available]");
              System.exit(0);
    e
         *     This method tries to return a MidiDevice.Info whose name
         *     matches the passed name. If no matching MidiDevice.Info is
         *     found, null is returned.
         *     If forOutput is true, then only output devices are searched,
         *     otherwise only input devices.
         private static MidiDevice.Info getMidiDeviceInfo(String strDeviceName, boolean forOutput) {
              MidiDevice.Info[]     aInfos = MidiSystem.getMidiDeviceInfo();
              for (int i = 0; i < aInfos.length; i++) {
                   if (aInfos[i].getName().equals(strDeviceName)) {
                        try {
                             MidiDevice device = MidiSystem.getMidiDevice(aInfos[i]);
                             boolean     bAllowsInput = (device.getMaxTransmitters() != 0);
                             boolean     bAllowsOutput = (device.getMaxReceivers() != 0);
                             if ((bAllowsOutput && forOutput) || (bAllowsInput && !forOutput)) {
                                  return aInfos[i];
                        } catch (MidiUnavailableException mue) {}
              return null;
         private static void out(String strMessage)
              System.out.println(strMessage);
         private static void out(Throwable t)
              t.printStackTrace();

    Please post your code using code tags.
    When I try to compile or build i cant.What is your question? Exactly what error message do you get?

Maybe you are looking for

  • E7 restarts seem to be caused by T-Mobile/Orange r...

    So, I got my Blue E7 from Nokia Direct on Friday last week, on a T-Mobile contract.  As I got it set up as I liked I noticed that the phone would occasionally restart itself.  Initially I put this down to trying to do too much all at the same time, b

  • Getting "Additions to this Web site have been blocked" error

    Hi Everyone While updating item in one of our large document library we are facing below mentioned error: Additions to this Web site have been blocked. Below is details of error. Appreciate to get solution on this. Pl. note this error we are facing o

  • How do you generate Historical Firefighter Logs?

    We have implemented SAP GRC Firefighter 5.1 application and between security issues and other things, the firefighter usage logs had not been generated for each day since inception.  I understand when I click on the "Update Firefighter Log" that the

  • "the application "iphoto" cannot be launched -10828"

    i did nothing previous to this in order for iphoto to be acting up, i have no idea what i may have done. ut this is the window that pops up everytime i try to use the application. i've downloaded the iphoto '09 support but still, nothing. help please

  • Events in Labview RT?

    Are event structures usable in RT?  If not, could you please point me to the documentation that states this or implies this?  Usually when Labview closes a door, they open a window....(provide a workaround). Grub Hell, there are no rules here...we're