How to use CASE or DECODE into that?

Hi, I have a query like this
AND ...smthng
AND --smtg
AND age BETWEEN ....
For the last clause AND the age column, I have the values passed param in the AOC as strings
0 '-30', 31-60, 61-90, and ' 91 +'. The setting IN of course is VARCHAR2.

What I want to do in this clause AND
for example, for age will '' 0-30, the clause AND should be

AND BETWEEN age (if this interval is 0 '-30' then) AND 30 0 (if it falls between 31-60'), then BETWEEN 31 AND 60... and so on...
However this BETWEEN will work up to 61-90 of range but for 91 +, there is no upper limit so it should be
AND age > 91

Now, I don't know how to achieve both BETWEEN and ' > ' clauses in the same statement AND.

DECODE will not work and do not know how to use the CASE in this situation that even this cannot solve this problem.

Don't want to do the last clause AND Dynamics

Please suggest me how to do this.

Thank you
Aashish

Published by: Sylvie S. on October 21, 2011 18:01

A third possibility would be to choose a sufficiently high value as a high-end for the Group 91 + and use something like:

age between to_number(CASE WHEN instr(:param, '+') = 0
                              THEN substr(:param, 1, instr(:param, '-') -1)
                              ELSE substr(:param, 1, instr(:param, '+') -1) end) and
            to_number(CASE WHEN instr(:param, '+') = 0
                           THEN substr(:param, instr(:param, '-') +1)
                           ELSE '9999' END)

John

Tags: Database

Similar Questions

  • How to use in bulk collect into clause

    Hi all
    I need like this, I want to change the query by transmitting the names of the tables in oracle database 10 g 2.

    as if I use first of all, I spend select it by name of table scott.emp * from scott.emp;

    so I want to spend scott.dept table name select * from scott.dept;
    using select * option in the select list.

    How can I run it.

    Give me a solution.

    Please answer...

    Execute Immediate is in fact an option, that you can not use it because you have a variable select list.

    You can use DBMS_SQL or REF CURSOR. The Ref Cursor example is given below:

    var oput_cur refcursor
    var tabname varchar2(30)
    
    exec :tab_name := 'dual';
    
    begin
      open :oput_cur for 'select * from ' || :tabname;
    end;
    /
    
    print oput_cur
    
  • REGEXP_SUBSTR - how to use case-sensitive

    I use REGEXP_SUBSTR with case-insensitive option

    while I use as below

    Select REGEXP_SUBSTR ("uk123 research", "UK", "i") double column;

    It displays error: ORA-01722: invalid number

    Help, please...

    Oracle 11.2.0.1.0

    You provide all the required parameters. See the http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions138.htm#SQLRF06303 documentation

    Here's the correct query:

    select REGEXP_SUBSTR('search for uk123', 'UK',1,1,'i' )  col_name from dual;
    
  • How to use the Facebook like widget that comes with the muse?

    I can't for the life of make me it work! What url should we use?

    Hi Chris

    This should work, I need the exact code you use in the page.

    Please pm me.

    I also tried to use the generated code that works on my end, have created a short video for your reference, you can download it here:

    https://www.dropbox.com/s/zztkx28emakau4k/FB.swf

    Thank you

    Sanjit

  • How to use 'snippets' of the code that I found on jsfiddle

    Hi people,

    I found some code on jsfiddle I would use in my paper EDGE.

    The violin in question is here

    http://jsfiddle.NET/NJwER/26/

    I created an object on the stage and called it "draggable" (according to the name < div > in the example jsfiddle)

    I then copied this following piece of code in the "JavaScript" jsfiddle pane in the "CompositionReady" of my EDGE document code Panel

    {$(function()}

    $("#draggable").draggable ({}

    Helper: function() {}

    Create an invisible div as the assistance programme. It moves and

    follow the cursor as usual.

    Return $('<div></div>').css('opacity',0);

    },

    Drag: function (event, ui) {}

    During flirting, animate the original object

    Follow invisible help with custom acceleration.

    var p = ui.helper.position ();

    $(this) .stop ().animate({)

    top: p.top,.

    left: p.left

    (}, 1000, "easeOutCirc");

    }

    });

    });

    But nothing happens at all. Can someone let me know why it does not work please?

    Thank you

    Tom

    Hi Tom, here ya go.

    Example (for some strange reason, sometimes I have to refresh to flirting at work... hmmm):

    www.timjaramillo.com/code/Edge/drag_ease

    Source:

    www.timjaramillo.com/code/Edge/_source/drag_ease.zip

    The main question is how you were addressing the "draggable" div Since we're inside the dashboard API, you must precede the symbols with "sym", so it should be:

    SYM. $('draggable') .draggable...

    Previously, you had like:

    $("#draggable").draggable...

    Here's the code revised on Stage.compositionReady:

    () yepnope

    {

    Nope:]

    "js/jquery-ui-1.9.2.custom.min.js,"

    "js/jquery.ui.touch-punch.min.js,"

    'css/jquery-ui-1.9.2.custom.min.css '.

    ],

    full: init

    }

    );

    function init() {}

    SYM. $('draggable»).draggable({)

    Helper: function() {}

    Create an invisible div as the assistance programme. It moves and

    follow the cursor as usual.

    Return $(')

    .css('opacity',0) ');

    },

    Drag: function (event, ui) {}

    During flirting, animate the original object

    Follow invisible help with custom acceleration.

    var p = ui.helper.position ();

    $(this) .stop ().animate({)

    top: p.top,.

    left: p.left

    (}, 1000, "easeOutCirc");

    }

    });

    }

  • Satellite M300 - how to use the recovery disk

    Hello world

    I was wondering how to use the 2 recovery discs that I burned recently if I wanted to fix my USB ports (as seen in my Toshiba M300 - wire to USB ports)

    Any suggestions?

    Hello

    You can use the only recovery disk to reinstall the whole OS!
    This means that the use of the recovery disk will format the whole HARD drive and will set the laptop back to factory settings!

    If you want to use the recovery disk and then insert it into the ODD and the start-up of this disc.
    Then the installation of the OS should move forward and you should follow the instructions on the screen.

    All that s

  • How to use the Script TCL EEM in router?

    Dear all,

    I have a TCl Script (it's 1 to test and understand).

    ********************************************** TEST.tcl *******************************************

    : model cisco::eem:event_register_syslog "Interface FastEthernet0/0, changed State to.

    import namespace: cisco::eem: *.
    import namespace: cisco::lib: *.

    Table game arr_einfo [event_reqinfo]

    action_script enable status

    If {[catch result {cli_exec $cli_fd (fd) 'enable'}]} {error $result $errorInfo}

    If {[catch result {cli_exec $cli_fd (fd) 'int fa0/1'}]} {error $result $errorInfo}

    If {[catch result {cli_exec $cli_fd (fd) 'shut'}]} {error $result $errorInfo}

    action_syslog msg "New Port is now"

    If {[catch result {cli_close $cli_fd (fd) $cli_fd (tty_id)}]} {error $result $errorInfo}

    ********************************************** TEST.tcl *******************************************

    Can someone tell me how to use this script in router that will be used every time my interface fa0/0 he'll fa0/1 in stop mode?

    Can you give me the steps to follow in the router?

    Wharton are the sine qua non for the use of this?

    Concerning

    Concerning

    Virtually any command, Yes.  You can't do "?" as you can from an interactive session, but you can run all the commands EXEC and config otherwise.

  • How to use Adobe PDF Pack, annual, I just buy online

    How to use Adobe PDF Pack, annual, that I bought online, to convert PDF files sent to me, for Word documents

    Hi fionas,.

    Please visit to get started with ExportPDF | Adobe Community for more information on the conversion of PDF to Word using Pack/ExportPDF PDF files.

    Best,

    Sara

  • I don't know how to use a light layer in After Effects CS4

    light layer.pngHello

    I work with a lot of layers of texts and it is very trendy to put a thin layer on the text at one time or another, it also seems to be really good. But I looked on the net for tutorials and may not know how to use the light layer so that a light passes through a text from one side to the other. It looks like a flashlight through the text. I go to the top and choose > layer > new > light.

    What is the color of the text changes (the part that is not shined on). How can I change the settings so that the color of the text does not change? Do you know video tutorials to use for a light coating?

    Thank you for your time!

    You might need two layers of light: ambient light to get the layer set a general spread of the light, then a spot light to create a moment strong.  Adjust the specularity and brilliance of the layer will also give different results.

    If you try just to create a strong general time that rolls through the text, try instead the plugin CC Light Sweep.  Also, applying a layer color ramp can create the illusion of some effects of light.

  • I renamed my folder in documents and settings accidentally using another account. Now, when I logged into that account, all my data is gone. How can I get it back?

    I renamed my folder in documents and settings accidentally using another account. Now, when I logged into that account, all my data is gone. How can I get back all these data?

    Hello Tiffy.T,

    Thanks for the return of the response.  If this happened recently, I suggest to perform a restore of the system to a point in time before you rename the folder.  Please let us know on this status.

    System Restore:

    http://support.Microsoft.com/kb/306084

  • Any ideas how can I insert a pdf into word, by using the option object to insert. However, the pdf file that I want to insert text and annotated lines, but once inserted comments do not appear?  any help would be greatly appreciated.

    Any ideas how can I insert a pdf into word, by using the option object to insert. However, the pdf file that I want to insert text and annotated lines, but once inserted comments do not appear?  any help would be greatly appreciated.

    You will need to find a forum for MS Word, since it is the software you are trying to manipulate in the present.  If you think that the treatment/creation of the PDF file plays a role, then you should ask in the forum for the software that you use to create the PDF file.

    This forum is for a question about downloading and installing Adobe products test, so in all circumstances, your question does not fit in this forum.

  • How to use the search to find the file that contains specific text?

    In VBA, I use the following statement to access the indicated procedure:
    Public Declare Function QueryPerformanceFrequency Lib "kernel32" _
    (ByRef freq As Currency) As long

    So I guess that the string "QueryPerformanceFrequency" exist in the c:\windows\system32\kernel32.dll, namely in the entry point symbol table.

    How can I use Start > search for the dll file in c:\windows\system32 which contains "QueryPerformanceFrequency"?

    (Of course I know the answer in this case.  This is an experiment to determine the model for other research.)

    But when I use Start > search to verify that the operation does not find anything.  At first, I said:

    Finally, I even tried kernel32.dll in the file name field.  I even tried to "queryperformancefrequency", where the search is case-sensitive.  I do not believe it unless this search is selected.  (I don't).

    Indeed, to test my basic understanding, I created a txt file with "queryperformancefrequency" between text and research found the file when I specified the folder containing the file (look in), nothing in the field file name and "QueryPerformanceFrequency" in the field of Word or phrase, voluntarily with different 'cases '.

    This experiment has succeeded.

    FYI, the user account for my computer with administrator privileges.  In addition, kernel32.dll is not marked read-only (of course).

    It resembles the method 2 in of Article ID: 309173 - last review: December 1, 2007 - revision: 4.3 has the desired solution.

  • My vga is built into that model I don't know how I install its drivers?

    My vga is built into that model I don't know how I install its drivers?

    Hello

    I suggest updating the drivers supplied by Device Manager and check to see if it helps:

    http://support.Microsoft.com/kb/283658

    It will be useful.

  • How to use the sim card that comes with my thinkpad tablet 3G version?

    I got my tablet from newegg and my Tablet comes with a sim card AT & T, how to use this map? I have to go to the AT & T sign a contract and activate store? I'm in the United States
    Thank you!

    At & t will put you on a laptop data plan which is more expensive than a plan of "ipad." If you can, find an IMEI of an Ipad and use the sim card number and the IMEI number of the Ipad for you sign up for a plan of cost reduction. Call them to implement. Using an online form or walk into a store At & t will be very frustrating.

    PS: it is there no contract that your device is not supported by anyone - you own. It will be a month of service. If you don't sign up, free of charge.

    What, the bonus is a kick butt gps integrated 3G wwan card. Enjoy!

  • How can I recover all my files that I lost in an accident? I had to use my system recovery disk and install drivers for my computer again. I lost all my files. Is there something I can do?

    Help!  How can I recover all my files that I lost?  I was answering an e-mail message when I heard a couple of clicks then my computer off.

    I thought that my computer was destroyed.  Nothing I tried would bring it to the top, so I decided to use the system recovery disc that

    came with my computer.  I've also downloaded all the drivers for the application.  My computer is back on, but I lost everything.

    It's like putting into service with a new computer.  I had a lot of important information in the files that I lost.  I've tried everything I know to do

    without success.  Is it still possible to recover these lost files?  Thank you very much for your help!

    Hello

    I'm sorry, but when you did the recovery of the system you have disabled your hard drive of everything, including your files.

    You now have a new computer.

    You can try this program (it's free) to see if he 'can' find and recover your files. no guarantee:

    http://www.Piriform.com/Recuva

    See you soon.

Maybe you are looking for

  • announcement on installs without permission

    There is this addon that installs without permission. 'S called it funklyrics 1.122 it seems to be able to turn on even after being disabled. It seems the ride through an update. The program itself seems to be harmless but implements small adds tryin

  • How to simulate a joint manipulator

    Hello I want to simulate a robotic arm joint in labView Robotics toolkit. Please, help me to get started doing a joint robotic arm. Thank you Looking for your kind help M Abbas

  • It is not a 64 bit flash player

    I searched for flash player 64 bits and I have not found anything Anyway why do a 64-bit Internet Explorer if half of the modules do not work I mean Google chrome works as well as a 64-bit browser but yet it is a 32-bit program I really hope that mor

  • The display of images on Scan disk memory card

    Scan disk memory card How can I get my pictures up when I insert my card memory ScanDisk from my camera. When I put it in my computer, it comes up with autorun and nothing else and my pictures do not show.

  • Several VPN site to Site

    Hello. I have a central router and 52 customer routers and I want these clients to connect to the central router with VPN. Advice or how the configuration on the clients and the server? Thanks in advance for any help.