function that limits the result?

Hello, I am trying to write a calculation that CAP the deduction lead after reaching a certain number, in this case $50. For example:

-Rate of pay is $25 / hour and annualization is 2080

.0125 * ((Pay_Rate * Annual_Hours) / 26) = $25 deduction

-Rate of pay is $50 / hour and annualization is 2080

.0125 * ((Pay_Rate * Annual_Hours) / 26) = $50 deduction

-Rate of pay is $75 / hour and annualization is 2080

.0125 * ((Pay_Rate * Annual_Hours) / 26) = deduction of50 $

Is there a 'Limit' function that will work in this formula?

Thanks for your help,

Chris

Hello Chris,

If I understand correctly you want the function LESS.

LESS (n1, n2 [,...] *) = smaller of numbers n1, n2,...
Thus, for example:

SELECT LESS (Pay_Rate * Annual_Hours / 2080)

50

)

...

give your calculation if less than 50 and 50 otherwise
(I rewrote your calculation is equivalent but deleting the unnecessary parentheses and grouping "* 0.0125" and "/ 26" ")

(Note: the "opposed" LESS is MORE)

HTH,

Bruno Vroman.

Tags: Database

Similar Questions

  • Function that returns the results of a select statement

    Hello

    I would like to create a feature on the famous HR Departments oracle table to select * from him. I don't know how to do it.

    Is someone can help me?.

    Thank you

    Oracle stored functions cannot return result sets directly but can return the REF CURSOR. Please read [optimize result set retrieval using ODP.NET and Ref Cursor | http://www.oracle.com/technology/pub/articles/mastering_dotnet_oracle/williams_refcursors.html] which gives complete examples in PL/SQL for the side Server and VB. NET client side.

  • Looking for an example of "function that returns the error text.

    Environment: APEX 3.1.1.00.09 on AIX 5.3

    I'm looking for an example implementation of the posting of the "function that returns the error text.

    I would like to write a database function that does the validation logic and return the text of the error.

    Is it possible to create multiple lines of text of error based on error conditions?

    I'm trying to use it at the end of the input data to go on the set of the 'document' to the entry and highlight all error conditions encountered before the 'document' is subject to additional processing.

    I wrote the function and reference it in a posting as ' validate_stuff (: P3_DOC_SEQ); »

    I have an error message "validate_stuff is not a procedure or is not defined.

    The object is a function, not a procedure. It is defined to return a parameter VARCHAR2 hoped posting if it is not NULL.

    When I run the SQL function * more and spend in a number of documents are returned the correct error messages.

    Any direction is greatly appreciated.

    -gary

    Hi Gary,.

    You must RETURN the result of the function:

    BEGIN
     RETURN validate_stuff(:P3_DOC_SEQ);
    END;
    

    Andy

  • How can I access a journal or a report that lists the results of an operation of Disk Defragmenter?

    How can I access a journal or a report that lists the results of an operation of Disk Defragmenter?

    Windows Defrag is supposed to run silently in the background.
    Unlike XP, it does not offer a newspaper to the user, as far as I understand.

    If you schedule a defrag, you can let it run in the background and forget it.

    Schedule defragmentation
    Start button > Search box, type Task Scheduler > pressenter > invite uac, click on continue or enter the admin password >
    (click on the pointer before) to expand Task Scheduler Library >
    expnad Microsoft >
    Expand Windows >
    Click on Defrag > the middle column, click scheduled d.... >
    right column, click Properties > click triggers tab at the top > click on Edit > select / adjust how to defragment Appendix to be executed, select options >
    at the bottom of the box, place a check on " enable " >
    OK > OK yet > exit the Task Scheduler window.
  • Function that return the name of the current report

    Hello

    Anyone know if there is a function that returns the name of the current report?, similar to GET_APPLICATION_PROPERTY (CURRENT_FORM) in the forms.


    Tnks,


    LEFM

    Hello

    You can use the builtin: SRW. GET_REPORT_NAME
    This function returns the file name of the running report

    http://www.Oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/PLSQL/builtins/SRW/srw_get_report_name.htm

    NOTE: it is not the name of the RDF file. Is the name defined in the reporting name property.

    Concerning

  • PLSQL function to return the result of the query

    Dear all,

    Oracle Database SE1 11.2.0.1

    I need to create a plsql function which should accept SQL as a parameter, execute it and return the result set.

    Is this possible?

    Madhu.149 wrote:

    I need to create a plsql function which should accept SQL as a parameter, execute it and return the result set.

    Be careful - results games indicate a set of data stored in memory. This is not what are sliders. This isn't how Oracle should be used.

    Imagine that you implement such a result set function - which, on average, requires 1 MB of memory (private server) to store the results of the SQL query. A 100 users mean a 100 MB of memory required server. This is not suitable. Not at all. Never.

    The correct back 'thing' is a handle to SQL cursor (called a ref cursor in this case). A SQL cursor is a "program" - that the appellant runs via the fetch command and generates one or more lines accordingly. Appellant repeatedly runs this slider through calls to fetch until this slider found and returns all rows affected (using consistent readings).

    If you want an abstraction interface that the client can call via PL/SQL code in the database, so this crafting optimal SQL interface, creates the SQL cursor and returns the handle of the cursor (via the ref cursor data type) to the client.

  • Why CVI have functions that duplicate the functions of ANSI C file handling (ex: Openfile)?

    Why CVI have of file manipulation functions that seem to reproduce the functionality of the ANSI C functions?

    Is there an advantage to using the CVI functions?

    As the CVI was released (1987), until the ANSI-C standard is released (1989) maybe the question should be the other way around!

    In those early days, CVI was supposed to be cross-platform, so it was logical to develop a set of libraries that operate in the same way across the different computers it was targeted at. These days, the focus seems to be primarily under Windows, so this philosophy at the beginning is a bit redundant, especially, as you say, with the widespread adoption of ANSI-C.

    Personally, if there are similar functions in CVI, and ANSI, I'll go for the ANSI, whenever for portability of the reasons, but yet I write code in a number of different programming environments.

    JR

  • a function that returns the type with a table joint!

    Good day to all,
    I have a function that returns a type.

    so I select it as:
    Select * from table (function (param1, param2))

    now I want to combine this with a table so that the settings for the service we get from the join table. Is this possible? And how?
    I tried different options without success.

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Thanks in advance?

    user564819 wrote:

    something like:
    Select *.
    table table (function (b.column1, b.columnb) x), tablea b
    where x.a = b.col

    Is this possible?

    Somehow...

    SQL> create or replace type TIntegers is table of integer;
      2  /
    
    Type created.
    
    SQL>
    SQL> --// our sample pipeline simply spews 2 numbers for eevry number input - simple
    SQL> --// to use for the testcase below
    SQL> create or replace function FooPipe( n number ) return TIntegers pipelined is
      2  begin
      3          pipe row( trunc(n) );
      4          pipe row( trunc(n)*-1 );
      5          return;
      6  end;
      7  /
    
    Function created.
    
    SQL>
    SQL> with dataset( n ) as(
      2          --// ignore this part as it only builts a base table
      3          --// for us to use to select values for input to
      4          --// to the pipeline - in "real world" use this table
      5          --// will already exist
      6          select
      7                  level
      8          from    dual
      9          connect by level <= 10
     10  ),
     11  pipe_line( n, array ) as(
     12          --// we run the pipeline as a nested table column
     13          --// in the SQL projection - the CAST is important
     14          --// in order to establish the nested table type
     15          select
     16                  d.n,
     17                  cast(
     18                          FooPipe(d.n) as TIntegers
     19                  )
     20          from    dataset d
     21  )
     22  --// we now use a standard query to unnest the nested table column
     23  select
     24          p.n,
     25          pipe_val.*
     26  from       pipe_line p, TABLE(p.array)  pipe_val
     27  /
    
             N COLUMN_VALUE
    ---------- ------------
             1            1
             1           -1
             2            2
             2           -2
             3            3
             3           -3
             4            4
             4           -4
             5            5
             5           -5
             6            6
             6           -6
             7            7
             7           -7
             8            8
             8           -8
             9            9
             9           -9
            10           10
            10          -10
    
    20 rows selected.
    
    SQL>
    

    Not sure I like it. What is the real problem that this method (driving a pipeline with input of a base table rows) is supposed to address? There may be a simpler and more elegant approach...

  • How to create the javaScript function that erases the text of the field values

    Hello
    How can I create a javaScript function to clear the values of the text fields
    and I want to call this function on the clear button on my custom area

    Yes it is possible but not recommended approach.

    Here is the link that you can use if you want to implement using javascript
    http://www.itechies.NET/tutorials/JScript/jsexample.php-PID-set_field.htm

    Thank you
    AJ

  • Function that returns the text of the error - type of Validation

    Small question regarding creating a function that successfully compiles a validation without a text of the error control: what value the function returns to validation successful?

    I tried a null value, but it doesn't seem to work.

    Thank you.

    Hello

    How does it work?

    What return NULL validation function is passed. If it returns a character string, then the validation failed and string is displayed as the error message for validation

    BR, Jari

  • Request report - use the function that returns the cursor

    My requirement is to create a report, which the source will be a function that returns a cursor (the type of cursor is ref cursor).
    How this can be done?

    for example. function my_func (pol_no in number) return cur_type < ref cursor >

    Edited by: viveks on October 27, 2009 10:09

    Better to look at a function that returns a query, or use a hose to treat your cursor returned, because the APEX at the moment can NOT handle the sliders in reports...

    Thank you

    Tony Miller
    Webster, TX

  • How to perform a function and return the result in a variable of liaison

    Hello

    I'm trying to calculate the sum of the salaries of all persons with a particular using a function JOB_ID TOTAL_INCOME (v_job_id).

    create or replace function total_income
    + (v_job_id in VARCHAR2) +.
    Number IS BACK
    v_total number (6);

    cursor get_sal is
    Select the pay of employees
    where job_id = v_job_id;
    BEGIN
    v_total: = 0;
    for emp in get_sal
    loop
    v_total: = v_total emp.salary; +.
    end loop;

    dbms_output.put_line (' Total salary ' | v_job_id |' is: ' | v_total);
    Return v_total;
    END;

    Now I woud like to perform this function and assign the value returned in a variable binding test_sal

    test_sal variable number (6)
    SELECT total_income ('AD_VP') in: test_sal FROM DUAL;
    dbms_output.put_line (' Sal Total :'||: test_sal);

    This returns the errors below:

    SELECT total_income ('AD_VP') in: test_sal FROM DUAL
    *+
    Error on line 0
    ORA-01036: illegal variable name/number

    dbms_output.put_line (' Sal Total :'||: test_sal);
    Error on line 3
    ORA-00900: invalid SQL statement

    Could someone help me what could be the problem? Thanks for your time...

    Hi Kiran and welcome to the forum,

    You mix SQL and PL/SQL

    It's the way in which SQL:

    SQL> SELECT total_income('AD_VP') FROM DUAL;
    
    TOTAL_INCOME('AD_VP')
    ---------------------
                      123
    1 row selected.
    

    It comes to PL/SQL in SQL * more

    SQL> variable test_sal number
    SQL> execute :test_sal := total_income('AD_VP')
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line('Total Sal:'||:test_sal)
    Total Sal:123
    PL/SQL procedure successfully completed
    

    Concerning
    Peter

  • That means the result of 'accuracy '?

    Hello

    I created a test exercise - everything is done with scored click boxes, etc - and when I tested it, I got a note of 'precision' of 22%, although I had all the answers right.

    Can someone tell me what the ranking?  Thank you...

    Normally, the accuracy is the percentage score. So, if you create a quiz with point Total = 40, the Score will give you the result in points, p.e. 36 (out of 40) and precision returns the percentage calculated (in this example, 90%). So far I never had problems with this result, but I always publish a LMS and checked the individual results on the various issues. I prefer even the percentage return (in this case, accuracy) of the LMS. I don't know exactly what happened with you. How did you test? Was it after publication?

  • Paid the required version for functions that eliminate the details and sensitive information?

    We have downloaded version 11 of Acrobat and we need to remove sensitive information such as the details of the property and anything else relating to the documents that we do not want the end user to see. I know that it is possible to right click the icon of the Office for the paper, but with the help of this process does not remove completely all the information that we want to. I just watch the tutorial on how to remove sensitive information by using the function 'protection' (writing), but I don't see the same list of options on my version of acrobat. My guess is that these features are available on the paid version. Is this the case? Also, is it possible to set up acrobat so that by default, all of the sensitive information in the document and icon properties are deleted? We find that if we create a Word document and remove the icon properties and any other sensitive information, to remove that info again on saving in PDF format. The PDF file displays the info we do not want to send and I have tried different methods to remove the icon properties, but he seems to have no effect. Thank you for your help.

    The writing tool is only available with the professional version of Acrobat.

  • ASCIISTR function that gives different results

    Hi Experts,

    I use the function ASCIISTR and it gives different results in SQLPLUS and TOAD

    SQLPLUS
    SQL> SELECT ASCIISTR('é') UC FROM DUAL
      2  ;
    
    UC
    -----
    \201A
    
    SQL> SELECT ASCIISTR('ú') UC FROM DUAL;
    
    UC
    -----
    \00A3
    TOAD
    SELECT ASCIISTR('ú') UC FROM DUAL
    
    \00FA
    
    SELECT ASCIISTR('é') UC FROM DUAL
    
    \00E9
    I know experts here will be reluctant to respond to questions about the TOAD, but I wanted to understand if I'm missing something. I checked the NLS_SESSION_PARAMETERS in SQLPLUS and TOAD, and they are the same. :-(does not understand this behavior

    Version of database Oracle Database * 10g Enterprise Edition Release 10.2.0.3.0 - 64 bit Production *.

    Thanks in advance!

    The default code for the command line page is 437, identical to TOAD, you want to get the code page 1252

    SQL> host chcp
    Active code page: 437
    
    SQL> SELECT ASCIISTR('é') UC FROM DUAL;
    
    UC
    _____
    \201A
    
    SQL> host chcp 1252
    Active code page: 1252
    
    SQL> SELECT ASCIISTR('é') UC FROM DUAL;
    
    UC
    _____
    \00E9
    
    SQL>
    

Maybe you are looking for

  • The FRU for the LSI 9260-8i cable?

    Recently, I got the LSI 9260-8i on a D20. I need to find number of RUF for cable of Lenovo, who will work on this map? Parts catalog descriptions are very vague. I don't know what to order. Can someone help me. If I can buy it. The Raid on the MB con

  • ISmart DVB - T USB2.0 receiver

    Hallo zusammen. Mein DVB - T Digital video Broadcasting Stick following Fehler portiek: DVB - T receiver iSmart USB2.0 players beim start of TNT participations message: 'The capture device failure.' Hat schon someone sharps ohne similar problem mit d

  • SonicWALL ESA4300 control center political filtering

    Dear all, I created a strategy of blocking the user on the NSA4300 policy & compliance - past-filter - add a new filter If the conditions = all these conditions are met Select to/CC/BCC Match = contains, value of research: [email protected] Action = boun

  • Remove the AutoPlay list devices

    When I moved to Vista I tried to install all my printers, scanners, etc.  I then found that HP has not released drivers for my scanner 5300C so I have to installed software.  However, it remains on my list of devices autoplay ina he's its forms - sca

  • Scanning Image

    Hello!  I M177fw MFP and have loaded the print more up-to-date driver.  I have the icon of HP scanning on my dashboard.  But when I click on the option button to scan a document, all I get is the top of the right hand blew up most of a document.  Als