Convert the formula written in SQL

Our users are having problem with the below formula on Reports. I am not sure what this means. Our Users told that they need
(Tons Used/spread miles) * 2000 lb/ton = lbs/spread mile for their report.
And I see the below formula being used by our developer. Not sure how to read it though. Can any one let me know the formula used in the below code could actually represent the above formula. Users are complainting as below
from user ->column doubles or triples the amount if there are multiple records for the same truck/driver/beat/with the same amount for Dry Mat used and Spread Miles. If spread miles or the Dry Mat used is different if calculates correctly.
SUM (ROUND ((NVL (sim_trip.dry_mat_used, 0)) /
                  nullif(sim_trip.spread_miles_total,0) * 2000, 2 ))
            OVER (PARTITION BY sim_trip.trip_no,   sim_trip.dry_mat_code,        sim_trip.liquid_mat_code,
                               sim_trip.dry_mat_used,      sim_trip.liq_mat_used,         sim_trip.spread_miles_total
              )

OK sorry, but maybe the better way is to catch the ZERO_DIVIDE exception.
I think there is a problem with the parenthesis no ? shouldn't it be
SUM(ROUND((NVL(sim_trip.dry_mat_used, 0) / nullif(sim_trip.spread_miles_total,0)) * 2000, 2))instead of :
SUM(ROUND((NVL(sim_trip.dry_mat_used, 0)) / nullif(sim_trip.spread_miles_total,0) * 2000, 2))

