1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

help required

Discussion in 'SQL PL/SQL' started by animeshdubeyad, Jun 26, 2014.

  1. animeshdubeyad

    animeshdubeyad Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    dear friends,
    I am working on squirrel and wrote a query which is like this:

    select
    sum((coalesce((Sent_128),0)))*(365/(count(distinct(date_created))))/(((sum(coalesce((quantity2),0))/(count(distinct(date_created))))+(sum(coalesce((quantity),0))/(count(distinct(date_created)))))/2) as "final"
    from table....

    i am getting error as :


    Error: TEIID30504 Remote org.teiid.core.TeiidProcessingException: TEIID30504 dwhSOU: 0 TEIID11008:FEHLER: Division durch Null:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT ((SUM(coalesce(g_0."sent_128", 0)) * cast((365 / COUNT(DISTINCT g_0."date_created")) AS bigint)) / (((SUM(coalesce(g_0."quantity2", 0)) / cast(COUNT(DISTINCT g_0."date_created") AS bigint)) + (SUM(coalesce(g_0."quantity", 0)) / cast(COUNT(DISTINCT g_0."date_created") AS bigint))) / 2)) AS "c_0" FROM dwh.mat_table_17799_st113 AS g_0, dwh.mat_table_21359_st2 AS g_1 WHERE g_0."sku" = g_1."supplier_sku" GROUP BY g_0."pop_quantity", g_0."pop_fulfilled_quantity", g_0."returned_512", g_0."quantity", g_0."reserved" LIMIT 100]

    please help me out with the error.
    thanks in advance
     
  2. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
  3. animeshdubeyad

    animeshdubeyad Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    hi the version is:

    SQuirreL SQL Client Version 3.5.2
    Copyright (c) 2001-2014
     
  4. rajenb

    rajenb Forum Expert

    Messages:
    361
    Likes Received:
    114
    Trophy Points:
    655
    Location:
    Mauritius
    Hi,

    Meaning "ERROR: division by zero" (trusting Google Translate from German to English :))...

    Which I suppose is coming from the SQL statement (BTW - that's the reason you posted it in this section as you suspect an issue with the SQL rather than Squirrel itself on which I won't be able to helo you at all !).

    The portion of the expression:

    must be bringing 0 which is provoking this error and this will happen if both "quantity" and "quantity2" are NULL or 0.

    Please check the data in your table.
     
  5. animeshdubeyad

    animeshdubeyad Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    thanks Rajen :)