Divisor is equal to zero in date function

Hi
I have used a query like this but am getting error like divisor is equal to zero
with s_mon as (select to_char(add_months(trunc(sysdate,'rr'),level-1),'Mon-RR') month from dual connect by level <=12)
select s_mon.month,
tgdate
from abc ,s_mon
where to_char(tgdate(+),'Mon-RR')=s_mon.month
Result should be like this
month tgtdate
jan-12 01-01-12
feb-12 05-02-12
mar-12
apr-12
dec-12
Edited by: vishnu prakash on 27-May-2012 00:32

Vishnu,
I did not get any error for the below statements; Does this not match with yours? If not, then please post your table structure, data and the exact query in which you are facing error.
drop table test_table;
create table test_table (pk_col number, col date);
insert into Test_table values (3, to_date('MAY-2012', 'MON-RR'));
insert into Test_table values (4, to_date('DEC-2012', 'MON-RR'));
select * from test_table;
with t as
  select to_char(add_months(trunc(sysdate, 'rr'), level - 1), 'MON-RR') month
    from dual
  connect by level <= 12
select b.month, a.col
  from test_table a,
       t b
where to_char(a.col(+), 'MON-RR') = b.month
MONTH     COL
APR-12     
AUG-12     
DEC-12     01-DEC-12
FEB-12     
JAN-12     
JUL-12     
JUN-12     
MAR-12     
MAY-12     01-MAY-12
NOV-12     
OCT-12     
SEP-12     Regards,
P.

