Query to get total for missing Dates

Hi All
Please help in writing this query.
I have a table with the below values
Tx_code -- TX_date --- Amount -- Accumlated_amt
101 -- 01-Jul-2011 -- 100 -- 100
102 -- 01-Jul-2011 -- 300 -- 300
103 -- 01-Jul-2011 -- 500 -- 500
101 -- 02-Jul-2011 -- 150 -- 250
103 -- 02-Jul-2011 -- 100 -- 600
101 -- 03-Jul-2011 -- 250 -- 500
103 -- 03-Jul-2011 -- 50 -- 650
I want the output as below
101 -- 01-Jul-2011 -- 100 -- 100
102 -- 01-Jul-2011 -- 300 -- 300
103 -- 01-Jul-2011 -- 500 -- 500
101 -- 02-Jul-2011 -- 150 -- 250
102 -- 02-Jul-2011 -- 0 -- 300
103 -- 02-Jul-2011 -- 100 -- 600
101 -- 03-Jul-2011 -- 250 -- 500
102 -- 03-Jul-2011 -- 0 -- 300
103 -- 03-Jul-2011 -- 50 -- 650
For Tx_code 102 is available in 01-Jul-2011 but not in 02-Jul-2011 and 03-Jul-2011
But i want this row in my output for all other dates.
Below are my database version info
Oracle Database 10g Release 10.2.0.1.0 - Production
PL/SQL Release 10.2.0.1.0 - Production
"CORE     10.2.0.1.0     Production"
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Thanks
Rak

There you are:SQL>WITH t AS
  2       (SELECT 101 AS tx_code, TO_DATE('01-Jul-2011', 'DD-MON-YYYY') AS tx_date, 100 AS amount,
  3               100 AS accumlated_amt
  4          FROM DUAL
  5        UNION ALL
  6        SELECT 102, TO_DATE('01-Jul-2011', 'DD-MON-YYYY'), 300, 300
  7          FROM DUAL
  8        UNION ALL
  9        SELECT 103, TO_DATE('01-Jul-2011', 'DD-MON-YYYY'), 500, 500
10          FROM DUAL
11        UNION ALL
12        SELECT 101, TO_DATE('02-Jul-2011', 'DD-MON-YYYY'), 150, 250
13          FROM DUAL
14        UNION ALL
15        SELECT 103, TO_DATE('02-Jul-2011', 'DD-MON-YYYY'), 100, 600
16          FROM DUAL
17        UNION ALL
18        SELECT 101, TO_DATE('03-Jul-2011', 'DD-MON-YYYY'), 250, 500
19          FROM DUAL
20        UNION ALL
21        SELECT 103, TO_DATE('03-Jul-2011', 'DD-MON-YYYY'), 50, 650
22          FROM DUAL)
23  SELECT   c.tx_code AS tx_code, c.tx_date AS tx_date, NVL(t.amount, 0) AS amount,
24           (SELECT MAX(t.accumlated_amt)KEEP (DENSE_RANK FIRST ORDER BY tx_date DESC)
25              FROM t
26             WHERE t.tx_code = c.tx_code AND t.tx_date <= c.tx_date) AS accumlated_amt
27      FROM (SELECT b.tx_code, tx_date
28              FROM (SELECT     a.min_date + LEVEL - 1 AS tx_date
29                          FROM (SELECT MIN(tx_date) AS min_date, MAX(tx_date) AS max_date
30                                  FROM t) a
31                    CONNECT BY LEVEL <= max_date - min_date + 1) a,
32                   (SELECT DISTINCT tx_code
33                               FROM t) b) c,
34           t
35     WHERE t.tx_code(+) = c.tx_code AND t.tx_date(+) = c.tx_date
36  ORDER BY c.tx_date, c.tx_code
37  /
   TX_CODE TX_DATE       AMOUNT ACCUMLATED_AMT
       101 01-JUL-11        100            100
       102 01-JUL-11        300            300
       103 01-JUL-11        500            500
       101 02-JUL-11        150            250
       102 02-JUL-11          0            300
       103 02-JUL-11        100            600
       101 03-JUL-11        250            500
       102 03-JUL-11          0            300
       103 03-JUL-11         50            650Urs