Similar Messages

  • How to convert the following query to sql server 2005

    hi
    i have the following query in ms access and i want to convert it into sql server 2005 express edition
    SELECT iif(Max(BNo) is null,1,Max(BNo)+1) AS BNo from ( SELECT iif(Max(Product.BNo) is null,0,Max(Product.BNo)) AS BNo FROM Product union all SELECT iif(Max(grndetail.BNo) is null,0,Max(grndetail.BNo)) AS BNo FROM grndetail UNION ALL SELECT iif(Max(srdetail.BNo) is null,0,Max(srdetail.BNo)) AS BNo FROM srdetail ) as t
    how to do this

    The construct involving case when MAX sounds suspicious. Can you explain what the query is supposed to be doing, the structure of your table, then we can re-write it?
    E.g. if you provide your table, some data and desired result, you'll get better answer than direct translation of this suspicious query.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Convert a String to java.sql.Date Format

    Hi,
    I am having a String of containing date in the format 'dd/mm/yyyy' OR 'dd-MMM-YYYY' OR 'mm-dd-yyyy' format. I need to convert the string to java.sql.Date object so that I can perform a query the database for the date field. Can any one suggest me with the code please.
    Regards,
    Smitha

    import java.text.SimpleDateFormat;
    import java.text.ParseException;
    import java.util.Date;
    public class TestDateFormat
         public static void main(String args[])
              SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
              System.out.println(sdf.isLenient());
              try
                   Date d1 = sdf.parse("07-11-2001");
                   System.out.println(d1);
                   Date d2 = sdf.parse("07:11:2001");
                   System.out.println(d2);
              catch(ParseException e)
                   System.out.println("Error format, " + e);
    See class DateFormat and SimpleDateFormat for detail.

  • To convert the "IBM DB2 Store Procs written in C" to Oracle PL-SQL

    Hi, Is it possible to convert the "IBM DB2 Store Procs written in C" to Oracle PL-SQL. If you have any info, PL do let me know. Thanks in advance.
    EG :
    /* SMG Stored Procedures */
    /* DB2 Stored Procedure: OrganisationExists */
    /* Linkage: SIMPLE (no NULLs permitted) */
    /* Load module name: SMGEC00 */
    /* Purpose: DELETE FROM SSE_LOOKUP_MAP */
    /* to run. */
    /* Parameters: argvÝ1¨ short - return error code - OUT */
    /* argvÝ2¨ char - return error message - OUT */
    /* argvÝ3¨ char - BLEID - IN */
    /* Reason for edit Date Who */
    /* Initial version 09/04/03 Arockia */
    #pragma runopts(plist(os))
    #include <stdlib.h>
    #include <string.h>
    void main (int argc, char *argvݨ)                                             
    EXEC SQL INCLUDE SQLCA;
    EXEC SQL BEGIN DECLARE SECTION;
    char bleid??(12??);
    EXEC SQL END DECLARE SECTION;
    /* Set defaults for error code (argvÝ1¨) and error message (argvÝ2¨) */
    strcpy(argv??(2??)," ");
    *(int *)argv??(1??) = 0;
    strcpy(bleid,argv??(3??));
    EXEC SQL
    DELETE FROM SSE_LOOKUP_MAP
    WHERE BLEID = :bleid;
    /* Set error code to record status of last SQL command */
    *(int *)argv??(1??) = SQLCODE;
    return;

    For this program, you could do some thing like:
    SQL> CREATE TABLE sse_lookup_map(BLEID varchar2(10));
    Table created.
    SQL> CREATE or replace PROCEDURE test(p_bleid_in IN varchar2)
      2  AS
      3  BEGIN
      4  DELETE FROM sse_lookup_map
      5  WHERE BLEID = p_bleid_in;
      6  END;
      7  /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1* INSERT INTO sse_lookup_map values('test1')
    SQL> /
    1 row created.
    SQL> ed
    Wrote file afiedt.buf
      1* INSERT INTO sse_lookup_map values('test2')
    SQL> /
    1 row created.
    SQL> SELECT * FROM sse_lookup_map;
    BLEID
    test1
    test2
    2 rows selected.
    SQL> EXEC test('test1')
    PL/SQL procedure successfully completed.
    SQL>  SELECT * FROM sse_lookup_map;
    BLEID
    test2
    1 row selected.
    SQL>

  • Convert the insert statement of an MS SQL server into an oracle statement

    Hi ,
    The insert statement in the ms sql server is
    INSERT INTO #temp EXEC Procedurename @Id OUTPUT
    where table temp
    CREATE TABLE #temp(
              Id varchar(10),
              FNa varchar(40),
              LNa varchar(40),
              SId varchar(20),
              Aid varchar(20),
              Did varchar(20),
              CCNa varchar(255),
              CCId int,
              ISu char(1),
              IA char(1),
              Dir char(1),
              Ema varchar(60),
              St char(2),
              DId char(3)
    I converted the insert statement like this
    Procedurename(Id);
    LOOP
    FETCH cv_1 INTO v_temp;
    EXIT WHEN cv_1%NOTFOUND;
    INSERT INTO TEMP VALUES v_temp;
    END LOOP;
    CLOSE cv_1;
    But i am receiving PL/SQL: ORA-00947: not enough values
    Can anyone help on this?
    Thanks

    1) Are you sure that you even need a temp table? Fetching all the rows from a cursor 1-by-1 and then inserting them into a temp table (I'm assuming the Oracle table TEMP is declared as a global temporary table) would seem rather unusual and most likely pointless. In Oracle, readers don't block writers, so there is generally no need to use temp tables to hold intermediate results.
    2) If you do need to store a set of results into a table, it's going to be more efficient to do this in a single SQL statement rather than using a cursor. Something like
    INSERT INTO my_table ( <<list of columns>> )
      SELECT <<list of columns>>
        FROM <<other tables>>
       WHERE <<some conditions>>The SELECT part of the statement here is likely whatever SQL you use in declaring the cursor.
    Justin

  • What is the use of 'Convert to Formula' in BEx Report?

    Helo BI Gurus,
    After refreshing the query in BI, when I right click on the query report, I am getting an option 'Convert to Formula'. Can you please tell me the use of this option, and how we can use this in our report and what the result we will be getting?

    Hi Mathew,
        The Convert to Formula in Excel Allows you to Convert you Embedded Bex Query into API Calls. This enables you to Better Format the Excel Output by allowing you to move your Cells Around.
    This helps because when you refresh you Query all the Changes you make will be maintained.
    [More Info on Working with Formula|http://help.sap.com/saphelp_nw70/helpdata/EN/d3/015369f54f4a0ca19b28c1b45acf00/content.htm]
    Hope this Helps
    Datta.

  • What is the use of 'Convert to Formula' option available BEx Query Rpt?

    After refreshing the query in BI, when I right click on the query report, I am getting an option 'Convert to Formula'. Can you please tell me the use of this option, and how we can use this in our report.
    1) What does "convert to formula" do?
    2) After I click on "converting to formula" in the report , I am unable to paste the spreadsheet from i finance into excel. Below msg appears. What settings do I need to change?
    " Microsoft Office Excel cannot paste the data"

    Can anyone help me to get answers for the below questions

  • Convert to Formula - what are the benefits?

    Hello Experts,
    Can anybody explain to me in simple words what this function does? I have read in SAP Bex tools (by SAP Press) that it enables some custom formatting, inserting columns and allows for additional calculations based off of the query key figures. I tried to convert a query to the formula mode, but I lost all query functionality (no BW menu on rightclick, not able to add characteristics etc.), and the query doesn't refresh. Moreover, I was not able to switch this mode off...
    What are the benefits then?
    I am still fairly new to BI 7.0 and currently testing it's functionalities, and I am getting more and more frustrated at it's complexity which seems to be no longer intuitive
    Thanks,
    A.

    Hello,
    Maybe this link will help?  I am looking into the same question that you have!
    [http://help.sap.com/erp2005_ehp_04/helpdata/EN/d3/015369f54f4a0ca19b28c1b45acf00/frameset.htm|http://help.sap.com/erp2005_ehp_04/helpdata/EN/d3/015369f54f4a0ca19b28c1b45acf00/frameset.htm]
    Nick

  • Please help me convert the SQL to HQL

    select
    count(*) as col_0_0_
    from
    edu.hr_people_all hrpeopleal0_
    left outer join
    edu.conditions_journal conditions1_
    on hrpeopleal0_.people_id=conditions1_.people_id
    and conditions1_.personal_number like '%'
    where
    hrpeopleal0_.status=11

    Hibernate version: 3
    HQL as I 've done
    FROM PMSProjectsORO pjt LEFT JOIN PMSChecklistORO pcl
    ON pjt.projectId = pcl.projectId order by
    pjt.projectCode ascHQL is probably incorrect.
    Try this:
    FROM
    PMSProjectsORO pjt
    LEFT JOIN
    PMSChecklistORO pcl
    ORDER BY
    pjt.projectCode asc>
    Original SQL for MSQL5:
    FROM PMSProject LEFT JOIN PMSCheckList ON
    PMSProject.PROJECT_ID = PMSCheckList.PROJECT_ID order
    by PMSProject.PROJECT_CODE desc
    Name and version of the database you are using:
    MYSQL 5
    Please help me convert the sql to hql since what i
    've done is throwing error like unexpected token...
    Please reply ASAPLet me know if that's better.
    %

  • Error Message while adding Item in Item Master Data- [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting the nvarchar value 's008 01' to data type int. (CINF)

    Dear Experts
    I am getting the following error message while adding item in Item Master data. I have modified the following SBO_SP_transactionNotification in SQL server after that could not able to add the item
    ALTER proc [dbo].[SBO_SP_TransactionNotification]
    @object_type nvarchar(20),                      -- SBO Object Type
    @transaction_type nchar(1),               -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
    @num_of_cols_in_key int,
    @list_of_key_cols_tab_del nvarchar(255),
    @list_of_cols_val_tab_del nvarchar(255)
    AS
    begin
    -- Return values
    declare @error  int                       -- Result (0 for no error)
    declare @error_message nvarchar (200)           -- Error string to be displayed
    select @error = 0
    select @error_message = N'Ok'
    --    IF @OBJECT_TYPE = '59' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
      BEGIN
       IF EXISTS(
        SELECT T0.Price FROM IGN1 T0
        where  IsNull(T0.Price, '0') = '0' and T0.DocEntry = @list_of_cols_val_tab_del)
       BEGIN
        SELECT @ERROR=1,@ERROR_MESSAGE='Please insert the price !'
      END
    end
    -- Select the return values
    select @error, @error_message
    end

    Hi Rathna,
    Just put the SP like this, without the -- before the IF. A -- marks the line as a command therefore you need to uncomment and it will work.
    IF @OBJECT_TYPE = '59' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
      BEGIN
       IF EXISTS(
        SELECT T0.Price FROM IGN1 T0
        where  IsNull(T0.Price, '0') = '0' and T0.DocEntry = @list_of_cols_val_tab_del)
       BEGIN
        SELECT @ERROR=1,@ERROR_MESSAGE='Please insert the price !'
      END
    end
    Hope it helps

  • SQL Error-Converting the nvarchar value to datatype int

    I am having error when I use the range of july but other date range are okay.
    here is error:
    Msg 245, Level 16, State 1, Line 1
    Conversion failed when converting the nvarchar value 'Vital Ventures Mgt. Corp.' to data type int.
    Select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P From (SELECT CONVERT(nvarchar,a.TaxDate,101) A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' then (Select top 1 (dscription) from INV1 where docEntry=d.docentry and VatGroup=d.VatGroup)End E,ISNULL(f.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099 When a.DocType='S' Then SUM(d.PriceAfVat) End G,0 H 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End I 
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End J 
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End K 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum When a.DocType='S' Then SUM(d.vatSum) End Else 0 End L,'' M,a.DocType N,'SI' O,a.DocNum P 
                from OINV a inner join OCRD c on a.CardCode=c.CardCode inner join INV1 d on a.DocEntry=d.DocEntry left join NNM1 f on  a.Series=f.Series 
                inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (f.SeriesName = 'SI' or a.Series = '-1') GROUP BY d.VatGroup,CONVERT(nvarchar,a.TaxDate,101),a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,ISNULL(f.SeriesName,'') 
                UNION ALL 
                SELECT CONVERT(nvarchar,a.TaxDate,101) A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' Then (Select top 1 (dscription) from RIN1 where docEntry=d.docentry and VatGroup=d.VatGroup) End E,ISNULL(g.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099*-1 When a.DocType='S' Then SUM(d.PriceAfVat*-1) End G,Case When f.AcctName='SALES DISCOUNTS (Trading)' Then SUM(d.LineTotal) Else 0 End H 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End I 
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End J 
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End K 
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum*-1 When a.DocType='S' Then SUM(d.vatSum*-1) End Else 0 End L,'' M,a.DocType N,'SR/D' O,a.DocNum P 
                from ORIN a inner join OCRD c on a.CardCode=c.CardCode inner join RIN1 d on a.DocEntry=d.DocEntry inner join OACT f ON d.acctCode=f.acctCode left join NNM1 g on a.Series=g.Series  
               inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (g.SeriesName = 'SR/D' or a.Series = '-1') GROUP BY d.VatGroup,CONVERT(nvarchar,a.TaxDate,101),a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,f.AcctName,ISNULL(g.SeriesName,'') 
                UNION ALL SELECT CONVERT(nvarchar,a.TaxDate,101) A,f.LicTradNum B,c.CardCode C,ISNULL(c.CardName,' ') D,c.comments E,'OR'+Cast(a.Ref1 as nvarchar) F,Case When d.Debit<>0 Then SUM(d.basesum + d.debit)*-1 Else SUM(d.basesum + d.credit) End G,0 H 
                ,Case When d.debit<>0 then d.BaseSum*-1 Else d.BaseSum End I,0 J,0 K,Case When d.debit<>0 then d.debit*-1 Else d.Credit End L,'' M,'S' N,'OR' O,a.Ref1 P 
                from OJDT a inner join ORCT c on a.Ref1=c.DocNum inner join JDT1 d on a.TransId=d.TransId Inner Join OCRD f on c.CardCode=f.Cardcode 
                inner join OVTG e on d.VatGroup=e.Code Where a.TaxDate Between '07/01/2014' AND '07/31/2014' and d.VatGroup='Output-S' and a.TransType=30 GROUP BY d.VatGroup,CONVERT(nvarchar,a.TaxDate,101),f.LicTradNum,c.CardCode, c.CardName,c.comments,a.Ref1,a.loctotal,d.credit,d.debit,d.baseSum 
                ) A Group By A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P Order By O,P

    Hi Raphael...
    Try This
    Select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P From (SELECT a.TaxDate A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' then (Select top 1 (dscription) from INV1 where docEntry=d.docentry and VatGroup=d.VatGroup)End E,ISNULL(f.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099 When a.DocType='S' Then SUM(d.PriceAfVat) End G,0 H
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End I
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End J
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then a.Max1099-a.VatSum When a.DocType='S' Then SUM(d.LineTotal) End Else 0 End K
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum When a.DocType='S' Then SUM(d.vatSum) End Else 0 End L,'' M,a.DocType N,'SI' O,a.DocNum P
                from OINV a inner join OCRD c on a.CardCode=c.CardCode inner join INV1 d on a.DocEntry=d.DocEntry left join NNM1 f on  a.Series=f.Series
                inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (f.SeriesName = 'SI' or a.Series = '-1') GROUP BY d.VatGroup,a.TaxDate,a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,ISNULL(f.SeriesName,'')
                UNION ALL
                SELECT a.TaxDate A,a.LicTradNum B,a.CardCode C,ISNULL(a.CardName,' ') D,Case When a.DocType='I' Then a.Comments When a.DocType='S' Then (Select top 1 (dscription) from RIN1 where docEntry=d.docentry and VatGroup=d.VatGroup) End E,ISNULL(g.SeriesName,'')+Cast(a.DocNum as nvarchar) F,Case When a.DocType='I' Then a.Max1099*-1 When a.DocType='S' Then SUM(d.PriceAfVat*-1) End G,Case When f.AcctName='SALES DISCOUNTS (Trading)' Then SUM(d.LineTotal) Else 0 End H
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End I
                ,Case when e.Name LIKE '%Zero Rated' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End J
                ,Case when e.Name LIKE '%VAT EXEMPT' Then Case When a.DocType='I' Then (a.Max1099-a.VatSum)*-1 When a.DocType='S' Then SUM(d.LineTotal*-1) End Else 0 End K
                ,Case when e.Name NOT LIKE '%VAT EXEMPT' And e.Name NOT LIKE '%Zero Rated' Then Case When a.DocType='I' Then a.vatSum*-1 When a.DocType='S' Then SUM(d.vatSum*-1) End Else 0 End L,'' M,a.DocType N,'SR/D' O,a.DocNum P
                from ORIN a inner join OCRD c on a.CardCode=c.CardCode inner join RIN1 d on a.DocEntry=d.DocEntry inner join OACT f ON d.acctCode=f.acctCode left join NNM1 g on a.Series=g.Series 
               inner join OVTG e on d.VatGroup=e.Code Where a.DocDate Between '07/01/2014' AND '07/31/2014' and (g.SeriesName = 'SR/D' or a.Series = '-1') GROUP BY d.VatGroup,a.TaxDate,a.LicTradNum,a.CardCode, a.CardName,a.Doctype,a.comments,a.docnum,a.Max1099,e.name,a.vatsum,d.docentry,f.AcctName,ISNULL(g.SeriesName,'')
                UNION ALL SELECT a.TaxDate A,f.LicTradNum B,c.CardCode C,ISNULL(c.CardName,' ') D,c.comments E,'OR'+Cast(a.Ref1 as nvarchar) F,Case When d.Debit<>0 Then SUM(d.basesum + d.debit)*-1 Else SUM(d.basesum + d.credit) End G,0 H
                ,Case When d.debit<>0 then d.BaseSum*-1 Else d.BaseSum End I,0 J,0 K,Case When d.debit<>0 then d.debit*-1 Else d.Credit End L,'' M,'S' N,'OR' O,a.Ref1 P
                from OJDT a inner join ORCT c on a.Ref1=c.DocNum inner join JDT1 d on a.TransId=d.TransId Inner Join OCRD f on c.CardCode=f.Cardcode
                inner join OVTG e on d.VatGroup=e.Code Where a.TaxDate Between '07/01/2014' AND '07/31/2014' and d.VatGroup='Output-S' and a.TransType=30 GROUP BY d.VatGroup,a.TaxDate,f.LicTradNum,c.CardCode, c.CardName,c.comments,a.Ref1,a.loctotal,d.credit,d.debit,d.baseSum
                ) A Group By A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P Order By O,P
    Regards
    Kennedy

  • How to refer the trigger written in one form from another form ?

    How to refer the trigger written in one form from another form ?
    Thanks,
    Ravi Shankar

    Try to convert the PL/SQL code from Forms trigger into a PL/SQL library(.PLL),
    and then attach that PLL in your forms.
    Note that all Forms objects should be referenced indirectly, for example,
    you have to rewrite
    :B1.DEPT_CODE := :B2.DEPT_CODE;
    :B3.TOTAL_AMOUNT := 100;
    ==>
    copy('B2.DEPT_NO','B1.DEPT_NO');
    copy('100','B3.TOTAL_AMOUNT');
    This is the best way to share PL/SQL code among Oracle Forms.

  • Converting Cobol Programs to PL/SQL Packages/Procedures

    Our company is trying to move away from Cobol and code all new projects and begin to convert old code to pl/sqlpackages/procedures. I was wondering if anyone in here had any experience in converting Cobol programs to Pl/sql. Any help would be greatly appreciated.

    user8697075 wrote:
    Our company is trying to move away from Cobol and code all new projects and begin to convert old code to pl/sqlpackages/procedures.JOY!! ;-)
    I have written a lot of Cobol and converted a lot of Cobol (not to PL/SQL though). But the mere thought of it, brings a song to my heart. :D
    PL/SQL will be significantly faster and more scalable than using Cobol. It is also a lot simpler to design and code than using Cobol. Always found Cobol development very boring - except for the odd occasions when we had to design and write re-entrant Cobol code..
    Just do not make the mistake of attempting a straight port - rewriting a Cobol program essentially line by line into a PL/SQL unit. Implementing row-by-row slow-by-slow processing into PL.SQL.
    Without rethinking the process flow, the program design and so on, the resulting code unit will be little better than the original Cobol unit. Which begs the question, why bother and why use the new code then? In fact, seen this first hand back in the 80's when this approach was used to convert a pretty large system from Cobol to Natural. After many man years of development (and lots of money), the new system had all the problems of the old.. and was canned during the testing phase. Money, time and resources utterly and totally wasted.

  • How can i convert the firefox-history-timestamp in places.sqlite into a normal date format? The firefox-timestamp is not equivalent to the unix-timestamp, that's why I ask. I could not find a conversion function. Does anyone know something about this?

    As I opened the places.sqlite with an sqlite-editor I found out that firefox saves the last_visit_date via a timestamp which is 16 digits long. I realized that the first 10 digits are similar to the corresponding unix-timestamp but not equal. So.. how can i convert the firefox-timestamp into a normal date? Or into the corresponding unix-timestamp?

    Write a bash script or 'C' program to change the date format and then use the sql update function to receive the stdio output 'where date_field='embeded date value'.

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

Maybe you are looking for

  • Help appending how many times an event ID has occurred next to the unique Event ID.

    Hello, I am trying to figure out how to find how many times an event occurred and then append that next to the single  -unique Event ID. The closest I can find is the Sort-Object Count but I can't figure out how to get that work within the below scri

  • Error 500 Out of Memory on x64 bit machine

    Using windows vista 64bit business x64 bit machine 32 bit application using visual fox pro odbc driver Happens on Crystal reports 8 and 10 After 3+ million records with our query we receive an Error 500 out of memory. Under windows 32bit machine, we

  • IMessage continues to crash, what can I do to fix it?

    My iMessage was working fine then all of a sudden it crashed and now I'm not able to open and read the messages. I can still receive messages and get alerted but I cant open iMessage.  Ill tap the app and it will have the blank overview of it then af

  • Few questions about consistency

    Hello colleagues, From some time I have a mess in my head regarding to consistency between system. The situation #1 I decided to perform some actions in SPAU to clean note mess. I wanted to reset in original state all my obsolete notes. In the end of

  • Layer Break Issues with Encore 2.0

    I have a dual-layer project that is doing something strange: When authoring the project I left the layer break to automatic. After writing an image for review, a few people complained that the layer break was in a bad location and some players were h