This Query IS giving divide by zero error when executed in sql plus

UPDATE grn G
SET g.OPT_WA_FAIR_VAL_A = (SELECT
ROUND(SUM(NVL(ga.OPT_FAIR_VAL_A, 0) * NVL(gvs.GRN_VEST_OPT_Q, 0)) / SUM(NVL(gvs.GRN_VEST_OPT_Q, 0)), 6)
FROM
GRANT_VESTING_SCHEDULE gvs,
GRANT_ASSUMPTION ga
WHERE
gvs.ORG_GRP_I = ga.ORG_GRP_I AND
gvs.grn_n = ga.grn_n AND
ga.ORG_GRP_I = g.ORG_GRP_I AND
ga.GRN_N = g.GRN_N AND
NVL(ga.GRN_ASMPN_EFF_D, gvs.grn_vest_d) <= gvs.grn_vest_d AND
NVL(ga.GRN_ASMPN_END_D, gvs.grn_vest_d) >= gvs.grn_vest_d
WHERE G.ORG_GRP_I =5
Any suggestions

hi
What should be result if divide by zero e.g
SQL> SELECT * FROM emp;
    EMPNO ENAME        JOB             MGR HIREDATE        SAL      COMM    DEPTNO
     7901 SMITH        CLERK          7902 17-DEC-80         0         0        20
     7499 ALLEN        SALESMAN       7698 20-FEB-81      2100      1800        30
     7521 WARD         SALESMAN       7698 22-FEB-81      2300      2000        30
     7566 JONES        MANAGER        7839 02-APR-81      1000      3000        20
     7654 MARTIN       SALESMAN       7698 28-SEP-81      3200       700        30
     7698 BLAKE        MANAGER        7839 01-MAY-81      1000      3000        30
     7782 CLARK        MANAGER        7839 09-JUN-81      1000      3000        10
     7788 SCOTT        ANALYST        7566 19-APR-87      1000      1900        20
     7839 KING         PRESIDENT           17-NOV-81      1000      1700        10
     7844 TURNER       SALESMAN       7698 08-SEP-81      1800       700        30
     7876 ADAMS        CLERK          7788 23-MAY-87      1000      1300        20
     7900 JAMES        MANAGER        7698 03-DEC-81      1000      3000        30
     7902 FORD         ANALYST        7566 03-DEC-81      1000      2000        20
13 rows selected.
SQL> SELECT sal/DECODE(comm,0,1,comm) FROM emp;
SAL/DECODE(COMM,0,1,COMM)
                        0
                1.1666667
                     1.15
                .33333333
                4.5714286
                .33333333
                .33333333
                .52631579
                .58823529
                2.5714286
                .76923077
                .33333333
                       .5
13 rows selected.Khurram

Similar Messages

  • Error when connecting to SQL*PLUS via ODBC to Excel

    OS: Windows 2000 Professional
    Oracle DB: 9i release 2
    SQL*Plus: Release 9.2.0.1.0
    MS Excel: 2000
    ===================
    When I try to connect to SQL*PLUS via ODBC to Excel with "connect scott/tiger@odbc:libro" I get the following error:
    ORA-03121: no interface driver connected - function not performed

    SQL Server objects are commonly case sensitive, so please surround the column and table names by double quotes:
    SELECT "Type_PK_ID" FROM "dbo"."boundaries"@sqlserver
    SIDE NOTE: Oracle is by default not case sensitive and all object names are stored in upper case. To get case sensitive objects they need to be surrounded by double quotes. In HSODBC case sensitive table names were commonly found even when not surrounded by double quotes as the gateway used internal SQL Server methods to find the correct table nameing - this method does not work for column names. So to be able to query a case sensitive column it needs to be surrounded by double quotes and the table name must be written as stored in the source database.

  • Script having Chinese characters throws error when run from SQL PLUS

    Dear All,
    I have a script file(.sql) which contains Chinese characters ....
    I have saved the file in unicode Format.
    When I run this file using @D:\filename from SQL PLUS it throws an error "unknown Command at line 1"...
    My database is Oracle 10g...
    Can anyone suggest anything???
    Thanks In Advance
    Dev
    Edited by: Devarsh on Oct 21, 2009 8:16 AM

    I think you may need to set your local NLS_LANG setting for your client (SQL*Plus) to recognize the characters.
    You may also consider posting your question on the Globalization forum which pertains more to these types of questions.
    Globalization Support

  • ORA-12154 error when logging into SQL*Plus

    I installed Oracle 10g (10.2.0.3.0) server on a Hyper-V virtual machine running Windows Server 2008 Enterprise as a standalone server. I did a software only install and then ran the Database Configuration Assistant to create a database. I also ran the Oracle Net Configuration Assistant to configure the Listener, Naming Methods, and Local Net Service Name. I ran the test in the Net Configuration Assistant and it was successful after I changed the login credentials to use the SYSTEM account and password. TNSPING of the net service name is successful. I can also successfully connect to the database via Enterprise Manager using the SYSTEM account and password. What I can NOT do is connect locally to the database via SQL*Plus (either through the gui or command line). I get the following error:
    ERROR:
    ORA-12154: TNS: Could not resolve the connect identifier specified
    I've checked and double-checked the LISTENER.ORA, SQLNET.ORA, and TNSNAMES.ORA files. They all seem correct to me, especially since I used the configuration assistants to create them.
    Anyone have an idea what might be wrong or what I can check next? Any help would be appreciated!
    Thanks!

    They all seem correct to me, especially since I used the configuration assistants to create them. Garbage In, Garbage Out.
    Since Oracle throws an error, I strongly suspect you are mistaken.
    Simply put, you are using something like "@REMOTE" someplace & somehow and the error indicates SQL*Net does not know to what @REMOTE refers.
    How many systems are involved, names, OS version, etc?
    post connection string & post contents of tnsnames.ora file.

  • Update Rules : Divide by zero error

    Hi All,
    I am calculating Condition Rate for billing using formula KWERT/FKIMG i.e. amount/quantity. Its giving me divide by zero error when FKIMG = 0.
    Can we prevent division by 0 error like we can do it in query formula uding NDIV0.
    Thanks
    PB

    Hi,
    you can write routine to avoid the error.
    if quantity <> 0.
      conditon rate = amount /quantity
    else
      conditon rate = space or zero (according to your requirement)
    endif.
    Message was edited by:
            Siva Chidambaram

  • Divide by zero error encountered

    Dear All,
    When our customer process PO, they got an error like below:
    Divide by zero error encountered. Tax definition [ovcg]
    They also got Divide by zero error encountered. Outgoing payments  [ovpm]
    They can process their business but we need to know why and how to fix this error for them.
    Any idea? Thanks.
    Regards,
    Yuka

    Hi,
    You need to check the FMS defined on the row level of the document you want to add.
    Remove the FMS and you will not get the error message reported.
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Arithmetic Overflow/Underflow and Divide by Zero Errors

    We're having problems similar to those posted below (see links), especially "Help: Divide by Zero Errors" to which no one has addressed. <br /><br />Here's our situation: On our form, we have two columns that sum the rows above them, called<br /><br />"covertotal" and "multtotal"<br /><br />...for which we need a final calculation: multtotal/covertotal<br /><br />Under calcutions in FormCalc, we have generated the following formula for the box called "prevtotal" under the calculate command: <br /><br />(multtotal / covertotal)<br /><br />However, since this calculation runs when the document is opened, we get a divide by zero error. Do we need to create an initialize or calculate formula to correct for this zero? If so, what is the proper coding.<br /><br />Please spell this out, we're that stupid... <sigh><br /><br />Thanks!<br /><br />Matthew<br /><br />Previous posts with similar problems are linked below:<br /><br />Help: Divide by Zero Errors<br /><a href="/cgi-bin/webx?14@@.3bbd2077">Harry Kontos, "Help: Divide by Zero Errors" #, 6 Nov 2005 10:01 pm</a><br /><br />calculations overflow/underflow<br />http://www.adobeforums.com/cgi-bin/webx/.3bbeb7e0<br /><br />FormCalc error-arithmetic overflow/underflow<br />http://www.adobeforums.com/cgi-bin/webx/.3bbc15f3

    Your error message indicates your script is being executed as FormCalc, not JavaScript.
    If you're using FormCalc try using an If statment to test for zero/null.
    if (tr>0) then (ac/tr)*100 endif

  • Roxio "divide by zero" error

    I have printed a dozen or so DVDs using my HP 5200 series printer and the same ink-jet printable DVDs that I'm now trying to print to.  Now when I try to print I am getting a "divide by zero" error message and the software locks up.  The only way to regain control of the computer is touse task manager to shut the Roxio software down.  After restarting several times with same results I uninstalled/reinstalled the software from the HP installation CD and still am getting the error.
    First question is if someone has found a fix.  Second question is of someone has found good software for printing to discs usint the 5200 series printers.  I'm not satisfied with the Roxio product and certainly won't upgrade from the free version if I can't get it working.  I have Nero 7 but I don't believe it will work for printint directly to disc using the 5200 series printers.

    i'm having the exact same problem with the labeling software..... i would greatly appreciate an answer to this spoof-auf. i'm using 3.2.1.28 express  .... 

  • Divided by zero error

    All,
    I am having trouble with one of the reports in EBS.
    When I run the two underlying sql of the report in toad I get the data.
    But, when I ran the report from the application I was getting some oracle error.
    So, I ran the report directly from the reports builder to see what error I am getting.
    It turns out that I am getting divided by zero error.
    I am passing in the org id and gl dates an inputs the report.
    Please help me debug the report.

    Could you check if your report has any subquery that doesn't return any record when the parameters are submitted at run time.
    I had the issue in Crystal Reports where it threw a divide by 0 error.

  • SQL to avoid Dreaded "Divide by Zero" error

    Hey,
    I have been banging my head off the decode and NVL functions to avoid the divide by zero error, can tfor the life of me get it.
    2 columns, a & b.
    Need to get: a/b (but the whole thing fails if either is null or zero)
    Any help greatly appreciated.
    Dob

    VG2 wrote:
    You need something like
    decode( b, 0, to_number(null),
    b, null, to_number(null),
    a/b )What is that?
    in psuedo language with that statement you are saying...
    If b is zero then return to_number(null) (which is the same as null) else
    if b is null then to_number(null) (which is still null) else
    a/b
    surely it's just a case of saying
    nvl(a,0)/nvl(b,1)which assumes that if b is null it should not effect a and if a is null then the result should be zero.

  • Help: Divide by Zero Errors

    Hi, can someone please advise me on how to avoid script failure alerts (like the one below), which are generated because certain calculations are being performed before any positive value has yet been set in a numeric field?
    Here is an example of the calculation:
    --- form1.SF_CalculationTable.acview[0]::calculate - (FormCalc, client) --
    (ac[0] / tr[0]) * 100
    Error example:
    Script failed (language is formcalc; context is
    xfa[0].form[0].form1[0].SF_CalculationTable[0].acview[0])
    script=(ac[0] / tr[0]) * 100
    Error: arithmetic over/underflow.
    update: it appears these erros are "divide by zero" errors.
    So my questions are,
    (1) would I put any javascript (to override the zeros) on the "validate" event or the "calculate" event, and on which of the three fields in question, acview[0] (the result), tr[0] (the denominator) or ac[0] (the numerator). and...
    (2) What might that javascript look like?
    Harry

    Your error message indicates your script is being executed as FormCalc, not JavaScript.
    If you're using FormCalc try using an If statment to test for zero/null.
    if (tr>0) then (ac/tr)*100 endif

  • Error when executing query without passing variable selection

    Hi Gurus
    I am getting an error while executing a query with out passing values for variables
    When executing the query by passing the filter values report returns the data
    When executing the query with out passing variable selections the error message is
    Unknown error in SQL interface
    Error reading the data of Info Provider ZCRM_O08
    Error while reading data; navigation possible
    System error in program SSAPLRS_EXCEPTION and form
    RS_EXCEPTION_TO_MESSAGE
    No Data Available
    can any one please help me in resolving this
    Thank you

    Hi Srini
    Thanks for your quick response
    When i am executing the query with selection it is returning the data
    giving error when executing with out passing the selection
    is there any other cause for this problem
    like any particular info object causes this sort of problem
    Thank you

  • ORA-29902 Error when executing context query

    We sometimes get the following error when executing a search based on keywords entered by a user:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Error generating context stmt ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: interMedia Text error: DRG-50901: text query <HR></BLOCKQUOTE>
    A demonstration of the error can be seen by going to the main
    http://technet.oracle.com technet page and then performing a site search. Type in any of the following search phrases:
    Oracle and not Microsoft
    not Microsoft
    and database
    In my brief experimentation, the presence of any of
    not, and, or
    at the beginning of the keywords, or next to each other 'and not' within the keywords set causes the above oracle error.
    OK, I could train the users not to do this, but with the potential for every net user on the planet using my site, it might take me some time to speak to all of them.
    So how do I stop Intermedia from throwing up the error? I have written a quick parser to try to strip out offending entries, but that is not, imho, a good solution, as I do not know all the rules that will break it.
    tia

    You need to write a text query parser. Check the Query Translator code samples from http://technet.oracle.com/sample_code/products/text/content.html

  • TS3297 My 2nd generation ipod touch is giving me the following error when I try accessing Itunes or the app store. "Cannot connect to the Store. A secure connection could not be established. Please check your date & time settings"  I am on a secure networ

    My 2nd generation ipod touch is giving me the following error when I try accessing Itunes or the app store. "Cannot connect to the Store. A secure connection could not be established. Please check your date & time settings"  I am on a secure networkl.

    Can't connect to the iTunes Store
    Make sure that time zone is correct in addition to date and time

  • Error when executing statement for table/stored proc

    Hi All,
          I am getting this error when executing IDOC to JDBC (Stored Procedure) Scenario.
         In my stored procedure I have three insert statements to insert rows in to 3 tables.
        This stored procedure is working fine for two insert statements i.e, 
             For this I have created data type for stored procedure with 10 elements and executed the scenario and was successfully running.
        when I added 3rd insert statement to stored procedure ie., when i added 5 more elements to the datatype (totally 15 elements) it starts giving the bellow error in Message Monitoring.
    <i><b>Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
    <i><b>Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
       Note:- I have run the stored procedure  with three insert statements in Sql Server, and also by calling an external program also, and was working fine.
    <i><b> Note : Is there any structure needs to be follow when working with IDOC to Stored procedure.</b></i>
    I am struck up with the error, can any body resolve this issue.
    Thanks in Advance,
    Murthy

    Hi narasimha,
                      This seems to be any error due to incorrect query formation.In your receiver jdbc channel set the parameter logSQLstatement = true.you can find this parameter in the advanced mode. Using this parameter you will be able to see the sql query which is generated at runtime in the audit log in RWB.
    Regards,
    Pragati

Maybe you are looking for

  • How to Avoid blank page in SAP Script

    I am working on a Script. My Script prints a check. This script is a copy of a std script. It has 3 pages - First Next Last My First page has all the required data. My second page is empty with out any values. I am getting the blank page as Page 2 wh

  • Cloud Service: Powershell Error while waiting for Role to Start

    Hi, I have the below code when trying the deploy a cloud service with Powershell using New-AzureDeployment. How can i get over this. This happens every once in say five instance of deployment. System.Net.Http.HttpRequestException: An error occurred w

  • [solved] can't get printer to work. HP deskjet 710c

    i follow this guide from the wiki: http://wiki.archlinux.org/index.php/CUPS_Setup i have installed cups and ghostscript. also i have installed, foomatic-filters, hplip i also download from here http://www.linuxprinting.org/show_print - skJet_710C the

  • Save As in Acrobat DC Mobile App [Android]

    Is there a way to Save As on the Android version of Acrobat DC? I've played around with the software a bit and can't seem to find this feature anywhere. I've found that you can rename a file, but then the original file is replaced with the renamed ve

  • Help: Case statement Error

    Hello Folks, Am trying to execute a procedure but somehow its returning an error near the case statement.I am thinking whether i have written it correctly or not. Can anyone please advice.Am just posting that specific part of the code where it points