Choose the value based on the parameter range

Hi all

Thanks in advance

I have a table tableaa

what I need to do

(1) if the parameter according to table below is 1 then I need to choose
only every 3 ranks

AN AVERAGE OF END TEACHER BEG
---------- ---------- ---------- ---------- ----------
3 0.2 0.3 159 159
6 0.3 0.4 250 250
9 0.4 0.5 388 388


(2) if the parameter according to table below is 2 so I need to choose
only every 6 row table

AN AVERAGE OF END TEACHER BEG
---------- ---------- ---------- ---------- ----------
6 0.3 0.4 250 250


create table tableaa (a number, beg, number, end, teacher number, average number);

insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (1, 0,.1, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (2,.1,.2,, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (3,.2,.3,, 159, 159);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (4,.1,.2, 250, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (5,.2,.3, 250, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (6,.3,.4, 250, 250);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (7,.2,.3, 388, 388);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (8,.3,.4, 388, 388);
insert into TABLEAA (A, START, END, TEACHER, AVERAGE)
values (9,.4,.5, 388, 388);
commit;

This query, you can get what you need:

SELECT  *
FROM    TABLEAA
WHERE   DECODE
        (
                :parameter
        ,       1
        ,       MOD(A,3)
        ,       MOD(A,6)
        ) = 0

The sample output:

SQL > exec :parameter := 1;

PL/SQL procedure successfully completed.

SQL > SELECT  *
  2  FROM    TABLEAA
  3  WHERE   DECODE
  4          (
  5                  :parameter
  6          ,       1
  7          ,       MOD(A,3)
  8          ,       MOD(A,6)
  9          ) = 0
 10  /

         A        BEG        END       PROF    AVERAGE
---------- ---------- ---------- ---------- ----------
         3         .2         .3        159        159
         6         .3         .4        250        250
         9         .4         .5        388        388

SQL > exec :parameter := 2;

PL/SQL procedure successfully completed.

SQL > SELECT  *
  2  FROM    TABLEAA
  3  WHERE   DECODE
  4          (
  5                  :parameter
  6          ,       1
  7          ,       MOD(A,3)
  8          ,       MOD(A,6)
  9          ) = 0
 10  /

         A        BEG        END       PROF    AVERAGE
---------- ---------- ---------- ---------- ----------
         6         .3         .4        250        250

Tags: Database

Similar Questions

  • How to change the input range (DAQ assistant) with a digital command?

    Hello everyone

    I am currently working with the NI USB-6218 acquisition card.

    In order to acquire a signal, I would like to be able to choose the input range of the DAQ with a digital command Wizard (and not opening the window of DAQ assistant) (as 'number of sample' and section 'rate'...)

    Is this possible and if so, how?

    Thank you very much in advance for your answers!

    You can't with the DAQ Assistant so just click on and select "generate the Code of OR-DAQmx. You can edit the Subvi who performs the installation.

  • Need to display negative amounts, amounts positive based on the value of the parameter.

    Hi all

    I have a requirement in rdf as follows:

    I have two or three lines of the SELECT statement. An amount column having both negative and and postivie values.

    Based on the value of the parameter I need to take these records.

    Say, if the value of the parameter = "Credit amount", then I have to choose the records, the amount column value is negative.

    If the value of the parameter = "Debit amounts" then I have to choose the records, which the column value is positive.

    If the parameter Value = "All", then I must take all records, including both positive and negative.

    Please suggest how to achieve this scenario.

    Thank you
    Abdul

    In your where clause to add the following
    and ((& paramètre = "Débit" et montant > 0) or)
    (& parameter = 'Crédit' and the amount<0)>
    (& parameter = 'All'))

    Hope that answers your question
    Sandeep Gandhi
    Independent consultant
    513-325-9026.

  • How to choose the item value list based on another value of list item

    Hello friends,
    I have two list items named xxx and yyy... OK, my problem is I want to choose a value of yyy list item based on the value of article xxx...

    Example: I select 'Computer' in xxx... Based on this I want to choose the item values in yyy as a monitor, keyboard, mouse, etc... This must be done at run time. How can I do this... Give me a few examples of code [pls tell me trigger appropriate to place this encodings]
    Thanks in advance,
    Battistelli

    Very simple to use the LOV and query of the lov which is attached to the YYY field, use the query as below...

    SELECT columns
    FROM table
    WHERE column_name = :XXX_FIELD
    

    Use the ENTER OF LIST Yes property for the YYY field.

    -Clément

  • default value of the parameter date problematic SYSDATE

    Hello

    I finally discovered why a report of problems, but have no solution to the problem.

    After the first run of the report and MORE (DESKTOP is no problem), I can open is no longer the LOV for any of the settings. The LOV icon is available, but nothing happens when you click it.

    Now, I know the problem is a specific condition based on a date parameter.

    The State is testing a date field against a setting that is based on NONE and has a default value of today. If I use effective dates in the setting I have no problem. If I use today or SYSDATE, then I can only run the report once. After that I can't choose any LOV in any of the settings. If I change the today or SYSDATE to a real, date is well again.

    The State of origin that was used was based on a calculated field due2 defined as: DECODE (:due,'TODAY',SYSDATE,TO_DATE(:due,'DD/MM/YY'))

    I tried to change the condition of:

    date field < = TO_DATE(:due,'dd/mm/yyyy')

    but also causing problems if I used SYSDATE or today in the parameter.

    I then tried to change the calculated field to due2:
    Decode (:due,'TODAY',to_date(sysdate,'dd/mm/yyyy'),to_date(:due,'DD/mm/YY'))
    but it does not work.

    Any suggestions?

    Thank you.
    Leah

    Hi Lea,.
    Try using 'CASES' instead of 'Decode' in your state:

    -case when: due = trunc (sysdate) then 'Today'
    of other end TO_DATE(:due,'DD/MM/YY')

    Maybe it will solve your problem.

    Note that this is problematic, because if the user enters an invalid date you will probably get an error.

    I could do this a bit different...
    1. create an optional parameter based on the date (so that I'll have the calendar)
    2 create a condition where the parameter is empty, it will use SYSDATE.
    for example:
    =: due
    OR (: due is null AND = trunc (sysdate))

    Tamir

  • You can change the default value of the page range when printing?

    When printing, the default value in the range 'page' is set to 'all '. Is it possible instead to set the default value of 'pages '?

    Hello

    In general, you have four options to choose the pages to print, including all pages in a document. To select individual pages or a sequence of pages, called a range, you can type the page numbers separated by commas or dashes. For example, if you type 1, 4, 5-7, only pages 1 and 4, and then pages 5 to 7, will be printed.

    The selection option prints only text or graphics that you have already selected in a document

    See: use your computer for printing, scanning and fax: http://windows.microsoft.com/en-US/windows-xp/help/setup/print-scan-fax

  • How to write the condition with the value of the parameter

    Hello
    I'm working on siebel BI publisher report. I am able to display the value of the parameter in the report.

    Now, I wanted to do something logical based on the value of the parameter.

    for example: If the user changes the value of the parameter then I have to call A submodel if user don't past not any value then it should not display A submodel

    can someone tell me how to write that above logic?

    If the parameter exists then MODEL of APPEAL one another do not call MODEL A

    Kind regards
    JAG


    Dial a submodel

  • How the parameter values can be passed to OBIEE reports of the user interface

    Hello

    Does anyone have an idea on how to pass parameters to the UI (user interface of a java application) to
    OBIEE report page. Based on the value of the parameter passed, the report page should be displayed for ex: the product
    name must be selected in the user interface, then the page of the report must show sales for this product
    Alone.can u please let me know how this can be achieved. Any help would be appreciated.

    Thank you
    Leela

    Hi Leela,
    What you're looking for can be accomplished with GO URL, see here:
    http://download.Oracle.com/docs/CD/E12096_01/books/AnyWebAdm/AnyWebAdm_APIWebIntegrate6.html#wp1005251

    Kind regards
    Alastair

    Published by: AlastairB_UK on October 26, 2009 15:27

  • The default value based on the field from another table to a custom object

    I'm trying to set the default value to a field in the custom object to the value of a field of account. I tried the syntax 50 ways different and just don't get the case. The label for the account field displays the form of s/n, the integration of the tag is ltDBA_ACCT and it appears in the fx reports area as Account.Text_22.

    The field of custom object that I am triying update is also called s/n, which was originally the required field 'NAME '. The name of the table, account, should it be included? Do I need a function to the field?

    I've updated the external ID using the line with syntex < ID > ID (at least higher ID) so I know that it is possible to define a default value, but s / < n >, < ltDBA_ACCT >, 'account '. "" S/n "and so on are simply not working.

    If anyone knows how to get into what I would be really grateful for the help.

    OK, so if you default a field to the value of another object, you must use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure you do.

    Then this won't work by default if the folder is created from the object that you want to join the because a default works in record creation and the ID must be available so that it works correctly. It will not work if you choose the record of the related object after that registration of the custom object is created. You can set the default after, but that does not meet your requirements.

    The syntax of the default are the following: JoinFieldValue (ref_record_type, foreign_key, field_name).

    In your case, ref_record_type is '', foreign_key is [] and field_name is ''. The best way is to determine what is the name of the field to create a new workflow for the account and use the Workflow Rule Condition expression builder to choose your field ("DBA") in the list. The value returned by the expression builder must be placed in the field_name variable in the function JoinFieldValue (minus the parentheses and quotes).

    Give it a shot and let me know how you do.
    Thom

  • Fill a field value based on the value of another field

    Hello
    Could someone tell me what is the problem with the following select statement. For a group of records, trying to fill a field with a value based on the value in another field (problem of status), but the Group of records appears empty just when I put this code in the field.
    Any help would be appreciated
    Thank you


    <? choose:? >
    <? When: IssueStatus = "Open"? >
    <? 1? >
    <? end when? >
    <? otherwise:? >
    <? When: IssueStatus = "closed"? >
    <? 2? >
    <? end when? >
    <? otherwise:? >
    <? When: IssueStatus = "Unresolveable? >
    <? 3? >
    <? end when? >
    <? end otherwise? >
    <? end to choose? >

    Use the following syntax.

    
    
    Display 1
    
    
    Display 2
    
    
    Display 3
    
    
    
  • Replace the value of the parameter selected with something else

    Hello

    I have a feeling that this scenario is not possible, but I hope that someone on the forum can clarify the issue:

    I was asked to create a parameter that displays a list of values for the company names. However, by choosing a company name in the list, a business identifier would be used for the underlying request generated by Scout.

    Kind regards

    Kevin.

    p.s. I am aware that it is possible set the parameter identifier name and company but the preference is not to do this if it can be avoided.

    Hello

    When you create the item for the CompanyID class there are a number of options, you can check. You don't want the item class displayed then uncheck display article class. The sort element class is also not necessary.

    When you create the parameter to CompanyName you created the setting in the normal way, you don't have to tell Scout that there is an indexed LOV, everything happens in the background.

    Rod West

  • Unable to choose the range in iMovie

    Unable to choose the range of iMovie 10.1.2

    Hi, Jeff.

    You can select a range inside a clip with your clip in the timeline, placing your cursor on it and hold the 'r' key when you drag your cursor over the clip while pressing your mouse or track pad.  The range will be described in a yellow box.

    To select a range of multiple clips, select the first clip, and then select the last element while holding down the SHIFT key.

    Best,

    -Rich

  • VI to convert input signals NI 9402 in a RPM value, based on the frequency of the pulses

    Hello

    I'm looking for a VI convert an input signal NI 9402 in a RPM value, based on the frequency of the pulses. Is there such a thing that exists in the library of national instruments?

    I run LAbview 2014 integrated control and monitoring on on a cRIO 9802 high performance integrated system with NEITHER 9402, 4 channels, 50 LV, LV TTL Module input/output digital, ultra high speed digital i/o for the cRIO module.

    Any help would be greatly appreciated.

    The easiest way is to use the FPGA to get the time between the edges of your pulse increase (shift registers to maintain the current situation and the time will be necessary).  This will give you the period.  If it's a single pulse per turn, then the number of laps is just 60/T, where T is the time in seconds.

  • How to get the parameter values of a step type custom when I create file and adding a type of step seq

    I use lv 8.5 and teststand 4.0.

    I did a step type custom and recorded at the MyTypes.ini in pallets of type.

    I specified a default module by opening the properties of the custom step of *.ini type window, then I put some values of the parameters.

    T1) when I open teststand and I add the custom step type manaully in seq file, the labview module parameter values are represented.

    But, if to use file (create and add support prototype stage), the labview module parameter values has the default value.

    Using joint file, how to get the setting custom step type values I put in *.ini?

    Q2) each type of step are automatically by name through the use of LoadTypePaletteFilesEx. When I open teststand and I add the custom step type manaully in seq file, the module is loaded automatically. Inside the attachment, I use a prototype of charge and a fixed path where the module labview is to load the labview module.

    Can I load module automatically without using a prototype of charge or how can I get a dynamic path of type step?

    I solved Q1 for myself by using the mapping tab of the parameter within the configuration to the default module window.

    Everyone knows Q2?

    Thank you.

  • values based on the following logic 'values after the first values of two '_' and before last '_' values '.

    Hi all

    I need the values according to below 2logics in a single select query using instring and substring

    1 values based on the following logic 'values after the first values of two '_' and before last '_' values '.

    2 values based on the following logic 'values after the first values of two '_' and before last'-'values '.

    EXM:

    Entry: ABCD_EFGH_IJKLM - NOPQ_XYZ output: IJKLM - NOPQ

    Entry:. ABCD_EFGH_IJKLM - NOPQ output:IJKLM

    Thank you.

    Check the following

    WITH DATA1 AS

    (SELECT "ABCD_EFGH_IJKLM - NOPQ_XYZ" double val)

    UNION ALL

    SELECT 'ABCD_EFGH_IJKLM - NOPQ' double val

    )

    SELECT SUBSTR (VAL, INSTR(VAL,'_',1,2) + 1, DECODE (BIGGER (INSTR (VAL, '_',-1, 1), INSTR(VAL,'-',-1,1)), INSTR (VAL,'-', - 1, 1), LENGTH (VAL) + 1, INSTR (VAL, '_',-1, 1))-(INSTR (VAL, '_', 1, 2) + 1))

    OF DATA1;

    Concerning

    Salim

Maybe you are looking for

  • Satellite L350-262 - Startup Repair screen displays

    Can anyone help? I had a L350-262 only 2 days. Already, I've had the Startup Repair screen appears showing there is a problem and Windows will not work. When the system try to automatically repair it says that Windows cannot automatically repair. I h

  • Equium A210-17i does not supply power to the top only with the power adapter plugged

    Equium A210-17i turn on when the battery is missing, but the laptop is set to the power supply dc? I have a dead battery and the laptop does not light with or without the battery inserted.The food came out 19v as it is supposed to. Also no led lights

  • Error 80070005 "Windows cannot check updates"

    Can someone help me solve this problem?

  • HP Photosmart Premium C309g-m connection cavity problem

    Hello I bought a HP Photosmart Premium C309g-m today and have successful connected to my Wireless N network.  My problem is that every time that I reboot the printer there connect lasts for about 30 seconds and then gets BOUNCING and then stops respo

  • PWS:Win32 / Zbot

    Microsoft Security esentials me ha detectado "PWS:Win32 / Zbot" y me offers the option of eliminarlo y agreed pero al reiniciar para concluir limpieza vuelve a nuevo detectarlo.Is there any methodology para eliminarlo realmente?Gracias