Quick NVL question

Hi,
in the SELECT clause expression NVL(<col>,<val>), can <val> be an expression
that includes other columns from the same table as <col>, or even other
tables?
Is the answer to the above question the same if the NVL occurs in the WHERE
clause? (or ON clause in an [ANSI] join?)
Thanks.
Ken Quirici
[email protected]

for example you have a table as
Tablea
Col1 col2
abc xxx
abc xxx
null yyy
null yyy
select nvl(col1,col2) from tablea
abc
abc
yyy
yyy
select nvl(col1,col2) from tablea
where nvl(col1,col2)='yyy'
yyy
yyy

Similar Messages

  • Hi all .hope all is well ..A quick trim question

    Hi all
    Hope all is well ......
    I have a quick trim question I want to remove part of a string and I am finding it difficult to achieve what I need
    I set the this.setTitle(); with this
    String TitleName = "Epod Order For:    " + dlg.ShortFileName() +"    " + "Read Only";
        dlg.ShortFileName();
        this.setTitle(TitleName);
        setFieldsEditable(false);
    [/code]
    Now I what to use a jbutton to remove the read only part of the string. This is what I have so far
    [code]
      void EditjButton_actionPerformed(ActionEvent e) {
        String trim = this.getTitle();
          int stn;
          if ((stn = trim.lastIndexOf(' ')) != -2)
            trim = trim.substring(stn);
        this.setTitle(trim);
    [/code]
    Please can some one show me or tell me what I need to do. I am at a lose                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    there's several solutions:
    // 1 :
    //you do it twice because there's a space between "read" and "only"
    int stn;
    if ((stn = trim.lastIndexOf(' ')) != -1){
        trim = trim.substring(0,stn);
    if ((stn = trim.lastIndexOf(' ')) != -1){
          trim = trim.substring(0,stn);
    //2 :
    //if the string to remove is always "Read Only":
    if ((stn = trim.toUpperCase().lastIndexOf("READ ONLY")) != -1){
       trim = trim.substring(0,stn);
    //3: use StringTokenizer:
    StringTokenizer st=new StringTokenizer(trim," ");
        String result="";
        int count=st.countTokens();
        for(int i=0;i<count-2;i++){
          result+=st.nextToken()+" ";
        trim=result.trim();//remove the last spaceyou may find other solutions too...
    perhaps solution 2 is better, because you can put it in a separate method and remove the string you want to...
    somthing like:
    public String removeEnd(String str, String toRemove){
      int n;
      String result=str;
      if ((n = str.toUpperCase().lastIndexOf(toRemove.toUpperCase())) != -1){
       result= str.substring(0,stn);
      return result;
    }i haven't tried this method , but it may work...

  • Quick script question

    Hi all,
    Could anyone advise me if i can add anything within - header('Location: http://www.mysite.co.uk/thankyou.html'); in the script below so as the page
    re- directs back to the main index page after a few seconds ?
    Thankyou for any help.
    <?php
    $to = '[email protected]';
    $subject = 'Feedback form results';
    // prepare the message body
    $message = '' . $_POST['Name'] . "\n";
    $message .= '' . $_POST['E-mail'] . "\n";
    $message .= '' . $_POST['Phone'] . "\n";
    $message .= '' . $_POST['Message'];
    // send the email
    mail($to, $subject, $message, null, '');
    header('Location: http://www.mysite.co.uk/thankyou.html');
    ?>

    andy7719 wrote:
    Mr powers gave me that script so im rather confused at this point in time
    I don't think I "gave" you that script. I might have corrected a problem with it, but I certainly didn't write the original script.
    What you're using is far from perfect, but to suggest it would lay you open to MySQL injection attacks is ludicrous. For you to be prone to MySQL injection, you would need to be entering the data into a MySQL database, not sending it by email.
    There is a malicious attack known as email header injection, which is a serious problem with many PHP email processing scripts. However, to be prone to email header injection, you would need to use the fourth argument of mail() to insert form data into the email headers. Since your fourth argument is null, that danger doesn't exist.
    One thing that might be worth doing is checking that the email address doesn't contain a lot of illegal characters, because that's a common feature of header injection attacks. This is how I would tidy up your script:
    <?php
    $suspect = '/Content-Type:|Bcc:|Cc:/i';
    // send the message only if the E-mail field looks clean
    if (preg_match($suspect, $_POST['E-mail'])) {
      header('Location: http://www.example.com/sorry.html');
      exit;
    } else {
      $to = '[email protected]';
      $subject = 'Feedback form results';
      // prepare the message body
      $message = 'Name: ' . $_POST['Name'] . "\n";
      $message .= 'E-mail: ' . $_POST['E-mail'] . "\n";
      $message .= 'Phone: ' . $_POST['Phone'] . "\n";
      $message .= 'Message: ' . $_POST['Message'];
      // send the email
      mail($to, $subject, $message);
      header('Location: http://www.example.com/thankyou.html');
      exit;
    ?>
    Create a new page called sorry.html, with a message along the lines of "Sorry, there was an error sending your message". Don't put anything about illegal attacks. Just be neutral.
    By the way, when posting questions here, don't use meaningless subject lines, such as "Quick script question". If you're posting here, it's almost certain to be a question about a script. It doesn't matter whether it's quick. Use the subject line to tell people what it's about.

  • Urgent help with quick translation questions

    Hello,
    I am somewhat new to Java. I have a translation to hand in in a few hours (French to English). Argh! I have questions on how I worded some parts of the translation (and also if I understood it right). Could you, great developers, please take a look and see if what I wrote makes sense? I've put *** around the words I wasn't sure about. If it sounds strange or is just plain wrong, please let know. I also separated two terms with a slash, when I was in doubt of which one was the best.
    Many thanks in advance.
    1) Tips- Always ***derive*** the exceptions java.lang.Exception and java.lang.RuntimeException.
    Since these exceptions have an excessively broad meaning, ***the calling layers will not know how to
    distinguish the message sent from the other exceptions that may also be passed to them.***
    2) The use of the finally block does not require a catch block. Therefore, exceptions may be passed back to the
    calling layers, while effectively freeing resources ***attributed*** locally
    3) TIPS- Declare the order for SQL ***statements/elements*** in the constant declaration section (private static final).
    Although this recommendation slightly hinders reading, it can have a significant impact on performance. In fact, since
    the layers of access to data are ***low level access***, their optimization may be readily felt from the user’s
    perspective.
    4) Use “inlining.”
    Inlining is a technique used by the Java compiler. Whenever possible, during compilation, the compiler
    copies the body of a method in place of its call, rather than executing a ***memory jump to the method***.
    In the example below, the "inline" code will run twice as fast as the ***method call***
    5)tips - ***Reset the references to large objects such as arrays to null.***
    Null in Java represents a reference which has not been ***set/established.*** After using a variable with a
    large size, it must be ***reassigned a null value.*** This allows the garbage collector to quickly ***recycle the
    memory allocated*** for the variable
    6) TIPS Limit the indexed access to arrays.
    Access to an array element is costly in terms of performance because it is necessary to invoke a verification
    that ***the index was not exceeded.***
    7) tips- Avoid the use of the “Double-Checked Locking” mechanism.
    This code does not always work in a multi-threaded environment. The run-time behavior ***even depends on
    compilers.*** Thus, use the following ***singleton implementation:***
    8) Presumably, this implementation is less efficient than the previous one, since it seems to perform ***a prior
    initialization (as opposed to an initialization on demand)***. In fact, at runtime, the initialization block of a
    (static) class is called when the keyword MonSingleton appears, whether there is a call to getInstance() or
    not. However, since ***this is a singleton***, any occurrence of the keyword will be immediately followed by a
    call to getInstance(). ***Prior or on demand initializations*** are therefore equivalent.
    If, however, a more complex initialization must take place during the actual call to getInstance, ***a standard
    synchronization mechanism may be implemented, subsequently:***
    9) Use the min and max values defined in the java.lang package classes that encapsulate the
    primitive numeric types.
    To compare an attribute or variable of primitive type integer or real (byte, short, int, long, float or double) to
    ***an extreme value of this type***, use the predefined constants and not the values themselves.
    Vera

    1) Tips- Always ***derive*** the exceptions java.lang.Exception and java.lang.RuntimeException.***inherit from***
    ***the calling layers will not know how to
    distinguish the message sent from the other exceptions that may also be passed to them.***That's OK.
    while effectively freeing resources ***attributed*** locally***allocated*** locally.
    3) TIPS- Declare the order for SQL ***statements/elements*** in the constant declaration section (private static final).***statements***, but go back to the author. There is no such thing as a 'constant declaration section' in Java.
    Although this recommendation slightly hinders reading, it can have a significant impact on performance. In fact, since
    the layers of access to data are ***low level access***, their optimization may be readily felt from the user’s
    perspective.Again refer to the author. This isn't true. It will make hardly any difference to the performance. It is more important from a style perspective.
    4) Use “inlining.”
    Inlining is a technique used by the Java compiler. Whenever possible, during compilation, the compiler
    copies the body of a method in place of its call, rather than executing a ***memory jump to the method***.
    In the example below, the "inline" code will run twice as fast as the ***method call***Refer to the author. This entire paragraph is completely untrue. There is no such thing as 'inlining' in Java, or rather there is no way to obey the instruction given to 'use it'. The compiler will or won't inline of its own accord, nothing you can do about it.
    5)tips - ***Reset the references to large objects such as arrays to null.***Correct, but refer to the author. This is generally considered bad practice, not good.
    Null in Java represents a reference which has not been ***set/established.******Initialized***
    After using a variable with a
    large size, it must be ***reassigned a null value.*** This allows the garbage collector to quickly ***recycle the
    memory allocated*** for the variableAgain refer author. Correct scoping of variables is a much better solution than this.
    ***the index was not exceeded.******the index was not out of range***
    The run-time behavior ***even depends on compilers.***Probably a correct translation but the statement is incorrect. Refer to the author. It does not depend on the compiler. It depends on the version of the JVM specification that is being adhered to by the implementation.
    Thus, use the following ***singleton implementation:***Correct.
    it seems to perform ***a prior initialization (as opposed to an initialization on demand)***.I would change 'prior' to 'automatic pre-'.
    ***this is a singleton***That's OK.
    ***Prior or on demand initializations***Change 'prior' to 'automatic'.
    ***a standard
    synchronization mechanism may be implemented, subsequently:***I think this is nonsense. I would need to see the entire paragraph.
    ***an extreme value of this type******this type's minimum or maximum values***
    I would say your author is more in need of a technical reviewer than a translator at this stage. There are far too serious technical errors in this short sample for comfort. The text isn't publishable as is.

  • Quick NativeWindow questions.

    Hi,
    Two Quick Questions about native window actions (I am using AIR with HTML and JS):
    1. How do you "refer" to minimize button ? - So, when a user clicks minimize, it should do an action defined in javascript.
    2. How to define click event for System tray icon ? - So I can display something when my system tray icon is double-clicked.
    Thanks.

    1. Add an event listener to the window.nativeWindow object, listening for the NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING  or DISPLAY_STATE_CHANGE events.
    2. Add an event listener to your SystemTrayIcon object. You can listen for click, mouseUp or mouseDown events, but doubleClick events are not dispatched by this object.

  • Quick REGEXP_LIKE Question

    Hi everyone,
    Had a very quick question: so I need to retrieve all records that have values in this format "type:123;target_id:456". Note that the numeric value can be 1-6 digits long for either type or target_id.
    Can someone please help me with the regexp_like-ing this?
    Thank you,
    Edited by: vi2167 on May 27, 2009 2:06 PM
    Edited by: vi2167 on May 27, 2009 2:07 PM

    WHERE REGEXP_LIKE(val,'type:\d{1,6};target_id:\d{1,6}')SY.

  • Nvl question (kind off)

    Hi guys,
    I was wondering if you could help me out please.
    I have a table with a start_date and end_date as well as a temp_start_date and temp_end_date column.
    What I want to do is display the start_date and end_date BUT, if the start_date is null I want to show the temp_start_date and temp_end_date in that column.
    I was thinking I could use nvl or possibly decode to do this?
    The first bit I think is straight forward, I nvl the start_date to the temp_start_date, but im not sure how to proceed from there? I only want to show the temp_end_date if the start_date is null. Any help on this would be greatly appreciated.
    Select nvl(start_date,temp_start_date), end_date
    From my_table
    Thanks

    Hi,
    Use the NVL<b>2</b> function for that
    SELECT     NVL ( start_date
             , temp_start_date
             )          AS s_date
    ,     NVL2 ( start_date
              , end_date
              , temp_end_date
              )             AS e_date
    FROM    table_x
    ;You could use DECODE or CASE to test if start_date is NULL, and, depending on the answer, return either end_date or temp_end_date, but NVL2 was designed specifcally to do that. That is, the NVL2 expression above is equivalent to
    ,     CASE
             WHEN  start_date  IS NOT NULL
             THEN  end_date
             ELSE  temp_end_date
         END             AS e_dateand also
    ,     DECODE ( start_date
                , NULL     , temp_end_date
                           , end_date
                )        AS e_date 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Okay quick easy question for all who have successfully uploaded videos

    hi, this is my first post in the Apple forums!
    my quick question:
    I have Quicktime Pro, and am currently exporting a video to the iPod
    but it is taking an unusually long time...
    is this normal (and by long I mean I'm @ 16% and it has been 5 minutes)
    do I just need to be more patient?
    thanks
    ^_^

    don't say that...
    I successfully uploaded videos to my iPod I just was not doing it right
    my question has been answered already so STOP BRINGING IT UP AGAIN
    also, look... many people just got their iPods today and are kinda anxious to see the video capibilities work on them, so If you do not have anything constructive to say (by calling us n00bs), then I suggest you don't say anything at all
    iPod video, Dell modded Windows XP Windows XP > your macs

  • Quick Easy Question About N580GTX-M2D15D5 Bios

    Hey guys!!
    I just have a real quick and easy (i suppose) question!
    I had bios version KH0, and MSI live update found KH1, i downloaded and flashed successfully (DOS window said please restart and press any key to exit) so i did, restarted my computer, and MSI live update utlity and gpu-z and MSI afterburner are all reporting the same bios version i had with the KH0, version 70.10.17.00.01 & date November 09, 2010
    MSI live update is not picking up the update again, so my question is, how do i know if it flashed correctly since the bios date and version remained the same?
    Thanks !

    Quote
    I had bios version KH0, and MSI live update found KH1, i downloaded and flashed successfully (DOS window said please restart and press any key to exit) so i did, restarted my computer, and MSI live update utlity and gpu-z and MSI afterburner are all reporting the same bios version i had with the KH0, version 70.10.17.00.01 & date November 09, 2010
    Quote
    version 70.10.17.00.01
    that's suppose to be, this is the version of the both bioses
    Quote
    & date November 09, 2010
    this is GPU release date, not BIOS date
    Quote
    MSI live update is not picking up the update again, so my question is, how do i know if it flashed correctly
    Get this: https://forum-en.msi.com/index.php?action=dlattach;topic=147603.0;attach=7931
    extract it somewhere, then run info1 , and look for the last line
    Quote
    since the bios date and version remained the same?
    they are not the same, your looking the wrong stuffs

  • TDMS - Quick winning Question....

    We are reviewing TDMS
    We have  one quick question ....
    After 4 years of Journey & age of landscpae, becuase of  SPDD & SPAU was not handled incidentally during "different" patch upgrades. and we assume there is slight inconsistency of " Repository objects"  " Dictionary Objects"...
    We want to acheive  In short
    We want to build a Development System which should be in synch of  " Repository objects"  " Dictionary Objects"... with out any master & application data with TDMS ?
    Can we acheive this or not ...
    TDMS provides all other luxuries, but we could get a straight confirmation as requirement as above.
    Pl Help
    Regards
    PR

    Hi Sriniwas
    If you are asking this question to make a buying decision about TDMS then i would suggest that you get in touch with your SAP customer engagement manager (account manager) and ask him to present you all the capabilities and functionalities of TDMS.
    Current version of TDMS offer multiple options and functionalities which may be useful for you.
    Now regarding the query that you have asked -
    If I understood you correctly you are looking for a functionality using which you want to create a development system which is a copy of your production system such that only repository gets copied over from production to the development system and all the client dependent application data is filtered. In the end you will have your development system which is in perfect sync as far as repository and DDIC is concerned.
    The above can certainly be achieved using the TDMS Shell process within TDMS. TDMS Shell is also used as a process to prepare your receiver system for TDMS data transfer.
    I hope this info helps
    Pankaj.

  • Quick naming question

    Wasnt sure if its a naming issue or not but Ive never ran into the problem and Im not sure how to describe it....so here goes.
    Question: Is there a way to insert a string into the name of a component name and have java see it as the actual component name. (see that question still sounds incorrect)
    What I mean is......
    you have 10 buttons named oneB, twoB, threeB,......tenB
    I need to either change a whole lot of code and make what I want to be simple, very large and complex or, find a way to....
    "one"B.setLocation(whereverNotImportant);
    or
    (someObject.getString( ) ) + B.setLocation(whereverNotImportant);
    It looks really odd to me. If theres a way to do it, it just saved me a lot of annoyance.....if not well, Im gonna need more energy drinks.

    Paul5000 wrote:
    Fair enough. I kept adding features onto the code and it grew into needing something different. Was just hoping there was a quick workaround so I didnt have to go back and recode half of it.When you've got Franken-code, the answer is to recode it.

  • Quick Notation Question - Data Rates/Frame Rates/Interlacing

    Finally upgraded to a decent prosumer camera and I'm trying to decipher what the manual is telling me about the many different formats it shoots and and the associated options.  I keep seeing things like "There are two basic shooting modes: 720p and 1080i/p.", which I'm finding confusing.  In my understanding, the "p" in 720p means progressive video and the "i" in 1080i means interlaced.  So what do I make of 1080i/p?
    On top of this, my camera shoots in "native" mode, which drops duplicate frames used in "over 60" formats.  This will give me variations in the notation like:
    720/24pN
    720p Native 60 fps
    1080i/24p
    1080/24PN
    Can someone give me a quick primer about frame rate vs data rate and explain how to read these notations?  I'd appreciate it quite a bit.
    Thanks!

    There are so many cameras, capable of so many different formats that providing a manufacturer and model could be helpful in this discussion.
    Jim's answer is absolutely correct but I'm going to re-state for clarification.
    The i/p designation means you can chose to record as interlaced or progressive for a given resolution.
    It sounds like your camera is designed to "capture" images at 60 frames per second, selecting "native" mode means extra frames are deleted and only the desired frames, based on frame rate setting, are recorded to memory. The advantage of "native" @ 24fps is you save space on your memory card. The advantage of NOT using "native" mode is that all 60 frames per second are recorded, but the file metedata tells playback software to only show the frames needed for the specified frame rate (i.e. 24). Since all 60 frames per second are recorded, you use more memory but you also have the option of retrieving all the those frames, if you so desire, at a later time (i.e. for smoother slo-mo).
    To be honest I don't know what your spec of 1080i/24p means. If that is truly an option then I would guess it means it will record a 24p image but the metedata would indicate the file should playback at 30fps interlaced by adding the proper 3:2 pulldown. This would give you that "film" look in a broadcast compatible format.
    For the most part, you don't want use use any interlaced settings. Very few display devices still in use can properly display interlaced images. Interlacing is only required in some broadcast specifications.
    To answer the second part of your question;
    Frame rates are an indication of how many times the moving image is captured over a given period (per second). Higher frame rates means smoother, more "real life" motion. Data rates can generally be considered an indication of image or audio quality. Higher levels of compression result in lower data rates and (generally) lower quality. If squeezing more hours of footage on fewer memory cards is more important than getting the best image quality, choose a lower data rate. Higher frame rates (more images per second) inherently require a higher data rate to retain the same quality as fewer frames at a lower data rate.

  • Two really quick/dumb questions!

    Hi All,
    I have just bought a new Mac Mini and hooked it up to my Samsung 55 inch TV via HDMI and everything seems do be working great.
    My two dumb questions are:
    1: where on the new OS (I had a Mac 5 years ago and things have changed) is the top "Finder" bar and "disc" icon to save files?
    2: In Safari I do not seem to have a tools bar where I can for example open another tab for a new web page.
    Hope you can help a nubby :-)

    You are running a Mini so it might be that the screen resolution is not exact for your display. I have used a Mini with a conventional display but not HDTV. You might need to go into the settings for the TV to set the screen resolution to accommodate the mini's capabilities. Sorry that  I can't offer more on that score; when I use my Sony Bravia HDTV  it is with the iPad2 and HDMI and I have encountered no issues. Perhaps someone else on the forum has better insight into the Menu Bar problem on the Samsung as the principal display. 

  • How to import mpg files & quick time question

    Hello. I found some previous answers here and followed them, which brings me to now. I bought the QT 6 MPEG-2 PLAYBACK-MAC OS X-INT plug in to allow me to bring mpg files from my sony digital camcorder. I keep getting a message that 'this file is not a movie file'. I don't know how to tell if the MPEG-2 plug in is installed, how can I find out in Quick Time? I have Quick Time Pro.
    What application would be best for me to start editing movies? I have IMovie 6.
    Any help is greatly appreciated.
    thanks

    Hi Trib and welcome to the forums!
    Mpeg2 is the standard compressed final delivery format of a DVD, and is not intended for further editing.
    You need to convert your mpeg2 files to a DV stream that you can edit in iMovie 6.
    For that you need mpegStreamclip:
    http://www.apple.com/downloads/macosx/video/mpegstreamclip.html
    which is free, but you must also have the Apple mpeg2 plugin which you have already installed.

  • 2 quick java questions

    hi, im working on a large grpahics project with some people, and i had a couple of simple questions.
    1) is it possible to detect the colour of a spefic pixel on an image?
    Maybe some sort of method that returns the color or something? This woudl be for collision detection, since we're going to have a character walking around a building and this is pretty much the only thing i can think of for collision.
    2) Is it possible to load a large image, and then make the screen only show a small portion of it? and then when you move, it kind of resets the focus on the larger image to your new location? This would be used to help the character move around the large map.
    Thanks for all the help!

    Youre going to want to get VERY acquainted with Image and BufferedImage, lol.
    Note the getRGB method.
    As for resizing, there are many ways to do this ranging from very simple
    to a bit complicated.
    int getRGB(int x, int y)
    Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace.
    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/BufferedImage.html
    http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Image.html

Maybe you are looking for

  • Void Warranty From Opening?

    Was just wondering if just cracking off the back of the nano but not unscrewing anything will void my warranty. Just taking the back off and slapping it back on. How could they tell anyways. I have the apple warranty along with a 2 year retail store

  • Delete songs from a playlist folder?

    I am trying to delete some songs from a playlist folder. Songs won't delete from any folder, regardless of whether i am in itunes 10 or the newly installed itunes 12. The delete function is greyed out. In playlists, yeah I can delete songs. But in fo

  • ERROR IN BDC SESSION BACK GROUND ( USING PP03 T.CODE)

    Hi Experts, When i am executing the session ( pp03 T.Code) ,it is working fine in fore ground as well as in display errors mode. But it is not working in back ground mode. it is raising the exception ( cntl-system-error). I used flat file which is in

  • My effects like exposure, tint, temp does not work

    I don't know if i click in a wrong place but when I go to develop and I try to use exposure, tint, temp etc in the  first part anything works, I would like to know if someone knows about it

  • Cannot send color video. ColorEnable check box is ...

    Hi, I Cannot send color video. ColorEnable check box is disabled. I know the camera allows color but Skype does not allow me to set it up. Any ideas? Thanks in advance!