Similar Messages

  • Query to get total counts in the given scenario

    Hi,
    I am using Oracle 10g
    I have a table A with following data
    AgId     Trm     CD     S
    1000     100010     12-JAN     A
    1000     100019     20-MAR     A
    1000     100019     20-JUL     D
    1001     100011     25-JAN     A
    1001     100011     20-FEB     D
    1001     100011     23-MAR     A
    1001     100012     31-JAN     A
    1002     100013     14-FEB     A
    1002     100013     05-APR     D
    1002     100015     02-MAY     A
    1003     100014     03-MAR     A
    1003     100014     25-MAR     D
    1004     100016     22-MAY     A
    1004     100017     21-JUN     A
    1004     100018     01-JUL     A
    1005     100020     21-MAY     D
    1005     100020     21-JUL     A
    1005     100020     11-AUG     D
    Here the overall status of AgId '1000' is A as he is having atleast 1 Trm active
    Similarly, status of AgId '1001' is A
    status of AgId '1002' is A
    But,status of AgId '1003' is D as his trm is disconnected after activation(according to date column'CD')
    Then, status of AgId '1004' is A
    and finally status of AgId '1005' is D again as his trm deactivated, activated and deactivated at last
    So, considering these criteria can any one give me a query to get total no of AgId's who are 'Active' and similarly for 'Deactive'

    Hi,
    when you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    CREATE TABLE ... etc.
    {noformat}{noformat}
    Also do not forget to put correct statements. Your insert were missing semicolon at the end.
    Coming back to your problem, I assum that the current status of any trm is the latest status so I have done what follows:
    {code:sql}
    SELECT agid
         , trm
         , cd
         , s
         , ROW_NUMBER () OVER (PARTITION BY agid, trm ORDER BY cd) rn
         , COUNT (*) OVER (PARTITION BY agid, trm) rn_tot
    FROM a
    ORDER BY agid, trm, cd;
    Output:
          AGID        TRM CD        S         RN     RN_TOT
          1000     100010 12-JAN-12 A          1          1
          1000     100019 20-MAR-12 A          1          2
          1000     100019 20-JUL-12 D          2          2
          1001     100011 25-JAN-12 A          1          3
          1001     100011 20-FEB-12 D          2          3
          1001     100011 23-MAR-12 A          3          3
          1001     100012 31-JAN-12 A          1          1
          1002     100013 14-FEB-12 A          1          2
          1002     100013 05-APR-12 D          2          2
          1002     100015 02-MAY-12 A          1          1
          1003     100014 03-MAR-12 A          1          2
          1003     100014 25-MAR-12 D          2          2
          1004     100016 22-MAY-12 A          1          1
          1004     100017 21-JUN-12 A          1          1
          1004     100018 01-JUL-12 A          1          1
          1005     100020 21-MAY-12 D          1          3
          1005     100020 21-JUL-12 A          2          3
          1005     100020 11-AUG-12 D          3          3I have used to columns rn and rn_tot to find the latest entry for a specific agid, trm
    Using the query above I have done the following:
    WITH mydata AS
       SELECT agid
            , trm
            , cd
            , s
            , ROW_NUMBER () OVER (PARTITION BY agid, trm ORDER BY cd) rn
            , COUNT (*) OVER (PARTITION BY agid, trm) rn_tot
        FROM a
    SELECT agid
         , CASE WHEN SUM (CASE s WHEN 'A' THEN 1 END) > 0 THEN 'A' ELSE 'D' END s
      FROM mydata
    WHERE rn = rn_tot
    GROUP BY agid;
    Output:
          AGID S
          1000 A
          1001 A
          1002 A
          1003 D
          1004 A
          1005 D
    {code}
    Which is listing the agid and its status if at least there is one trm with final status 'A' for that agid.
    To sum up everything you can do simply like this:
    {code:sql}
    WITH mydata AS
       SELECT agid
            , trm
            , cd
            , s
            , ROW_NUMBER () OVER (PARTITION BY agid, trm ORDER BY cd) rn
            , COUNT (*) OVER (PARTITION BY agid, trm) rn_tot
        FROM a
    totdata AS
       SELECT agid
            , CASE WHEN SUM (CASE s WHEN 'A' THEN 1 END) > 0 THEN 'A' ELSE 'D' END s
         FROM mydata
        WHERE rn = rn_tot
        GROUP BY agid
    SELECT S, COUNT(*) cnt
      FROM totdata
    GROUP BY S;
    Output:
    S        CNT
    D          2
    A          4
    {code}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Calling first query to get parameters for second query

    Newbie trying to convert an Oracle Report to BI. The report has 1 parameter from the user, which is plugged into a query that returns grouped data (4 values, 1 row). This data is then used in multiple places (not just where clause) in a second query to get the data for the report. Can anyone please point me in the right direction to accomplish this?
    I have looked at using a before trigger possibly to get the first query values but am not sure how to then pass those values back to be used by the second query.
    Thank you for ANY suggestions!

    Hello,
    you use any fields in additional querys as parameters.
    If you use XML-data-template, it would look like this:
    <dataTemplate name="INVOICE_REPORT" description="Invoice Report" Version="1.0">
      <parameters>
        <parameter name="P_INVOICE_HEADER_ID" dataType="number"/>
      </parameters>
      <dataQuery>
        <sqlStatement name="QUERY_INVOICE">
          <![CDATA[
    select ivh.invoice_header_id    
         , ivh.invoice_number
         , ivh.customer_id           // here you select the field which is a parameter for next query
          -- ... additional fields ... --
      from tbl_invoices ivh
      where ivh.invoice_header_id = :P_INVOICE_HEADER_ID
        -- and additonal conditions --
    ]]>
        </sqlStatement>
        <sqlStatement name="QUERY_CUSTOMER">
          <![CDATA[
    SELECT c.account_number
         , c.customer_name
         , c.customer_city
          -- ... additional fields ... --
      FROM tbl_customers c
      where c.customer_id = :CUSTOMER_ID // here is the parameter
        -- and additonal conditions --
    ]]>
        </sqlStatement>
      </dataQuery>
      <dataStructure>
        <group name="GRP_HEADER" source="QUERY_INVOICE">
          <element name="INVOICE_HEADER_ID" value="INVOICE_HEADER_ID"/>
          <element name="INVOICE_NUMBER" value="INVOICE_NUMBER"/>
          <group name="GRP_LINE" source="QUERY_INVOICE">
            <element name="ACCOUNT_NUMBER" value="ACCOUNT_NUMBER"/>
            <element name="CUSTOMER_NAME" value="CUSTOMER_NAME"/>
            <element name="CUSTOMER_CITY" value="CUSTOMER_CITY"/>
          </group>
        </group>
      </dataStructure>
    </dataTemplate>          The behavoir is much similar to oracle report
    Regards
    Alexander
    Edited by: alexander.steinbeisz on Dec 7, 2009 12:20 PM
    Edited by: alexander.steinbeisz on Dec 7, 2009 12:21 PM

  • SQL query to get DDL for Adding PK.

    Guys,
    I'm looking for SQL query that gets me the "ALTER TABLE <TABLE_NAME> ADD CONSTRAINT <constraint_name> PRIMARY KEY (X,Y,...);" statments of all tables in my schema containing Primary Keys.
    Could someone help me with the query please?
    Regards,
    Bhagat

    You need this
    SELECT 'ALTER TABLE '||table_name||' ADD CONSTRAINT '||constraint_name||' PRIMARY KEY ('||column_name||');'
      FROM ( SELECT uc.table_name
                   ,uc.constraint_name
                   ,RTRIM (XMLAGG (XMLELEMENT (ucc, column_name || ',')).extract ('//text()'), ',')  column_name
              FROM user_constraints        uc
                  ,user_cons_columns       ucc
             WHERE uc.constraint_type      = 'P'
               AND uc.constraint_name      = ucc.constraint_name
          GROUP BY uc.table_name
                  ,uc.constraint_name
    ORDER BY table_name;   Regards
    Arun

  • Query to get summary for two types of row data

    Hi Friends,
    I have tried using aggregate functions and thought of using analytic functions and still trying... But I am sure some analytic function expert can quickly help me out in this.
    With this data.
    BID_ELMT_SEQ_ID     PRF_NO          BID_REQ_DT          BID_ATRB_TYP_CD          BID_ATRB_VAL
    3575758          1          1/24/2011 2:27:32 PM     MINDAYS               1
    3575758          1          1/24/2011 2:27:32 PM     WRAPDAYS          1-0
    3575759          2          1/24/2011 2:27:32 PM     MINDAYS               1
    3575759          2          1/24/2011 2:27:32 PM     WRAPDAYS          1-0
    3575760          3          1/24/2011 2:27:32 PM     MINDAYS               1
    3575760          3          1/24/2011 2:27:32 PM     WRAPDAYS          1-0
    3575761          4          1/24/2011 2:27:32 PM     MINDAYS               1
    3575761          4          1/24/2011 2:27:32 PM     WRAPDAYS          1-0 Is it possible to retrieve an output similar to this ? In short , the row values of BID_ATRB_TYP_CD to be grouped into two columns and values fetched for this
    BID_ELMT_SEQ_ID     PRF_NO          BID_REQ_DT          MIN_DAYS_VAL     WRAP_DAYS_VAL
    3575758          1          1/24/2011 14:27          1          1-0
    3575759          2          1/24/2011 14:27          1          1-0
    3575760          3          1/24/2011 14:27          1          1-0
    3575761          4          1/24/2011 14:27          1          1-0 Regards,
    SSN

    Looks pretty simple to me - I haven't tried it yet.
    Can you share what you have tried so far and what has been the outcome of that effort?

  • Alert Entry for Missing Data File

    I am trying a simple recovery scenario: deleting a data file of a normal tablespace when the database is running, and the data file has been backed up.
    Before shutdown, checkpoint completes normally (I guess Oracle still keeps the file inode handle). When I select from dba_data_files, error occurred:
    SQL> alter system checkpoint;
    System altered.
    SQL> select count(*) from dba_data_files;
    select count(*) from dba_data_files
    ERROR at line 1:
    ORA-01116: error in opening database file 10
    ORA-01110: data file 10: '/u01/oradata/data01.dbf'
    ORA-27041: unable to open file
    Linux Error: 2: No such file or directory
    Additional information: 3To my surprise, nothing was recorded in the alert log. And no trace files generated in udump. And Oracle refused to restore the datafile when it was running.
    Message appeared in alert log when I try to shutdown the database. After shutdown abort (Oracle refused to shutdown immediate) and restart instance, I was able to restore and recover the data file.
    Is this the expected behaviour? If so, how would you detect missing datafiles when db is running?
    Oracle: 9.2.0.6, OS: RHEL3

    1. It wasn't detected by the checkpoint caused by a switch logfile because the file isn't actually missing. As others -inded you!- have said, on Unix/Linux, you can delete a file at any time, but if the file is in use, the inodes remain allocated and the process using it continues to see it very much as there. Because, at the inode level, it absolutely IS still there! Incidentally, it was pointless telling you to do a switch logfile, because as far as datafiles are concerned, that doesn't do anything the alter system checkpoint command does that you'd already tried.
    I used to do demos of how to recover from the total loss of a controlfile in Oracle University classes: I'd do a flurry of rm *.ctl commands, and then dramatically issue the checkpoint command... and nothing at all happened. Very demoralising first time I did it. Issue a startup force, however, and at that point the inodes are released, the files really are deleted and the startup falls over in the nomount state. Bouncing the instance was the only way I could get the database to protest about the removal of a datafile, too.
    2. No, if a file went missing in a way that Oracle could detect, it wouldn't matter if the file was empty, because it cares about the presence/absence of the datafile headers. They have to be updated, even if nothing else does.
    3. It would only be in the alert log if SMON detected the lost file at startup (one of its jobs is, explicitly, to check for the existence of all files mentioned in the control file). CKPT wouldn't raise an alert, because as far as it's concerned, nothing's wrong. The inodes are still held, after all. Your attempts to create tables and so on inside the lost file do generate display errors because (I think) at that point it's your server process that is attempting to do things to the file, not CKPT or other pre-existent, permanently-running background processes.
    4. It's specific to Unix, anyway, of which Linux is a variant.

  • To get output for latest date

    hi
    i have this query with me
    SELECT t1.phnum AS phone, t2.email AS emailid, t2.pin AS pin, t1.lang AS lang
      FROM cust_profile t1, profile_set t2, user_login t3
    WHERE t2.email IS NOT NULL
       AND t1.phnum = t2.phnum
       AND t1.phnum = t3.phnum
       AND t3.devicetype = 2
       AND EXISTS (
              SELECT dtn
                FROM div_call_log
               WHERE (MOD ((TRUNC (SYSDATE) - TRUNC (callstart)), 7) = 0)
                 AND callstart < SYSDATE - 7
                 AND dtn = t1.phnumi want to get output only for the latest callstart date ,now its showing output corresponding to earlier dates not latest date
    how to use max (callstart) in the where clause
    kindly guide me

    Hi
    thank you for the quick response
    dtn     callstart
    97845857     04/06/2011 19:24:09
    97845857     05/18/2011 13:38:54
    97845857     06/15/2011 07:49:59
    97845857     06/22/2011 11:16:09
    97845857     06/22/2011 11:19:14
    97845857     06/22/2011 09:31:48
    97845857     06/22/2011 10:17:13
    97845857     08/03/2011 17:49:36
    97845857     08/03/2011 17:51:30
    97845857     08/03/2011 18:22:37
    97845857     08/03/2011 18:23:31
    97845857     08/03/2011 18:24:23
    97845857     08/03/2011 18:26:28
    97845857     08/03/2011 18:40:53
    97845857     08/10/2011 11:42:58
    97845857     03/30/2011 19:51:05
    97845857     05/18/2011 09:11:38
    97845857     06/22/2011 11:21:24
    97845857     05/18/2011 13:21:53
    97845857     08/03/2011 17:46:11
    97845857     08/03/2011 17:47:13
    97845857     08/03/2011 18:03:49
    97845857     08/03/2011 18:28:06
    97845857     04/20/2011 14:09:32
    97845857     04/27/2011 10:23:55
    97845857     03/16/2011 07:20:19
    97845857     03/30/2011 12:32:06
    97845857     08/03/2011 17:45:21
    97845857     08/03/2011 18:25:11
    97845857     08/03/2011 18:30:17
    97845857     04/20/2011 14:08:32
    97845857     03/30/2011 12:32:46
    97845857     03/30/2011 19:52:11
    97845857     03/16/2011 07:16:32
    97845857     09/07/2011 12:09:58
    97845857     09/07/2011 16:07:33
    97845857     09/07/2011 16:10:44
    97845857     09/21/2011 18:10:39
    97845857     09/07/2011 17:08:46
    97845857     09/14/2011 20:33:45
    97845857     10/05/2011 18:02:11this is the data in div_call_log table , I want the latest value of callstart from this table corresponding to the phone number, but always i am getting the first value(04/06/2011 ) as callstart
    kindly guide
    thanking in advance
    Edited by: makdutakdu on Jan 25, 2012 9:41 AM
    Edited by: makdutakdu on Jan 25, 2012 9:43 AM

  • How to get count for missing month

    I created a view as follows:
    CREATE OR REPLACE FORCE VIEW "Vinfection1" ("MONTH", "COUNT") AS
    select "MONTH","COUNT" from (
    select to_char(s.pdate,'Mon-yyyy') as month, count(*) as count
    from surproc s, diagnosis_surproc d
    where s.surprocid = d.surprocid and d.diagnosisid in ('506', '507', '508', '509', '510')
    group by to_char(pdate,'Mon-yyyy'))
    order by to_date(month,'Mon-yyyy')
    Some months are missing in the view. I want to put that month and 0 in the view. How to do it?
    Thanks,
    Jennifer

    Hi, Jennifer,
    You need to outer-join to some table or result set (such as all_months, below) that has one roe per month.
    Here's one way:
    CREATE OR REPLACE FORCE VIEW Vinfection1 (month, month_s, cnt) AS
    WITH    all_months     AS
         SELECT  ADD_MONTHS (first_month, LEVEL - 1)     AS month
         FROM     (
                  SELECT  TRUNC (MIN (pdate), 'MONTH')     AS first_month
                  ,         TRUNC (MAX (pdate), 'MONTH')     AS last_month
                  FROM    surproc
         CONNECT BY     LEVEL <= 1 + MONTHS_NETWEEN (last_month, first_month)
    SELECT  a.month
    ,     TO_CHAR (a.month, 'Mon-yyyy')     AS month_s
    ,     COUNT (*)                 AS cnt
    FROM              all_months      a
    LEFT OUTER JOIN      (     surproc               s
                   JOIN   diagnosis_surproc      d  ON   s.surprocid     = d.surprocid
                                          AND  d.diagnosisid     IN ('506', '507', '508', '509', '510')
               )     ON  a.month     = TRUNC (s.pdate)
    GROUP BY  a.month
    /Avoid table- and column names that are non-standatrd (such as names that need double-quotes), or are built-in function names (such as COUNT).
    Don't use ORDER BY in a view. Almost anything you do with the view will cause the ordering to be lost anyway.
    Even if you do have an ORDER BY clause in the view, you'll often want to ORDER BY month. Rather than call TO_DATE whenever you need to sort, I suggest having two month columns; month (whcih is a DATE) for sorting, filtering and joining, and month_s (whcih is a VARCHAR2) for displaying.
    Use ANSI join syntax, especiallly for outer joins.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Mar 20, 2012 12:03 PM
    Added outer join condition

  • Report Total Wrapping/Missing Data in CSV FIle

    PROBLEM:
    We have an application were the totals in the report region will wrap when the total is negative and formatted with a negative sign preceding the number (e.g. -43,567.99). The wrapping results in users being confused to wether or not a value is negative or positive. We want all non-numeric columns to wrap so that the user does not have to scroll horizontally.
    SOLUTIONS TRIED
    1. Set the CCS Style attribute of a column to white-space:nowrap.
    The value of CCS Style is inserted into span tags associated with a column value which in turn elliminates the wrapping in the detailed area of the report. However, I have no found a way to insert this type of span tag to the Total of a report region.
    2. Modifying the format mask to present negative numbers in brackets (e.g. <43,567.99>).
    This solves the wrapping issue . . . however results in a problem when outputting the report to a CSV file. When outputting to a CSV file the negative number that have been formatted using bracket are not included in the output. I believe that it interprets them as html tags <> and therefore eliminates them from the output.
    3. Create duplicate amount columns in the report and apply a number format that places a negative sign in front of negative numbers and make this column display conditionally for CSV output only Then change the original column format mask to use brackets. Although this will work it seem a bit clunky, results in unnecessary pull of excess data and will require a lot of re-work/re-testing of our system.
    REQUEST
    Does anyone have any ideas on how I might either:
    1. Add white-space:nowrap to the totals of the report region
    2. Overcome the exclusion of negative numbers containing brackets from the CSV output.
    3. HAve another approach to resolving this wrapping issue.
    Thanks,
    David

    According to this article http://www.cs.tut.fi/~jkorpela/html/nobr.html this is a known wrapping issue with Internet Explorer. Wrapping will occure when the following characters exists -()[]{}«»%°·\/!?. The author of the article suggest that the only way around this issue is too place -a or use white-space:nowrap in a [td] or [tr] tag.
    This would suugest that I need to find a way to add html to the total column in the htmldb report . . . which I don't believe I can do . . . Does anyone know of a way to insert html into these total columns similiar to how we can be done using the CCS Style or HTML Expression attributes.
    Thanks,
    David.

  • Getting Records for Blank Date Field

    Hi All,
    I am trying to get all the records with blank Calday values, but not able to get the data in listcube or Query? how can I get this without using boolean function, range or manipulating data, in query i tried to restrict using # but no luck.
    Thanks,
    S.B.

    In the listcube, click on calday and when a selection comes on
    in the box of calday right click and option -> equal and leave
    blank the field. That will display everything blank
    Thanks
    Wons

  • Query to get summarized and detailed data

    Hi experts,
    The scenario is as follows:
    Generic extractor -> DSO -> Infocube
    Now, the cube have item level details. My concern is, the cube might grow very big and impact the performance.
    Is it possible to have a query that retrieves summarized information from the cube and for details do a jump to target to the DSO and get the details?
    Pls give me a hint on this.

    Yes you can have summerized query on Cube & item level query on DSO.
    Using RRI (tcode RSBBS) you can jump from Summerized Query to Detailed Query.
    You can also pass values from summerized query to detailed query through RRI if required, provided the same infoobject is used in both cube & DSO.

  • Need to create at BEX Query to get last 30 days data.

    Hi,
    I need to create a bex query based on input date need to calculate last 30 days outstanding and 31-60 days outstanding 61-90 days outstanding 91-180 days outstanding and greater than 180 days outstanding. Please find the format of the report.Kindly help me.
                                                                                                                          Thanks & Regards,

    Based on those documents you can easily create.
    1. First create variable (Mandatory) user input
    2. Posting date is avaialble as char you will get
    3. need to calcualte difference b/w those 2 dates  you can refer below  By using replacement path we can convert both dates into get difference.
    http://www.sd-solutions.com/SAP-HCM-BW-Replacement-Path-Variables.html
    4. now need to create  Bucketing logic  formula  as per requirement above documents will give idea.

  • Query to get the current DB date, not server date

    Hi,
    We have few DB in one server, but each DB have different timezone.
    How can I get the query to generate the current date in each DB?
    Thanks

    Hi,
    Try this query:
    SELECT DB_NAME() AS DataBaseName,getdate()
    Thanks & Regards,
    Nagarajan

  • Total for line data

    Hi All,
    We are using BW 3.5 and SAP R/3. Data for sales is updated in BW as line data.
    Plant Bill Till Article NetAmt
    1      1     1    a        10
    1      1     1    b        15
    1      1     2    c         20  
    2      1     1    c         20
    3      1     1    a         10
    Now we want
    Plant Bill Till NetAmt
    1        1    1     25
    2        1    1     20
    3        1    1     10
    1        1    2     20
    How to add line data while loading? 
    Thanks
    Regards: Gaurave

    I'm not sure if you still need the answer to this:
    - You would add a new Net Total key figure to your Info Provider.
    - Create an start routine to calculate your total per your key (Plant, Bill, Till, total).  Use a collect statement to calculate subtotals.
    - In your update rules, read the internal table based on the key (Plant, Bill, Till) from the comm_structure.
    Hope this help.  Please assign points if it does.
    - Rudy

  • Getting result for current date

    Hi,
    I have a problem on getting the following result
    CO_ID   RECEIVE SHIP_OUT ONHAND OPENING DATE            GR_ID   COMPONENT_NAME
    100     0     0      9     9     24-JUN-09     234     Paper
    200     8     0      8     0     25-JUN-09     123     Plastic Bag
    100     10     0      19     9     25-JUN-09     234     Paper
    200     0     0      8     8     26-JUN-09     123     Plastic Bag
    100     0     0      19     19     26-JUN-09     234     Paperwith this, it doesn't add a new result on tomorrow record, and today record also not correct. Help me pls....
    PROCEDURE Inv_Rec IS     
              dToDate          DATE := TO_DATE(SYSDATE, 'DD-MON-YY');
                    dLoopDay     DATE := TO_DATE(SYSDATE - 1, 'DD-MON-YY');
                    rDayBeforeInvRec      Inventory%ROWTYPE;
              rInDateInvRec           Inventory%ROWTYPE;
              fInDateOnHandQty    FLOAT;
              fInDateOpeningQty FLOAT;
                    fBForeDateOpeningQty  FLOAT;
                    fBForeDateOnHandQty   FLOAT;
              nComponentId     NUMBER(25);
              vCompDept     VARCHAR2(20);
              vCompName     VARCHAR2(80);
              vWasteType     VARCHAR2(2);
              nGroupId     NUMBER(25);
              vComponentName     VARCHAR2(80);
        CURSOR Day_Before_Inv_Bal IS
                   SELECT * FROM inventory
                   WHERE date = dLoopDay;
              CURSOR InDate_Rec_Exist IS
                   SELECT * FROM inventory
                   WHERE date = dToDate
                   AND co_id = nComponentId
                   AND gr_id = nGroupId
                   AND component_name = vComponentName;
         BEGIN
              WHILE dLoopDay <= dToDate + 1
              LOOP
                        OPEN Day_Before_Inv_Bal;
                   LOOP
                        FETCH Day_Before_Inv_Bal INTO rDayBeforeInvRec;
                        nComponentId     := rDayBeforeInvRec.co_id;
                        nGroupId     := rDayBeforeInvRec.gr_id;
                        vComponentName     := rDayBeforeInvRec.component_name;
            fBForeDateOnHandQty := rDayBeforeInvRec.opening +
                    rDayBeforeInvRec.receive - rDayBeforeInvRec.ship_out;
                UPDATE inventory SET
                                       ONHAND  = fBForeDateOnHandQty                         
                                  WHERE date = dLoopDay
                                  AND co_id = nComponentId
                                  AND gr_id = nGroupId
                                  AND component_name = vComponentName;
                        OPEN InDate_Rec_Exist;
                             FETCH InDate_Rec_Exist INTO rInDateInvRec;
                             IF InDate_Rec_Exist%FOUND THEN
                                  fInDateOpeningQty := fBForeDateOnHandQty;
                                  fInDateOnHandQty      := fBForeDateOnHandQty + rInDateInvRec.onhand
                - rInDateInvRec.ship_out;
                                  UPDATE inventory SET
                                       OPENING = fInDateOpeningQty,
                                       ONHAND  = fInDateOnHandQty                              
                                  WHERE date = dloopday + 1
                                  AND co_id = nComponentId
                                  AND gr_id = nGroupId
                                  AND component_name = vComponentName;                              
                             ELSE          
                                       fInDateOpeningQty := rDayBeforeInvRec.wwin_onhand;
                                       fInDateOnHandQty      := rDayBeforeInvRec.wwin_onhand;
                                       INSERT INTO wste_waste_inventory (
                                            CO_ID,
                                            RECEIVE,
                                            SHIP_OUT,
                                            ONHAND,
                                            OPENING,
                                            DATE,
                                            GR_ID,
                                            COMPONENT_NAME )
                                       VALUES (
                                            nComponentId,
                                            0,
                                            0,
                                            fInDateOpeningQty,
                                            fInDateOnHandQty,
                                            dToDate,
                                            nGroupId,
                                            vComponentName );     
                             END IF;               
                        CLOSE InDate_Rec_Exist;
            EXIT WHEN Day_Before_Inv_Bal%NOTFOUND;
              END LOOP;
            CLOSE Day_Before_Inv_Bal;
          COMMIT;
          dLoopDay := dLoopDay + 1;
              END LOOP;
         COMMIT;     
         END Inv_Rec;Edited by: newBJeat on Jun 25, 2009 1:28 AM

    You want:
    TRUNC(sysdate)if you don't want the time element of a DATE variable.
    When you to_date something that's already a date, you introduce a bug, as it forces some implicit conversions:
    eg:
    to_date(sysdate, 'dd/mm/yyyy')becomes
    to_date(to_char(sysdate, <default nls_date_format parameter>), 'dd/mm/yyyy')If your default nls_date_format parameter happens to match the format mask you specify, then you're lucky and the code will work. However, someone with a different format will have an error.
    Don't EVER to_date something that's already a date.

Maybe you are looking for

  • How to stop the backup process....

    How to stop the backup process.... Okay, so it happens nearly everytime you synch your iPhone with your iTunes? Easy. As soon as it starts, hit the "X" in the bar where the backup process is being shown, this does NOT STOP the synching process, ONLY

  • Upload videos using Mobile safari

    i am working on a asp.net web app.This app is mainly related with media in which user have to upload images and videos.It works fine on other browsers rather than mobile safari. I had solved one problem here by using picup app but now problem is how

  • HTTP Connection using GET request

    We have a J2ME app which is accessing a server using an HTTP Connection. We were using a POST to send the data but kept getting an HTTP/1.1 100 Continue from the server. This is annoying since it's extra code to work around this issue (should be hand

  • AGMac-Change "Chapter" and "Section" concepts...

    Hello, I started a new book in iBooks Author 2.0 and I renamed the chapter header in my language (Greek)... In any iBooks document there are also the concepts of "Chapter" and "Section"... For example in the "Table of contents" exists at the top "Cha

  • USER UPDATE가 안되는 문제 ORA-20001 ORA-06512

    제품 : AOL 작성날짜 : 2002-11-29 USER UPDATE가 안되는 문제 ORA-20001 ORA-06512 ======================================= PURPOSE Problem Description SQL> exec fnd_user_pkg.UpdateUser('LGESSO','SEED', 'lgesso2'); BEGIN fnd_user_pkg.UpdateUser('LGESSO','SEED', 'lges