Goods Issue - SQL Query will not sum

I have 3 Goods Issue documents with Document Total for each document 10,000 / 20,000 / 30,000 subsequently.
I want to make query so that it will display like below - where it shows BOTH each of 3 document value (10000/2000/30000) AND the sum of the 3 documents (60000) like below.
Doc 1 - 10,000
Doc 2 - 20,000
Doc 3 - 30,000
Total = 60,000
In addition, I would like the ability to choose date range. Basically, something like
SELECT Document_Total
FROM Goods_Issue table
WHERE the_document_date is between 1-SEP-2011 and 31-SEP-2011
AND the_reference_is _________________
I have tried many SQL queries, but it displayed either:
Doc 1 - 10,000
Doc 2 - 20,000
Doc 3 - 30,000
OR
Total = 60,000
Please help.

@Hendry Wijaya      @GordonDu   @malhaar
Thanks for helps. The SQL query you provided solved 99% of the problem. I just need to make a tweak on the SQL so that it could display the total on the footer. See screenshot below - I uploaded the pics at imageshack as I don't find a way to attach pics in here.
[See here - Total_at_Footer|http://i129.photobucket.com/albums/p213/whitesnowbear/AAAA/Untitled-2.jpg]
Thanks a bunch.

Similar Messages

  • SQL Query will not work in CRXI

    I am using CRXI Developer R2 against an Oracle 9i DB. The following query works in Oracle SQL Developer, but returns no results in Crystal (no errors in Crystal either). Anyone know what is wrong?
    SELECT b1.b1_alt_id,
           b1.b1_per_type,
           issued.status_date IssueDate,
           closed.status_date CloseDate,
           case
           when bc.b1_checklist_comment is null
           then 'No Patch List'
           else bc.b1_checklist_comment
           end PatchList
    FROM   b1permit b1
           INNER JOIN (SELECT b1_per_id1,
                              b1_per_id2,
                              b1_per_id3,
                              status_date
                       FROM   status_history
                       WHERE  status = 'Issued'
                              AND rec_status = 'A'
                              AND status_date BETWEEN '01-JUL-08' AND '31-DEC-08') issued
             ON b1.b1_per_id1 = issued.b1_per_id1
                AND b1.b1_per_id2 = issued.b1_per_id2
                AND b1.b1_per_id3 = issued.b1_per_id3
                AND b1.rec_status = 'A'
                AND b1.b1_per_type = 'Utility'
           LEFT OUTER JOIN (SELECT b1_per_id1,
                                   b1_per_id2,
                                   b1_per_id3,
                                   status_date
                            FROM   status_history
                            WHERE  status = 'Closed'
                                   AND rec_status = 'A') closed
             ON b1.b1_per_id1 = closed.b1_per_id1
                AND b1.b1_per_id2 = closed.b1_per_id2
                AND b1.b1_per_id3 = closed.b1_per_id3
           LEFT OUTER JOIN bchckbox bc
             ON b1.b1_per_id1 = bc.b1_per_id1
                AND b1.b1_per_id2 = bc.b1_per_id2
                AND b1.b1_per_id3 = bc.b1_per_id3
                AND b1.rec_status = bc.rec_status
                AND bc.b1_checkbox_desc LIKE 'Patch List%'

    Hi
    Instead of using this query direct;y, create a view
    as
    CREATE OR REPLACE VIEW V1
    AS
    SELECT <Your query>
    From Oracle client check if view returns desired result by
    select * from <viewName>
    and use that view as a datasource in your report.
    --Kuldeep

  • Portal Report from SQL query will not fill the page irrespective of column width.....

    I'm displaying a report in a portal and if you run in full screen the table does not fill the page.
    I can change the column width from xx percent to xx pixel and nothing makes a difference
    any ideas?

    Hi,
    Which version of portal are you using. This is a bug. It has been fixed in 30984.
    Thanks,
    Sharmila

  • SQL Query - The number of columns specified in "SQL Query" does not match t

    I am creating new UDM for tablespace alert, below is my query,however its failing with error
    SQL Query - The number of columns specified in "SQL Query" does not match the value specified in "SQL Query Output"
    I selected Metric type is number
    SQL Query Format : Two columns
    Query:
    SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2)
    used_pct FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    Any clues why i am getting error.

    SQL> SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2) used_pct
    2 FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    3 WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    4 AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    TABLESPACE_NAME USED_PCT
    MGMT_TABLESPACE .82
    SYSAUX 1.52
    UNDOTBS1 .32
    RMAN .02
    CORRUPT_TS 10.63
    USERS 0
    SYSTEM 2.26
    MGMT_ECM_DEPOT_TS .04
    MGMT_AD4J_TS 0

  • Class oracle.xml.sql.query.OracleXMLQuery not found in import

    I tried to perform load java using a non-sys user :
    loadjava -user user1/passwd -v -o -r Archive.java
    but encountered the following error:
    Errors in Archive:
    ORA-29535: source requires recompilation
    Archive:11: Class oracle.xml.sql.query.OracleXMLQuery not found in import.
    Info: 1 errors
    loadjava: 3 errors
    But if I use sys user I don't have any error:
    loadjava -user sys/manager -v -o -r Arachive.java
    initialization complete
    loading : Archive
    creating : Archive
    resolver :
    resolving: Archive
    Why is this so?
    ANy security setup that I missed?
    Thanks in advance.
    Note:
    my Archive.java file contains:
    // Core Java Classes
    import java.io.*;
    import java.sql.*;
    // Oracle Java classes
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Azman Diron ([email protected]):
    I tried to perform load java using a non-sys user :
    loadjava -user user1/passwd -v -o -r Archive.java
    but encountered the following error:
    Errors in Archive:
    ORA-29535: source requires recompilation
    Archive:11: Class oracle.xml.sql.query.OracleXMLQuery not found in import.
    Info: 1 errors
    loadjava: 3 errors
    But if I use sys user I don't have any error:
    loadjava -user sys/manager -v -o -r Arachive.java
    initialization complete
    loading : Archive
    creating : Archive
    resolver :
    resolving: Archive
    Why is this so?
    ANy security setup that I missed?
    Thanks in advance.
    Note:
    my Archive.java file contains:
    // Core Java Classes
    import java.io.*;
    import java.sql.*;
    // Oracle Java classes
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    <HR></BLOCKQUOTE>
    Managed to solve this problem.
    Drop all xml objects owned by sys and user1.
    Reload xml objcets for user1 with -force option.
    null

  • Have a month number but QaaWs query will not run

    If I type in the parameters for the query it runs with no problem, but when I use the MONTH function that returns the month number the query will not run.
    I think the date serial number is what is being passed even though I see a number being display.  Does anyone know how to conver this MONTH() function to a true number?  This is a converted 4.5 model that works just fine, but looks like they tightened things up in 2008.
    Thanks...
    Tom Nather

    Here is how its setup.  I have a QaaWs query that returns the max date, then Excel functions that calculate the date back 13 months.  One of the functions is MONTH() that returns the month number based on a date stored in a cell, not really a true number.
    I added a vlookup that takes the month from a date field (05/31/2008) and looks up the appropriate NUMBER of the month =VLOOKUP(MONTH(K47),M54:M65,1). Find 5 (which is defined as a number.
    This then is applied to the input side for the Qaaws (Month Number = double) using a Paste Link function from the CONTROLS sheet in excel, and the query then works.
    Anything that is a date always seems to be built off of the date serial number so this was the easiest way to get this to work. 
    I think standards have been tightened up using the Flex language vs. what 4.5 was written in, this works in 4.5 without the necessary conversion.

  • PL/SQL spatial query will not compile.

    I have a PL/SQL spatial query that will not compile, but the equivalent SQLPlus query works fine. I.e. (convert decimal degrees to degrees,minutes,seconds)
    Any thoughts much appreciated....
    THIS WORKS in SQLPlus
    select
    decode(rownum,1,decode(sign(b.column_value),-1,'W','E'),2,decode(sign(b.column_v
    alue),-1,'S','N'))&#0124; &#0124;
    to_char(abs(trunc(b.column_value,0)),'999')
    &#0124; &#0124;to_char(abs(trunc((b.column_value - trunc(b.column_value,0)) * 60,0)),'99')
    &#0124; &#0124;to_char(abs(
    (((b.column_value - trunc(b.column_value,0)) * 60) - trunc((b.column_value - tru
    nc(b.column_value,0)) * 60,0)) * 60
    ),'99.99')
    from route_location a, table(a.line.sdo_ordinates) b
    where a.route_adms_id = 13820370
    and record_seq_num = 26
    and rownum < 3
    BUT THIS DOES NOT
    ADMS>create or replace procedure PKG_route_loc_latlong_ins
    2 (iADMS_ID in INTEGER, iRSN in INTEGER,
    3 vcLAT out VARCHAR2, vcLONG out VARCHAR2) as
    4 cursor c1 is
    5 select decode(rownum,1,decode(sign(b.column_value),-1,'W','E'),
    6 2,decode(sign(b.column_value),-1,'S','N'))
    7 &#0124; &#0124;to_char(abs(trunc(b.column_value,0)),'999')
    8 &#0124; &#0124;to_char(abs(trunc((b.column_value - trunc(b.column_value,0)) * 60,0)),
    '99')
    9 &#0124; &#0124;to_char(abs(
    10 (((b.column_value - trunc(b.column_value,0)) * 60) -
    11 trunc((b.column_value - trunc(b.column_value,0)) * 60,0)) * 60
    12 ),'99.99')
    13 from route_location a, table(a.line.sdo_ordinates) b
    14 where a.route_adms_id = iADMS_ID
    15 and a.record_seq_num = iRSN
    16 and rownum < 3;
    17 BEGIN
    18 open c1;
    19 fetch c1 into vcLONG;
    20 fetch c1 into vcLAT;
    21
    22 EXCEPTION
    23 when others then
    24 vcLAT := 'ERROR';
    25 RAISE_APPLICATION_ERROR(-20002,
    26 'XXXXXXXXXXXXXX ');
    27
    28 END pkg_route_loc_latlong_ins;
    29 /
    Warning: Procedure created with compilation errors.
    ADMS>
    ADMS>show errors
    Errors for PROCEDURE PKG_ROUTE_LOC_LATLONG_INS:
    LINE/COL ERROR
    5/5 PL/SQL: SQL Statement ignored
    5/12 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    5/12 PLS-00320: the declaration of the type of this expression is
    incomplete or malformed
    13/34 PLS-00201: identifier 'A.LINE' must be declared
    19/5 PL/SQL: SQL Statement ignored
    20/5 PL/SQL: SQL Statement ignored
    null

    try a
    FOR UPDATE OF ID NOWAIT;where ID is the name of a column in the table.

  • Sql server will not start - Database 'model' cannot be opened. It is in the middle of a restore.

    Sql server service will not start after server reboot:
    2009-08-13 14:15:43.94 spid7s      SQL Trace ID 1 was started by login "sa".
    2009-08-13 14:15:43.97 spid7s      Starting up database 'mssqlsystemresource'.
    2009-08-13 14:15:43.97 spid7s      The resource database build version is 10.00.1600. This is an informational message only. No user action is required.
    2009-08-13 14:15:44.30 Server      A self-generated certificate was successfully loaded for encryption.
    2009-08-13 14:15:44.30 spid7s      Server name is 'WIN-37R9WFWAJIB\MSDB1'. This is an informational message only. No user action is required.
    2009-08-13 14:15:44.32 spid10s     Starting up database 'model'.
    2009-08-13 14:15:44.32 Server      Server is listening on [ 'any' <ipv6> 49167].
    2009-08-13 14:15:44.33 Server      Server is listening on [ 'any' <ipv4> 49167].
    2009-08-13 14:15:44.33 Server      Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSDB1 ].
    2009-08-13 14:15:44.33 Server      Server named pipe provider is ready to accept connection on [ \\.\pipe\sql\query ].
    2009-08-13 14:15:44.35 spid10s     The database 'model' is marked RESTORING and is in a state that does not allow recovery to be run.
    2009-08-13 14:15:44.38 Server      Server is listening on [ ::1 <ipv6> 49168].
    2009-08-13 14:15:44.38 Server      Server is listening on [ 127.0.0.1 <ipv4> 49168].
    2009-08-13 14:15:44.38 Server      Dedicated admin connection support was established for listening locally on port 49168.
    2009-08-13 14:15:44.39 spid10s     Error: 927, Severity: 14, State: 2.
    2009-08-13 14:15:44.39 spid10s     Database 'model' cannot be opened. It is in the middle of a restore.
    2009-08-13 14:15:44.49 spid10s     Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.
    2009-08-13 14:15:44.50 spid10s     SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informa
    there is plenty of room on the server, so i dont think its a disk space issue.  i am able to start the service as such:
    C:\Users\Administrator>net start MSSQL$MSDB1 /c /m /T3608
    The SQL Server (MSDB1) service is starting.
    The SQL Server (MSDB1) service was started successfully
    sqlcmd -e
    1> select name, status from sysdatabases;
    2> go
    select name, status from sysdatabases;
    name
                                                     status
    master
                                                           65544
    tempdb
                                                           65544
    model
                                                           65568
    msdb
                                                      1073807368
    SS_DBA_Dashboard
                                                      1073807368
    (5 rows affected)
    model is in RESTORING state and I dont know how to fix it.  I am running simple backups, so I have a somewhat recent backup of model.bak but when I attempt to restore it I get an error:
    1> restore database model
    2> go
    restore database model
    Msg 3112, Level 16, State 1, Server WIN-37R9WFWAJIB\MSDB1, Line 1
    Cannot restore any database other than master when the server is in single user
    mode.
    Msg 3013, Level 16, State 1, Server WIN-37R9WFWAJIB\MSDB1, Line 1
    RESTORE DATABASE is terminating abnormally.
    other forums suggest manually updating the status column but i dont know if my syntax is wrong or it just cant be done in sql server 2008:
    1> begin transaction
    2> update sysdatabases set status=16 where name='model'
    3> ;
    4> go
    begin transaction
    update sysdatabases set status=16 where name='model'
    Msg 4406, Level 16, State 1, Server WIN-37R9WFWAJIB\MSDB1, Line 2
    Update or insert of view or function 'sysdatabases' failed because it contains a
     derived or constant field.
    1>
    yet another forum suggested taking a cleanly shut down model.mdf and model.ldf from another sql server 2008 instance and placing those in the data directory while moving the 'restoring' ones to a backup location.  this didnt work either.  any help is appreciated im new to sql server and this is very frustrating!  thanks in advance!

    I have the same issue on SQL Server 2008R2, after a server reboot, but none of the NET START commands or command line attempts are successful to start the Service.
    NET START command results in "Access Denied" "System Error 5" and the Command line attempts result in
     Server      Error: 17058, Severity: 16, State: 1.
     Server      initerrlog: Could not open error log file ''.
    Any help?
    SQL Error log file:
    2011-03-29 16:50:49.40 Server      (c) Microsoft Corporation.
    2011-03-29 16:50:49.40 Server      All rights reserved.
    2011-03-29 16:50:49.40 Server      Server process ID is 7292.
    2011-03-29 16:50:49.40 Server      System Manufacturer: 'Dell Inc.', System Model: 'PowerEdge T710'.
    2011-03-29 16:50:49.40 Server      Authentication mode is MIXED.
    2011-03-29 16:50:49.40 Server      Logging SQL Server messages in file 'E:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
    2011-03-29 16:50:49.40 Server      This instance of SQL Server last reported using a process ID of 7448 at 3/29/2011 4:30:06 PM (local) 3/29/2011 8:30:06 PM (UTC). This is an informational message only; no user action is required.
    2011-03-29 16:50:49.40 Server      Registry startup parameters:
      -d E:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf
      -e E:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG
      -l E:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
      -T 4616
    2011-03-29 16:50:49.42 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
    2011-03-29 16:50:49.42 Server      Detected 24 CPUs. This is an informational message; no user action is required.
    2011-03-29 16:50:49.84 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
    2011-03-29 16:50:49.84 Server      Lock partitioning is enabled.  This is an informational message only. No user action is required.
    2011-03-29 16:50:49.86 Server      Node configuration: node 0: CPU mask: 0x0000000000fff000:0 Active CPU mask: 0x0000000000fff000:0. This message provides a description of the NUMA configuration for this computer. This is an informational
    message only. No user action is required.
    2011-03-29 16:50:49.86 Server      Node configuration: node 1: CPU mask: 0x0000000000000fff:0 Active CPU mask: 0x0000000000000fff:0. This message provides a description of the NUMA configuration for this computer. This is an informational
    message only. No user action is required.
    2011-03-29 16:50:49.89 spid9s      Starting up database 'master'.
    2011-03-29 16:50:49.95 spid9s      CHECKDB for database 'master' finished without errors on 2011-03-18 08:46:34.257 (local time). This is an informational message only; no user action is required.
    2011-03-29 16:50:49.95 spid9s      FILESTREAM: effective level = 0, configured level = 0, file system access share name = 'MSSQLSERVER'.
    2011-03-29 16:50:49.97 spid9s      SQL Trace ID 1 was started by login "sa".
    2011-03-29 16:50:49.97 spid9s      Starting up database 'mssqlsystemresource'.
    2011-03-29 16:50:49.99 spid9s      The resource database build version is 10.50.1600. This is an informational message only. No user action is required.
    2011-03-29 16:50:50.20 spid13s     Starting up database 'model'.
    2011-03-29 16:50:50.20 spid9s      Server name is 'XXXX'. This is an informational message only. No user action is required.
    2011-03-29 16:50:50.21 Server      The certificate [Cert Hash(sha1) "C41DC20703F049763778AC2842C3C8A3A2C6EED4"] was successfully loaded for encryption.
    2011-03-29 16:50:50.21 Server      Server is listening on [ 'any' <ipv6> 1433].
    2011-03-29 16:50:50.21 Server      Server is listening on [ 'any' <ipv4> 1433].
    2011-03-29 16:50:50.21 Server      Server local connection provider is ready to accept connection on [
    \\.\pipe\SQLLocal\MSSQLSERVER ].
    2011-03-29 16:50:50.21 Server      Server named pipe provider is ready to accept connection on [
    \\.\pipe\sql\query ].
    2011-03-29 16:50:50.21 Server      Server is listening on [ ::1 <ipv6> 1434].
    2011-03-29 16:50:50.21 spid13s     The database 'model' is marked RESTORING and is in a state that does not allow recovery to be run.
    2011-03-29 16:50:50.21 Server      Server is listening on [ 127.0.0.1 <ipv4> 1434].
    2011-03-29 16:50:50.21 spid13s     Error: 927, Severity: 14, State: 2.
    2011-03-29 16:50:50.21 spid13s     Database 'model' cannot be opened. It is in the middle of a restore.
    2011-03-29 16:50:50.21 Server      Dedicated admin connection support was established for listening locally on port 1434.
    2011-03-29 16:50:50.22 spid13s     Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in
    the event log that may indicate why the tempdb files could not be initialized.
    2011-03-29 16:50:50.22 spid13s     SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

  • Flash chart with dynamic sql query does not display

    Hi,
    In my schema SIVOA I have a lot of tables declared like this :
      CREATE TABLE "SIVOA"."EVV_xxxx"
       (     "CLEF_VAR" NUMBER(4,0),
         "DATE1" DATE,
         "VALEUR" NUMBER(16,8) Only the last part of the name changes "xxxx". For example E009, E019, etc....
    I am making a chart page with report and want the user to select a name of a table and I will display using dynamic sql query, the table report and chart.
    P184_ENAME is a select list returning the last part of the name of the table, fro example 'E009', 'E019', etc.
    P8_CLEF_VAR is an item containing a value. This value is a key retrieved like this :SELECT CLEF_VAR
    FROM SIVOA.SITE_ECHELLE
    WHERE SITE = :P184_ENAMEI built a classic report using a sql dynamic function :DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := 'SELECT NULL, DATE1, VALEUR FROM SIVOA.EVV_'
    || UPPER(:p184_ename)
    || ' WHERE CLEF_VAR = :p8_clef_var' ;
    RETURN (x);
    END;:p8_clef_var is an itme containing the value '4544'.
    This works perfectly fine !
    When I use this sql fucytion into a flash chart it does not work. I get this message "No data found".
    I do not understand why a the report get a result and not the chart !
    But if i hard-code the number of the CLEF_VAR instead of fetching it from :p8_clef_var I get a nice chart ! Go figure !DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := 'SELECT NULL, DATE1, VALEUR FROM SIVOA.EVV_'
    || UPPER(:p184_ename)
    || ' WHERE CLEF_VAR = 4544 ' ;
    RETURN (x);
    I cannot stay with the key (CLEF_VAR) hard-coded unformtunately !
    My question is how to get the chart displaying properly ??
    Thank you for your kind answers.
    Christian                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Alex,
    Using your request, with the classic report I get results (data), but I get the same message with the Flash chart : "No data found" ! I don't know how to investigate this. i tried many things but nothing works.
    Christian
    PS I tried this :
    DECLARE
       X   VARCHAR2 (4000);
    BEGIN
    x := 'SELECT NULL, DATE1, ROUND(VALEUR,2) FROM SIVOA.EVV_'
          || UPPER (:p184_ename) ||
          ' WHERE CLEF_VAR = '
          || :p8_clef_var ||
          ' AND DATE1 BETWEEN TO_DATE ('''
    ||:P8_DATE_DEBUT||''', ''DD/MM/YYYY HH24:MI'') AND TO_DATE ('''
    ||:P8_DATE_FIN||''', ''DD/MM/YYYY HH24:MI'')'
    RETURN (X);
    END; But it does not work either. I could find that the SLQ syntax generated is good becaus I put it into an item which display the return done by the pls/sql.
    What is sttange also with the classic report is that if I do click on next or previous to see another rows, I get the message "No data found". If I try to export the report I get an excel file with "No data fouid".
    Does anybody already tried my "need" here ? i find strange thant I should not be the firs one trying to get a report an tables which name would be "dynamic".
    Tahnk you.
    Edited by: Christian from France on Feb 13, 2009 3:05 AM

  • Where rownum=2 in my sql query is not working . Why ??

    Hello,
    i am using Oracle 11g .Referring scott schema's emp table.
    I just issued this sql query with the intention to get second highest salary of a employee. But i am unable to understand why my query fails ?
    select rownum,empno,ename,sal from (select empno,ename,sal from emp order by sal desc) where rownum=2;This query is returning no rows . Can you tell why this query is returning no rows ?

    888953 wrote:
    Because you can use ROWNUM only to limit the number of returned records, not to return a specific record.
    So only this has sense (n any number):
    ROWNUM <= n
    or
    ROWNUM = 1 (which is equal to ROWNUM <= 1)
    Anything else will not return a row.As i said ,
    select * from (select rownum rn,empno,ename,sal from (select empno,ename,sal from emp order by sal desc)) where rn=2;this query is working fine.So rownm can be used to return a specific record . Please rectify me if i am wrong .

  • Some hierarchy related issues, SQL Query is including unselected columns?

    Hello Guys...
    I have something strange happening in my report.. First of all, the RPD I have is built according to JDE model.
    There is a schema which looks like this:
    BU Dim ------->Fact<---------Account Dim <--------BU Account Dim (Indeed a copy of BU Dim)
    A dim hierarchy is created as AccountDim with Account Desc at the lowest bottom level, the dimension key at that level is AcctID which is the unique identifier.
    The issue comes when I created a report using Account, Account Desc, Fact Measures. The measures are not displayed as per account even if the joins and aggr levels are all defined correctly at the proper level..
    I checked the sql that is generately, it is interested that whenever I include Account Desc column in the report, the SQL will include Actid column in the select and groupby part, which results in data being at the wrong level..
    When I remove Actid from Account Hierarchy as the key, the report runs correctly and the SQL query won't include Actid column.. However, since the removal of the ACTid key from Account Hierarchy will cause other reports not running properly, I have to revert the change back to normal.. I'd like to know what to do in order to investigate more deeply as what's going on and as why the SQL will include columns fields that are not selected at answer levels..
    Any suggestions will be greatly appreciately.. I'd like to provide the rpd file, but not sure how to..
    Many Thanks

    Hi, Vikeng,
    Why use the salary table at all, if you're not ever getting any information from it?
    Why not:
    SELECT  EmpName
    ,      DeptName
    ,      'N/A'          AS SalaryValue
    FROM     Employee
    ,     Department
    WHERE      Employee.EmployeeId     = Department.EmployeeId
    Are you saying that somethimes there is a relationship, but not with this sample data?
    If so, post some different sample data (CREATE TABLE and INSERT statements) that has a relationship for some rows, and not for others. Post the results you want from that data, and explain, with specific examples, how you get those results from that data.
    You might just need an outer join.

  • Last Result from Fulltext SQL Query Search Not Showing

    I am creating a custom search results page for MOSS 2007 (using inline .aspx code - don't ask) that uses Fulltext SQL Queries.  I get the results in a ResultTable (see code below) and then use a DataTable to write code to display it (I could have used
    a DataGrid, I know).
    The problem is that the last result is not showing. So, if it reports that there are 5 results, only 4 will show. I have verified that all 5 results do exist (using a slightly broadened query). If it reports 1 result, none exist in the DataTable that loads
    the result data from the ResultTable.
    FullTextSqlQuery query = new FullTextSqlQuery(site);
    query.ResultTypes = ResultType.RelevantResults;
    query.QueryText = qry;
    query.RowLimit = 50;
    query.StartRow = iPage;
    try
    ResultTableCollection results = query.Execute();
    ResultTable resultTable = results[ResultType.RelevantResults];
    DataTable table = new DataTable();
    table.Load(resultTable, LoadOption.OverwriteChanges);
    int n = resultTable.TotalRows;
    The variable "qry" is a valid SQL Query with the relevant clauses.
    I am using a foreach loop to go through "table" (a DataTable), and so I do not think that I have a "one-off error".
    Any suggestions would be most welcome.

    So in results you have all items but when you are loading it into table (type DataTable) you are loosing one last record.
    1) First you check what data you are getting in resultTable - as you are specifying RelevantResult
    2) Check last index of data in ResultTable collection and try to find out the last index ResultTable, or try to find last index of data in result table
    DataTable.Load method accepts parm of type IDataReader and IDatareader, there are cases it looses records if not read properly..check below links
    http://stackoverflow.com/questions/8396656/why-does-my-idatareader-lose-a-row
    http://msdn.microsoft.com/en-us/library/system.data.datatable.load(v=vs.110).aspx
    <hr> Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL <br/> <b><a href="http://insqlserver.com">Everything about SQL Server | Experience inside SQL Server </a></b>-<a href="http://insqlserver.com">Mohammad
    Nizamuddin </a>

  • STO Post goods issue reversal using vl09 not happening.

    hi
    user has done following cycle
    1.ME21N-PO document type UB and Item cat I.
    2.VL10B- Outbound delivery
    3.VL06G-goods issue using automatic MVT 647 and 101)
    4.VF01-Performa Invoice(billing Type JEX)
    5.J1IIN- Excise invoice.
    In billing base price is missing because of that all duties and net price zero.now user wants to cancel entire cycle. he has done excise cancellation using J1IH. we are not able to reverse billing using VF11, we are not able to PGI reversal using Vl09. it giving error "No dat available for your selection".
    Note: is it problem of JEX because we have not assigned cancell billing type and doc pric procedure to JEX?
    any solution for the above issue.

    the optional solution can be as following steps:
    1) create the bin manually with ls01n: storage type 904, bin name is the delivery number,
    2) reverse with vl09 and a material doc will be created.
    3) check the bin stock with ls24, you will see negative stock in 904.
    4) create TO to offset this negative qty with lt06 with above mentioned material doc. this TO's source bin is just the one in regular storage type.
    5) confirm TO
    6) don't forget to delete the bin created in step 1,  this is because it is created manually but not dynamic bin that will dissapear automatically.
    pls reward if helpful.

  • The SQL query is not executing

    Hi
    I have the following situation: In a project we designed our reports calling a stored procedure the exits in a MS SQL Server 200 database. The Stored Procedures works fine and when they are used in the report everything works perfectly.
    The reports are being made with CR DEsigner 11, when the designer ends them, ha pass them to me and we put them in our java web application. I open them and even preview them since the Crystal Reprots Perspective of Eclipse and I can see the data, so everything to this point is OK.
    The problem comes when I change of connection, I'm trying to connect every report to the same host and database, and when the reprot is displayed in the browser there is no data. I profile the SQL commands that are executed when the report is requested and I found that the reprot is not executing the stored procedure.
    I guess because i'm connectring the report to the same database and host that was used when the report is created and i'm also passing exactly the same parameters of the stored procedure, then report thinks that it doesn't have executing again becuase it will be the same information.
    SO, i wonder if there is a way to request to the report to execute the sql query every time i have to display it.
    thanks for any help.

    What happens when you try to view the report using a simple viewer.jsp?without changing the connection?
    2009-05-25 14:06:09,250 ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter -  detected an exception: Error de conexión: [SQLServer 2000 Driver for JDBC]Error establishing socket.
    But the database server is ok, so i think the rpt needs more information to be connect to the database.
    Also what happens if you dont use the data bean and give everything there only?
    The same, the rpt is not executing the stored procedure.
    Did anything change on the RDBMS side? Additional packages, changes to the schema, ownership, etc?
    No, the server is ok and the database is ok.
    If you configure Log4J logging to DEBUG, you should see the database invokes from the Crystal Java engine, specifically the queries sent and the number of rowsets returned. Do you notice any errors?
    I have a problem here with log4j. In my project i'm using spring and with the help of spring i configure log4j, basically with spring is easier to configure log4j.
    I'm telling you this because i have log4j working but when my application reaches the code to change the connection to the rerport, log4j dies and stop sending any message to the stdout or to a log file. I haven't since this behavior in any other app o library. So i want to guess i have something wrong with my log4j or maybe with log4j+spring.
    So, i remove all the code of spring referring to log4j, but the problem with log4j wasn't solved.
    What i will try now is to remove spring from the project.
    This is my log4j.properties:
    log4j.rootLogger=DEBUG, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

  • Simple Update query Will not work

    I am new to sql and I am doing an update query in access and it will not work, here is the query.
    UPDATE Change Code Master Table SET change code = '0';
    Edited by: 805337 on Oct 26, 2010 8:05 AM

    805337 wrote:
    I am new to sql and I am doing an update query in access and it will not work, here is the query.
    UPDATE Change Code Master Table SET change code = '0';
    Edited by: 805337 on Oct 26, 2010 8:05 AMI'm not at all sure why you are asking an MS Access question on an Oracle forum. Last I heard, Larry had not bought Microsoft yet.
    The MS Access equivalent to double quoting an identifier is square brackets like:
    UPDATE [Change Code Master Table] SET [change code] = '0';John

Maybe you are looking for

  • My video software will not accept gif animations.

    How can I create a format that will be accepted by my video software (Pinnacle)?

  • CD storage capacity: For burning my songs

    I am getting messages that I lack sufficient memory to execute any Saving actions. I moved all of my songs from my iMac hard drive to my LaCie external hard drive, but now I am considering putting them onto CDs for playing music away from my iMac. Re

  • Google Contacts sync fails

    I would like to sync my Apple Contacts with my Google Contacts. The Contacts app includes a preference to do just that which seems to use ISyncManager to do that. ISync puts an icon on my Apple Menu Bar with an option to "Sync Now". When I click that

  • MSVCR80.dll and windows vista, MSVCR80.dll and windows vista?

    Hi I am not technically minded and have searching for a solution to this problem on line but do not understand the solutions on offer.  I have an error message that says ' this appllcation has failed to start because MSCVR80.dll was not fouond. Re-in

  • Amount to Reconcile in Debtors Outstanding  balance query

    Hi Experts. Below is the query i used to run Debtors Outstanding Balance. and its working fine but we need Amount To Reconcile Debit and Amount To Reconcile Credit Fields also.. so pls modify this query and help me... SELECT T0.[TransId],T0.[RefDate]