Similar Messages

  • HP QUERY DATA ERROR((SQLER=ORA01476 divisor is equal to zero

    Experts,
    We are seeing the following error in Inventory Optimization Horizontal Plan
    HP QUERY DATA ERROR((SQLER=ORA01476 divisor is equal to zero
    Navigation
    Sign on as Inventory Planner responsibility, Inventory Plan > Workbench
    Select the plan owning org, so you can see all orgs.
    View by organizations
    Select org: <Org Code>
    Select Category <category>,
    item <Item name
    Right click, select Horizontal Plan > Default
    Can you help please.

    Well the easiest way to troubleshoot this problem would be to find the row where FBASEVOLTAGE = 0. Something like this maybe:
    SELECT BV.FBASEVOLTAGE
         , FB.FMAGNITUDE_RESULT
         , BS.IUBUSNO
    FROM                       GN
    JOIN                       GM ON  GM.IELEMENT_MAP_ID  = GN.IELEMENT_MAP_ID
    JOIN                       BS ON  GM.NPS_ELEMENT_ID   = BS.IUBUSID
                                  AND GM.NPS_ELEMENT_TYPE = 101
    JOIN   CONFIG_BASE_VOLTAGE BV ON  BS.IBASEVOLTAGEID   = BV.IBASEVOLTAGEID
    JOIN   FACT_BUS            FB ON  FB.IBUS_NO          = BS.IUBUSID
                                  AND FB.IPS_CASE_ID      = GN.IPS_CASE_ID
    WHERE BV.FBASEVOLTAGE = 0
    AND   GN.IPS_CASE_ID  = 1637
    ;

  • ORA-01476: divisor is equal to zero Error in tabular form

    Hello,
    My tabular form will give me this error sometimes: Error in add row internal routine: ORA-01476: divisor is equal to zero. I don't understand what causes it. On the form I have a on load - before header process that will add 5 blank rows automatically, which was wizard generated. This error doesn't always happen, when I turn off this process and then turn it back on it works fine. Currently I have to set the condition to never, so I don't get the error. Is this a bug with Apex?
    Also, when there is data available I have to click on the next arrow for the data to display.
    Please advise.
    Thanks,
    Mary
    Edited by: MaryM on Feb 26, 2010 9:49 AM
    Edited by: MaryM on Mar 2, 2010 11:16 AM

    Hello,
    I have the same error message for ADD ROWS in tabular form. It is also happens when I try to open one empty record using On Load when page rendered. Have you found a fix for that ?
    Thanks,
    Marina

  • Divisor is equal to zero error

    Hi, I am getting divisor is equal to zero error while doing a calculation using sql. Is there a workaround this ?
    Thanks

    What do you want to do, if the divisor is 0?
    Is the SQL executed in SqlPlus or in a procedure/function?
    Hi, I am getting divisor is equal to zero error while doing a calculation using sql. Is there a workaround this ?
    Thanks

  • BI Report Error:ORA-01476: divisor is equal to zero

    I have written the Query containing the Pl/SQL procedures and is working fine when executed ,but when I am using the same query for the BI Publisher report , in the Runtime the report is giving error *"ORA-01476: divisor is equal to zero"* .
    Please provide me with the answers and help ,as it is most important for me to get it solved.

    Hi,
    Try this...
    case when nvl(Y,0) = 0 then 0 else (X/Y) end
    Replace your columns in place of X and Y in your query..
    hope helps you....
    Cheers,
    Aravind

  • Divisor is equal to zero......Help...plz

    Hi all.
    I tried to get a tablespace and fragmentation information with blow script.
    But I got an error(ORA-1476 : divisor is equal to zero)
    How can I fix the script properly ?
    Could anybody help me to fix the script?
    Thanks in advance.
    select tablespace_name,sum(obj_cnt) object_count,sum(ini_ext) init_ext,sum(nex_ex
    t) next_ext,sum(byte)/1048576 bytesize,
    (sum(byte)/1048576)- (sum(fbyte)/1048576) byteused,sum(fbyte)/1048576 bytefree,
    sum(frags), sum(largest)/1048576 avail,
    (sum(fbyte)/sum(byte))*100 free
    from (select tablespace_name,0 obj_cnt,0 ini_ext,0 nex_ext, 0 byte, sum(bytes) fb
    yte, count(*) frags, max(bytes) largest
    from dba_free_space
    group by tablespace_name
    union
    select tablespace_name,0, 0, 0, sum(bytes), 0, 0, 0 from dba_data_files
    group by tablespace_name
    union
    select tablespace_name, 0, initial_extent/1024 ini_ext, next_extent/1024 nex_ext,
    0,0,0,0
    from dba_tablespaces
    union
    select tablespace_name, count(*) obj_cnt, 0, 0, 0, 0, 0, 0
    from dba_segments
    group by tablespace_name)
    group by tablespace_name

    The various NVL and DECODE solutions may get rid of the error, but will not get you the correct answer. By the way, you may want to look at the differences in behaviour between
    (sum(fbyte)/decode(sum(byte),0,NULL))*100 free and
    (sum(fbyte)/decode(sum(byte),0,1))*100 free before you use either.
    Your real problem is that you have a temp tablespace using temporary files. This is the right thing to do, but, you need another union in your statement, to access dba_temp_files:
    SELECT tablespace_name,SUM(obj_cnt) object_count,
           SUM(ini_ext) init_ext, SUM(nex_ext) next_ext,
           SUM(byte)/1048576 bytesize,
           (SUM(byte)/1048576)- (SUM(fbyte)/1048576) byteused,
           SUM(fbyte)/1048576 bytefree, SUM(frags), SUM(largest)/1048576 avail,
           (SUM(fbyte)/SUM(byte))*100 free
    FROM (SELECT tablespace_name, 0 obj_cnt, 0 ini_ext, 0 nex_ext, 0 byte,
                 SUM(bytes) fbyte, COUNT(*) frags, MAX(bytes) largest
          FROM dba_free_space
          GROUP BY tablespace_name
          UNION ALL
          SELECT tablespace_name,0, 0, 0, sum(bytes), 0, 0, 0
          FROM dba_data_files
          GROUP BY tablespace_name
          UNION ALL
          SELECT tablespace_name,0, 0, 0, sum(bytes), 0, 0, 0
    FROM dba_temp_files
    GROUP BY tablespace_name
          UNION ALL
          SELECT tablespace_name, 0, initial_extent/1024 ini_ext,
                 next_extent/1024 nex_ext, 0,0,0,0
          FROM dba_tablespaces
          UNION ALL
          SELECT tablespace_name, COUNT(*) obj_cnt, 0, 0, 0, 0, 0, 0
          FROM dba_segments
          GROUP BY tablespace_name)
    GROUP BY tablespace_nameYou should also use UNION ALL instead of UNION, because UNION implies a sort distinct, whil union all does not. The sort is unneccessary, and the distinct may cause you to lose rows.
    TTFn
    John

  • How can i resolve divisor is equal to zero

    hi,
    i have the situation like i am calculating the column values. in that one field divided by other. but in that divisor field have zero. for that it's giving the error.
    please help to do so...
    example: select 8/o from dual;
    error: ora-01476divisor equal to zero

    indra wrote:
    i have the situation like i am calculating the column values. in that one field divided by other. but in that divisor field have zero. for that it's giving the error.Either exclude it by adding:
    divisor != 0to WHERE clause or use:
    CASE divisor
      WHEN 0 THEN whatever_result_you_want_for_zero_divisor
      ELSE divident / divisor
    ENDSY.
    Edited by: Solomon Yakobson on Sep 19, 2011 6:47 AM

  • Error in add row internal routine: ORA-01476: divisor is equal to zero

    Hi,
    I am using Tabular Form Report in my application. So, when the user enters the page for the first time, no fields appear (if he has previously not entered any values in the DB). So to avoid this I added a Data Manipulation process-> Add rows to tabular Form ->On load after footer, so that when the user logins whether he entered previous values or not, he can see some empty fields, but this is not working as expected.
    Any ideas how to resolve this issue.

    Hmm other people have had this errorm found this hope it helps,
    Hi,
    Have a look at: Re: Add Row in detail table when check box is checked on a master report table as this shows how you can use javascript to clone a row

  • Ora-01476 divisor is equal to zero

    hi!
    ROUND(SUM(VALOR_VDA) / SUM(DECODE(QTDE_VDA,0,1,QTDE_VDA)),2)
    Oracle 10.2.0.1.0
    Red Hat Enterprise 5

    is this QTDE_VDA field numeric
    The only issues here with the decode is see is if the total value of all the rows when summed is 0 - zero then you will have zero-divide error
    SS
    Message was edited by:
    user478316

  • ORA-01476: divisor equal to zero

    When I try to run this query I get error 'ORA-01476: divisor equal to zero'. How can I write the query so it understand that it not should use Sum(SalesQuantity)=0 And Sum(Net_Sales)=0 in the Case?
    SELECT year_month, customer,
    (Sum(Case When record_type NOT IN ('B', 'E') And NET_SALES <> '0' Then NET_SALES Else Null End)/
    Sum(Case When record_type NOT IN ('R', 'P') And SALES_QUANTITY <> '0' Then SALES_QUANTITY Else Null End)) As Test
    Where Period_date Between to_date('2007-01-01','yyyy-mm-dd') And to_date('2007-09-30','yyyy-mm-dd')
    FROM tbltest
    Group By year_month, customer

    I generally use
    whatever / NULLIF(expression, 0)Message was edited by:
    William Robertson

  • How can I set my y-intercept (b) equal to zero retina macbook 2014

    Hello everyone,
    I hope you can reply to my question before 11:55p.m. today because that is when my report is due. I graphed my scatter plot and got my trend line, but my professor wants the class to set the y-intercept, the (b) from y=mx+b to zero. Can you guide me step by step on how to do that? I tried clicking on the Data section, then x-value, typed zero, but my graph disappeared. I am supposed to be using Excel for this, but I only have numbers. Can you set the y-int equal to zero using Numbers as well?

    Hi Theonlymary,
    The LINEST function returns an array of the statistics for a straight line that best fits the given data using the least squares method.
    LINEST(known-y-values, known-x-values, nonzero-y-intercept, more-stats)
    Type = in a spare cell to bring up the Function Panel. Type LINEST in the search box to see help on that function.
    I don't use LINEST but it seems you can get extra stats from an array that it returns.
    It won't change your graph (it doesn't  need a graph).
    Regards,
    Ian.

  • Disk Utility: Differences between "Zero Out Data" and "7-Pass Erase"?

    I'm wondering if anyone knows if there's a significant difference between the "Zero Out Data" erase option in Disk Utility (specifically Disk Utility 10.5.5), and the "7-Pass Erase" and "35-Pass Erase" options in same software.
    Here's why I'm asking: I have a co-worker with an iMac G5 20" 1.8GHz with 160GB internal hard drive. As a result of the power supply overheating a week ago due to dust, some hard drive problems resulted. I'm trying to assess whether these are 'soft' formatting problems that can be recovered from, or 'hard' problems requiring replacement of the hard drive and/or power supply.
    Following the failure, I removed the dust and restored the iMac to servicable form. The power supply seems to be OK now. The next thing was to attempt to recover as much data as possible from the 160GB, as the last full backup was a week old. Carbon Copy Cloner, shell copy via 'sudo cp -p -R -v', Finder copy, and DiskWarrior recovery all met with problems. TechTool Pro identified a huge swatch of unreadable sectors during repeated surface scans. Unfortunately, these unreadable sectors were located midway in the OSX boot partition (an 80GB partition), and not in the other 80GB partition devoted to lower priority video data.
    When I was satisfied I had backed up the data to the best of my abilities, I next set out to reformat the drive and see if the bad sectors could be eliminated or remapped out of existence. I did a "Zero Out Data" erasure in Disk Utility (with no errors during the erase), but TechTool Pro showed the bad sectors persisted in equal strength at the same location. I next executed a sixteen hour "7-Pass Erase" (again no errors, and confirming that it takes about an hour per 10GB). The next day when I ran TechTool pro, all of the sector errors had disappeared. I'm a bit perplexed as to why the "7-Pass Erase" seems to have recovered the use of the drive. Is it possible that there are simply thousands of bad sectors now remapped that I'm not seeing? [If so, how do I check for this?] TechTool Pro has not reported any S.M.A.R.T. issues to date on the drive. What am I to make of that?
    There are some related threads I've checked into, but I'm not sure how to properly assess my situation based on this information:
    <http://discussions.apple.com/thread.jspa?threadID=232007>
    <http://discussions.apple.com/thread.jspa?threadID=138559>
    <http://discussions.apple.com/thread.jspa?threadID=118455>
    Since the iMac has three weeks left on it's one year warranty, and I've already moved the user to another machine temporarily, I'm thinking that the smart thing to so is to send it in to Apple to have them look at the power supply and hard drive. That way, when it returns, even if there is still a lingering hardware problem, at least it will be covered under warranty for another 90 days.
    Any thoughts?
    iMac G5 20" 1.8GHz   Mac OS X (10.4.6)   1.25GB RAM, 160GB hard disk, SuperDrive

    HI, Bret.
    The only differences between "Zero Out Data", "7-Pass Erase", and "35-Pass Erase" are the number of times a binary zero is written to every bit on the disk. "Zero Out Data" writes a binary zero once, whereas the 7- and 35-Pass options write a zero seven and 35 times, respectively.
    Technically, one pass with Zero Out Data should be sufficient to map bad sectors out of service, a process also known as sparing. If a bad sector is encountered, it is both marked as "in use" in the directory's allocation table and added to the directory's "bad blocks file."
    My understanding is that the Surface Scan of Tech Tool Pro should identify bad sectors every time it is run unless the bad sectors have been locked out by the drive controller of the ATA drive itself. This is because Surface Scan checks the entire surface of the disk.
    What may have happened is that running "Zero Out Data" spared the bad blocks from a directory standpoint, but did not result in the drive's controller locking out those sectors for reasons detailed in the "Surface Scan" section of the Tech Tool Pro manual. However, the 7-Pass Erase may have resulted in the drive's controller locking out the bad sectors and why Surface Scan did not pick them up after such.
    Given the problems you described, I concur with your plan to have Apple check the affected computer. You might also want to consider purchasing an AppleCare Protection Plan for that Mac: I recommend and buy these for all my Macs.
    For some additional information on bad sectors, see the "Bad Sectors" section of my "Resolving Disk, Permission, and Cache Corruption" FAQ.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X
    Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Help with Date function in sql query....

    My question I guess is really 2...I'm trying to use the date function as a comparison in my WHERE clause in my sql command.
    1. My date format is dd-MMM-yy eg. (01-Apr-06) ... my problem is the Apr is lower case where my field in the database is 01-APR-06 so when I compare 01-Apr-06 to 01-APR-06 is doesnt find any rows. Is there away that I can make the Apr all upper case so that it is APR.
    2. My second problem is getting this "date" field to work in my sql stmt I keep getting errors and it works fine if I take my attempts at trying to compare the date.
    --------------Date Code----------------------------------------------------------
    <%!
    String getFormattedDate(java.util.Date d)
    SimpleDateFormat simpleDate = new SimpleDateFormat("01-MMM-yy");
    return simpleDate.format(d);
    %>
    <%
    java.util.Date d = new java.util.Date();
    String dateString = getFormattedDate (d);
    %>
    ---------------------------Sql statment------------------------------------------
    ResultSet rset = stmt.executeQuery ("SELECT name " + " FROM table where rdate = '01-APR-06' order by name ");
    Currently Im just hard coding the date but I need to make it so it uses the date code...so....
    rdate should equal the date from the formatted date in upper case
    something like
    rdate = <%= dateString %>
    Thanks in advance for any ideas anyone may have...

    There are sql functions upper & lower.
    SELECT name  FROM table where upper(rdate) = '01-APR-06' order by name Or you could convert the date to a string, and use the toUpperCase & toLowerCase java.lang.String methods. It doesn't make much of a difference--do you want the java compiler to do the string conversion or the database?

  • How to  use data function using characterstics variable for calculation on

    how to  use data function using characterstics variable for calculation on  attribute as key figure

    Hi Gayatri
    Did you not see my answer for CASE because CASE does indeed offer the use of the BETWEEN clause, but DECODE does not. Let me give you a little synopsis of DECODE.
    In its most simple form it takes 4 values and looks like this: DECODE(A, B, C, D)
    This essentially means, IF A = B THEN C ELSE D
    The trick to solving BETWEEN in a DECODE is to work out algoriths where A = B. Because we don't know how many values are between 00 and 99, although I could guess there were 100 we could of course have 100 parts in the DECODE but that would be awful. How about if we look at it another way and say this:
    IF PART_NUMBER < 'SDK00' THEN pay_amount
    ELSE IF PART_NUMBER > 'SDK99' THEN pay_AMOUNT
    ELSE pay_amount + 100
    This statement only had 2 hard coded values, but how to make DECODE work with less than? Easy, we use the LEAST function. The LEAST function takes 2 values and returns the one with the lowest value. So I use LEAST(PART_NUMBER, 'SDK00') then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the opposite function GREATEST. Putting all of this together then, you can do this:
    DECODE(PART_NUMBER, GREATEST(PART_NUMBER, 'SDK00'), DECODE(PART_NUMBER, LEAST(PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)
    In English this can be read as follows:
    IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0
    Best wishes
    Michael

  • Stacked 100% bar chart - Problem with datatips for zero value data points

    I have a stacked 100% bar chart that shows datatips in Flex 4.   However, I don't want it to show datatips for
    data points with zero values.   Flex 4 shows the datatip for a zero value data point on the left side of a bar if the data point is not the first in the series.
    Here's the code that illustrates this problem.    Of particular concern is the July bar.    Because of the zero value data point problem, it's not possible to see the datatip for "aaa".
    Any ideas on how we can hide/remove the datatips for zero value data points ?        Thanks.
    <?xml version="1.0"?>
    <s:Application
    xmlns:fx="
    http://ns.adobe.com/mxml/2009"xmlns:mx="
    library://ns.adobe.com/flex/mx"xmlns:s="
    library://ns.adobe.com/flex/spark"creationComplete="initApp()"
    height="
    1050" width="600">
    <s:layout>
    <s:VerticalLayout/>
    </s:layout>
    <fx:Script><![CDATA[ 
    import mx.collections.ArrayCollection;[
    Bindable] 
    private var yearlyData:ArrayCollection = new ArrayCollection([{month:
    "Aug", a:1, b:10, c:1, d:10, e:0},{month:
    "July", a:1, b:10, c:10, d:10, e:0},{month:
    "June", a:10, b:10, c:10, d:10, e:0},{month:
    "May", a:10, b:10, c:10, d:0, e:10},{month:
    "April", a:10, b:10, c:0, d:10, e:10},{month:
    "March", a:10, b:0, c:10, d:10, e:10},{month:
    "February", a:0, b:10, c:10, d:10, e:10},{month:
    "January", a:10, b:10, c:10, d:10, e:10}]);
    private function initApp():void {}
    ]]>
    </fx:Script>
    <s:Panel title="Stacked Bar Chart - Problems with DataTips for Zero Value Items" id="panel1">
    <s:layout>
    <s:HorizontalLayout/>
    </s:layout>
    <mx:BarChart id="myChart" type="stacked"dataProvider="
    {yearlyData}" showDataTips="true">
    <mx:verticalAxis>
     <mx:CategoryAxis categoryField="month"/>
     </mx:verticalAxis>
     <mx:series>
     <mx:BarSeries
    xField="a"displayName="
    aaa"/>
     <mx:BarSeries
    xField="b"displayName="
    bbb"/>
     <mx:BarSeries
    xField="c"displayName="
    ccc"/>
     <mx:BarSeries
    xField="d"displayName="
    ddd"/>
     <mx:BarSeries
    xField="e"displayName="
    eee"/>
     </mx:series>
     </mx:BarChart>
     <mx:Legend dataProvider="{myChart}"/>
     </s:Panel>
     <s:RichText width="700">
     <s:br></s:br>
     <s:p fontWeight="bold">The problem:</s:p>
     <s:p>Datatips for zero value data points appear on left side of bar (if data point is not the first point in series).</s:p>
     <s:br></s:br>
     <s:p fontWeight="bold">For example:</s:p>
     <s:p>1) For "June", eee = 0, mouse over the left side of the bar to see a datatip for "eee". Not good.</s:p>
     <s:br></s:br>
     <s:p>2) For "July", eee = 0 and aaa = 1, can't see the datatip for "aaa", instead "eee" shows. Real bad.</s:p>
     <s:br></s:br>
     <s:p>3) For "Feb", aaa = 0, datatip for "aaa" (first point) does not show. This is good.</s:p>
     <s:br></s:br>
     <s:p>4) For "Mar", bbb = 0, datatip for "bbb" shows on the left side of the bar. Not good.</s:p>
     <s:br></s:br>
     <s:p fontWeight="bold">Challenge:</s:p>
     <s:p>How can we hide/remove datatips for zero value data points?</s:p>
     <s:br></s:br>
     </s:RichText></s:Application>

    FYI.
    Still have the issue after upgrading to the latest Flex Builder 4.0.1 with SDK 4.1.0 build 16076.   
    Posted this as a bug in the Adobe Flex Bug and Issue Management system.     JIRA
    http://bugs.adobe.com/jira/browse/FLEXDMV-2478
    Which is a clone of a similar issue with Flex 3 ...
    http://bugs.adobe.com/jira/browse/FLEXDMV-1984

Maybe you are looking for