Need for a function to generate the second neighbor no divisble by 10

Hello

WE need a function or a procedure where given a number as a parameter, need to generate then the closest number divisble by 10.

For ex receives a number: 3 we must generate 10
given a number 234 need to generate 240.

Kind regards

This does not work with multiples of 10. Use rather CEIL!

SQL>select trunc(3/10)*10+10 from dual;

TRUNC(3/10)*10+10
-----------------
               10

SQL>select trunc(10/10)*10+10 from dual;

TRUNC(10/10)*10+10
------------------
                20

SQL>select ceil(3/10) * 10 from dual;

CEIL(3/10)*10
-------------
           10

SQL>select ceil(10/10) * 10 from dual;

CEIL(10/10)*10
--------------
            10

URS

Tags: Database

Similar Questions

  • Need for a function defined by the user in order to obtain a weighted average

    Hello

    We have a table where we want to device the weighted average for a column of prices below using formula,

    sum (quantity * price) / sum (qty)

    We have a few lines where part or all of the columns that is price or quantity can be NULL.

    We have tried to write the function as follows however, it fills even after 30 minutes, where as we have the addition of this feature request could was completed in 25 seconds.

    Please note that we are dealing with big data i.e. the table could have 50 million records. It has appropriate indexing and other components to improve performance required.

    We know that we did something wrong in the creation of feature below, but we are unable to resolve

    CREATE OR REPLACE FUNCTION "WEIGHTEDAVGPRICE" (PCOLNAME NUMBER( ) RETURN NUMBER

    IS

    TEMP NUMBER (26,13);

    BEGIN

    SELECT SUM (QUANTITY * PCOLNAME) / SUM (QUANTITY) IN TEMP DE FEES;

    RETURN TEMP;

    END WEIGHTEDAVGPRICE;


    Here, we send the parameter THAT PCOLNAME represents the name of the price column we want to do a weighted average.


    We know we could do this without adding a feature, but we need instructions BOX, and then in our SELECT clause. We use toplink to query the database, in this case, it will be difficult to covert.

    Also, we want this function to be used in other places as well.


    Thank you

    @Bhagyesh KNW



    The reason for the decrease in performance when you use the function, you call the function from a query and which is originally a context switch between SQL and PL/SQL engines.  That is known to slow down performance.  If you can only do the task in SQL, you must do so, in order to avoid context switching.

    It would be useful that you provided a few sample data and expected the output, as indicating the version of your database, so that people can understand and help you better.

    Please read:

    Re: 2. How can I ask a question in the forums?

  • prices mp4 wemb of video files, that the TWO needed for a video work in the MUSE?

    prices mp4 wemb of video files, that the TWO needed for a video work in the MUSE?

    Hi TheArthur,

    Now a version more recent days of all browsers support format video mp4 but some older versions of browsers still need to format to play webm video.

    HTML5 video

    So if your analysis says that none of the visitors to your site use these older browsers, so you can skip webm file but where there are users of the site who use the old version of browsers that do not support mp4 then it is advisable to use webm and mp4 videos.

    Concerning

    Vivek

  • Which is the best way for a function called identify the class name of the appellant.

    Which is the best way for a function called identify the class name of the appellant.

    (1) sun.reflect.Reflection using the function call
                    Class caller = Reflection.getCallerClass(2);
                    System.out.println("Caller Class Name ::"+caller.getName());
    Trace of function called battery 2) analysis of current threads
                    StackTraceElement[] stElements=Thread.currentThread().getStackTrace();
                    System.out.println("Caller Class Name ::"+stElements[3].getClassName());
    Y at - it all the other ways to achieve the same. What is the best way?
    Called function does accept no argument, I don't want the arguments of function calling function called t.

    Help, please.

    With greetings
    Paul

    798185 wrote:
    Which is the best way for a function called identify the class name of the appellant.

    Y at - it all the other ways to achieve the same.

    SecurityManager

        // 0 is the anonymous SecurityManager class
        // 1 is this class (also works in static context)
        // 2 is calling class
        static Class getClass(int i) {
            return new SecurityManager() {
                protected Class[] getClassContext() {
                    return super.getClassContext();
                }
            }.getClassContext();} 
    
  • code or function to generate the next date of work for a given date

    Hello

    First lets see the struncture table and the data in the table.
    CREATE TABLE LT_CA_HOLIDAYS
    (
      HOLIDAY_DATE            DATE                  NOT NULL,
      IS_BANK_HOLIDAY         CHAR(1 BYTE)          NOT NULL,
      DISPLAY_NAME            VARCHAR2(35 BYTE)     NOT NULL
    )
    
    
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('12/25/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Christmas Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('01/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'New Years Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('01/17/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Martin Luther King Jr');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('02/21/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Washington s B-Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('05/30/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Memorial');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('07/04/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Independence Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('09/05/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Labor Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('10/10/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Columbus Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('11/11/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Verterans Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('11/24/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Thanksgiving Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('12/25/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Christmas Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('12/26/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Bank Observed Christmas');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('01/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'New Years Day');
    Insert into LT_CA_HOLIDAYS
       (HOLIDAY_DATE, IS_BANK_HOLIDAY, DISPLAY_NAME)
     Values
       (TO_DATE('01/02/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 'Bank Observed New Years Day');
    COMMIT;
    .

    The requirement goes something like this:


    SATURDAY and SUNDAY weekend days ARE considered holidays.

    The list of public holidays are in LT_CA_HOLIDAYS.

    We will give a date as p_processdate.we need to check if the p_processdate is a holiday or a business day,
    If p_processdate is a holiday, so we need to generate the next business day.
    If p_processdate is a day's work, we have to check if p_processdate + 1 is a business day, IF p_processdate + 1 is a holiday then
    We must generate the day following close p_processdate + 1.

    Concerning

    Hi Bro I edited by forum...

    sending correct code

    DECLARE
    
    day_param date:=TO_DATE('07/01/2011','MM/DD/YYYY');
    n_yes number;
    BEGIN
         LOOP
              day_param:=day_param+1;
              select count(*) into n_yes from LT_CA_HOLIDAYS WHERE TO_CHAR(HOLIDAY_DATE,'MM/DD/YYYY')=TO_CHAR(day_param ,'MM/DD/YYYY') ANd IS_BANK_HOLIDAY='Y' ;
              IF(to_char (day_param,'DY') NOT IN ('SAT','SUN')) AND n_yes=0 THEN
                   EXIT;
              END IF;
    
         END LOOP;
         DBMS_output.put_line('output'||day_param);
    END;
    

    output05-JUL-11

  • Need for a function in Excel that will retrieve all members of specific dim

    Hi all
    We are a condition where the user needs to see all members in the menu dropdown in an excel file. Also, the report is a dynamic where the meta data are updated daily. To do this, we want to update metadata on a daily basis as it is reflected also in the drop-down list. Please let us know if there are all the specific features we can incorporate as part of our macro that will provide all members of the specific dimension in a single column. Note that we do not want the user to select anything manually using member selection that everything must be hard-coded.

    Thank you very much
    Krishna

    I am assuming that you are using the Excel Add-In; is that correct?

    I did this in two ways:

    First, use a hidden form and function Spreadsheet Toolkit (i.e. EssVZoomIn) to drill down. You may need to use EssVSetSheetOption to make sure that the appropriate fuse are selected.

    Second (more complicated), functions to use the VB API to write a program to recursively process the dimension and retrieve all members.

    Furthermore, on the question of if the user must interact - unless you go to hardcode a password for Essbase in your code, you may need to the user open a session at some point in the process.

  • My creative application of Cloud let me download apps for a reason any on the second computer?

    Hello! I am very confused because I bought a license as a student a couple of months but want to download these applications on my second computer. When I downloaded the creative application of the Cloud option just says 'try' or 'buy now' no download. Help!

    Your subscription to cloud shows correctly on your account page?

    If you have more than one email, you will be sure that you use the right Adobe ID?

    https://www.adobe.com/account.html for subscriptions on your page from Adobe

    If Yes

    Some general information for a subscription of cloud

    Cloud programs don't use serial... numbers you, connect you to your cloud account paying to download & install & activate... you may need to sign out of the cloud and restart your computer and log into the cloud for things to work

    Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud

    -Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html

    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html

    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html

    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html

    -ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp

    -http://helpx.adobe.com/creative-cloud/kb/license-this-software.html

    If no

    This is an open forum, Adobe support... you need Adobe personnel to help

    Adobe contact information - http://helpx.adobe.com/contact.html

    -Select your product and what you need help with

    -Click on the blue box "still need help? Contact us. "

  • How to use an internal counter of the cDAQ-9172 for measure PWM and generate the frequency?

    Hello

    Requirement of my project is to measure 6-channel PWM and generate 5 frequency channels.

    Suggestion of engineer OR bought cDAQ-9172 chassis and NI 9423 (8 DI correlated) and NI 9474 (8 correlated DO) for this requirement. I have a few questions

    Article:

    1 > what should I know to customize my CompactDaq 9172 chassis

    http://zone.NI.com/DevZone/CDA/tut/p/ID/9367

    I know that this way to synchronize the physical support 32 correlation system pin o for housing 1-4.

    => I'm not really sure how to use these channels synchronization support.

    2 > using internal counters on one NOR cDAQ-9172 as a sample for other tasks clock

    http://digital.NI.com/public.nsf/allkb/ADFC4DD8C9690232862575B70079FBD4

    I know that I can change the ownership of the physical channel so I can get 2 meter outside the frame 6 and 7.

    => I do not think that this solution will be me because I can use only 2 counters with this method.

    Could someone tell me please how to fix my project requirement? How to choose the setting for DAQmx screws?

    I have experience with measure the PWM and generate the frequency, but with separated against only.

    Best regards

    Thang Nguyen

    Hey Thang.

    AHA... for this, you can use the channel property node.

    See you soon

    Lab

  • What is the need for accessors from view at the level of the entities, as well as the view object level?

    Hi all

    What is the need for accessors of the entity and object level view-level view

    I use 11.1.1.7 jdev

    Thank you

    Delphine

    Timo, I think you might have taken the tack wrong here.  As you know EOs can use VO * accessors * (not associations) like your for things like validation entity or object view research

    CM.

  • looking for mixidj when I opened the second tab please help me ive tried everything I know

    My browsers opens OK for fire fox but when I opened a second search of mixi dj tab opens tried AFAIK I don't even find on my computer to uninstall it please help me if you can

    I've used about: config before but never knew it was editable until that time. Thanks for the help.

  • HP-15-af114AU: control keys for brightness (function keys) on the keyboard does work more (f2 and f3)

    Key (F2 and F3) brightness has stopped working suddenly

    I use the laptop HP 15-af114AU (AMD A8 Processor). Running on Windows 10-64 bit

    Its been only 2 weeks, I bought. The brightness of key i, e, f2 and f3 were working, then after a few days, I noticed it wasn't.
    I tried to do it manually through the brightness on the settings option, although there was no change.
    From the moment I bought this laptop, I downloaded SKYPE, Chrome and some THEMES for google Chrome.
    All other funtion keys work except these.
    Please help me with this problem.

    Hello

    Try the following.

    Download the AMD HD graphical installer on the following link and save it in your downloads folder.

    http://ftp.HP.com/pub/SoftPaq/sp74501-75000/sp74716.exe

    One when you're done, open your download folder, click with the right button on the setup of the AMD graphics card and select "Run as Administrator" to launch the installation.

    When this is finished, stop the laptop.

    Disconnect the power adapter and remove the battery.  Press and hold the Power button for 30 seconds.  Reinsert the battery and plug in the AC adapter.

    Robinet tap away at the key esc that you start the computer to launch the Start Menu, and then select f10 to open the bios menu.  Press f9 to load the default values (sometimes it is f5, but the menu below indicates the correct key), use the arrow keys to select 'Yes' and press ENTER.  Press f10 to save the setting and still use the arrow keys to select 'Yes' and press on enter.

    Start Notepad and let Windows take over completely for a few minutes before checking.

    Kind regards

    DP - K

  • Hello!! need for a loop and save the .mov file

    Hello!! I have a .mov file which is 1 sec long and I need to loop and save it as 2mins long. No idea of the first use is even allow me to open the .mov help file!

    > even allow me to open the .mov file

    What is your computer, and what version of quicktime you have installed?

    MOV is a wrapper, which is inside YOUR package - exactly what is on the INSIDE of the video you are editing?

    A report with details of codec your file, use the following programs... A screen capture works well for people to SHOW what you do https://forums.adobe.com/thread/1070933 for screenshot instructions

    Free programs to get information on PC/Mac http://mediaarea.net/en/MediaInfo/Download files

  • The need for multiplexing of files when the separation of disks are on SAN

    Oracle 11 g 2

    Hi all

    I see different opinions/statements concerning the need to multiplex when files (control files, redolog, storage files, etc...) Without (LUN) addressing this issue. Because LUNS are spread you encounter conflicts. If this is true, what is the need to multiplex of files and even separate tablespaces? Why not just have everything on a LUN?

    I appreciate all the answers from the experts.

    Thanks to you all.

    EdStevens wrote:

    It's the same sysadmin who will someday decide he needs to free up space disc of delting files that are not needed .

    Not when you use ASM. And IMO ASM should the first considerations. Must be reasons for NOT using ASM - rather than the reverse.

    Space SAN without high-end are quite expensive - because it is fairly sophisticated ito redundancy, load balancing, performance and all that.

    So if you want to make redundant on the database side, there is a cost impact you need additional LUNs for this. And this must be justified. I bet most of the time you will be not able to the SAN architecture has all these issues covered. And human error is an operational matter that should be handled through operational procedures and control change management - something else that you can argue that every piece of s/w and h/w and infrastructure must be duplicated and triplicated same like a fool can fubar it. And it is not practical or cost-effective. Get rid of the silly instead.

  • HP Pavilion a6000n: no need for replacement motherboard - it's the standard micro ATX?

    I want to upgrade this computer and get a new card mother and CPU. Currently there is a M2N68-LA/NARRATED-GL8E made by Asus for HP. No matter what micro ATX motherboard will work, or that it has an odd size or placement of screw hole or else incompatible?

    Thank you!

    In case anyone is interested, I picked up an ASRock 970 M Pro3 AM3 mATX Motherboard AMD and a 8-core processor from AMD FX 8320E. The motherboard was a little shorter than the origian, then the bottom screw holes align. But it is strong enough and it works fine.

    There, however, no place to plug in the SD card reader, or the front firewire. I do not use firewire, so this isn't a problem, but I'll miss the SD card reader. It's one thing that I forgot to check when looking for motherboards.

  • Need for manual steps to configure the various components of the SF 6.1 on windows 2008 R2 cluster

    I try to install SF 6.1 on windows 2008 R2 cluster. I'm looking for manual steps set up according to

    • How to create the Coordinator disk group and set up the fencing
    • How to create CVM, CFS and resource service
    • Steps to use executable thrash for OI test

    This seems to be a Veritas / Symantec product - best post in their community - Storage Foundation for Windows Forums | Symantec connect

Maybe you are looking for