Help: Output Format complex

Hello

Data in TAB_DTL for an APPID using, I need to generate a report in the following format.
CREATE TABLE TAB_DTL
(
APPDATE          DATE,
AMOUNT          NUMBER(12,2),
STATUS          VARCHAR2(1),
RATE          NUMBER(5,2)
);

INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '13/09/2011 10:50:45 AM','DD/MM/YYYY HH:MI:SS AM'), 500000, 'D', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '09/11/2011 1:15:30 PM','DD/MM/YYYY HH:MI:SS AM'), 5000, 'R', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '15/12/2011 3:20:31 PM','DD/MM/YYYY HH:MI:SS AM'), 5000, 'R', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '05/01/2012 10:25:11 AM','DD/MM/YYYY HH:MI:SS AM'), 5000, 'R', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '02/02/2012 4:23:34 PM','DD/MM/YYYY HH:MI:SS AM'), 5000, 'R', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '05/03/2012 11:15:45 AM','DD/MM/YYYY HH:MI:SS AM'), 5000, 'R', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '30/03/2012 11:55:10 AM','DD/MM/YYYY HH:MI:SS AM'), 5000, 'R', 13 );
INSERT INTO TAB_DTL ( APPDATE, AMOUNT, STATUS, RATE ) VALUES TO_DATE( '31/03/2012 11:59:00 AM','DD/MM/YYYY HH:MI:SS AM'), 470000, 'B', 13 );


OUTPUT FORMAT :

APPDATE                    DR          CR     BALANCE          ACCAMT     DAYS     CUMM      
13/09/2011 10:50:45 AM          5,00,000.00     0     5,00,000.00     10301     58     10301
09/11/2011 1:15:30 PM          0          5000     4,95,000.00     6330     36     16631
15/12/2011 3:20:31 PM          0          5000     4,90,000.00     3655     21     20286
05/01/2012 10:25:11 AM           0          5000     4,85,000.00     4823     28     25109
02/02/2012 4:23:34 PM          0          5000     4,80,000.00     5456     32     30565
05/03/2012 11:15:45 AM          0          5000     4,75,000.00     4218     25     34783
30/03/2012 11:55:10 AM          0          5000     4,70,000.00     334     2     35117
31/03/2012 11:59:00 AM          0          0     4,70,000.00     35117
For the calculation of A logic) DAYS: difference in days of the next later Date
(B) ACCAMT: Balance * (unlike in the days of the next Date) * rate / days in the year

With the help of CASE / SQLs of LEAD, the same thing can be accomplished.

Thank you

Tags: Database

Similar Questions

  • Change default value of output format you 'Keynote 09 '.

    Hi all

    I use Keynote 6.6.2 and I need your help to know how to use the 'Keynote ' 09"as the default output format, without an export each time.

    In my company, I'm the only one with this version of Keynote, if no one else can use my files and allows us to work on the same files really often!

    Thank you for helping me.

    Kind regards

    Nicolas

    The only way to create 09 files from Keynote 6.6.2 is to use file > export > Keynote 09

  • Met an output Format of D3D (unknown) on Windows Vista 32-bit, what this could be?

    Output format unknown D3D on Windows Vista, while trying to activate the game simulator of mining & Tunnelling?

    Need help!
    Jack

    Hello

    D3D error could be because the DirectX wrong on the computer.

    Download and install the latest version of DirectX from here:

    Use DirectX Runtimes (June 2010): http://www.microsoft.com/en-us/download/details.aspx?id=35

    If DirectX update does not help because the error is activation, you can contact Tunneling and mining simulator manufacturer for more assistance.

  • Output formatting in a sql

    Hello

    I have 4 columns, I need the output format using carriage returns between values and removing the label for nulls, such as only the columns filled with values are displayed:

    Name: emp.first_name

    Medium: emp.middle_name

    Name: emp.last_name

    Address (line 1): emp.ext_contact_addr1

    for example: -.

    If the name is null then output would be

    Middle: Thomas

    Family name: James

    Address (line 1): 10 william st

    If the name is null, then output would be

    First name: Tessa

    Family name: James

    Address (line 1): 10 william st

    etc...

    Please help me.

    Hello

    Here's a way

    SELECT LTRIM (NVL2 (emp.first_name

    , ' Name: '. EMP.first_name

    NULL

    )

    || NVL2 (emp.middle_name

    , CHR (10) | ' Average: ' | EMP.middle_name

    NULL

    )

    || NVL2 (emp.last_name

    , CHR (10) | ' Last name: ' | '. EMP.last_name

    NULL

    )

    || NVL2 (emp.ext_contact_addr1

    , CHR (10) | ' Address (line 1): ' | EMP.ext_contact_addr1

    NULL

    )

    , CHR (10)

    ) AS output_string

    WCP

    ;

    Using NVL2 like this, the label for each line gets concatenated only if there is some data to go with it.

    If the name is NULL, which means that the output_string will begin with a character of new line (which is CHR (10) on my system, you may need to change this).   I used LTRIM to remove this first newline character, if there be one.

    You can also consider the results of unpivoting so that you have between 0 and 4 lines in the result set for each row in the emp, with 4 items on separate lines.

  • Exit help request formatting

    Hi all

    I have problems trying to format the output of one of my questions. I'm new to SQL and I consider my writing the query to a GREAT victory... but I can't seem to get the correct output format.

    With the code below, she's the name (lname) in the employee, a county of what I want and the overall standings.  I want to concatenate the employee number (emp #) the first (fname) and name (lname) together in the same column in the output.

    Concatenation code would be something like below.

    Desired concatenation:

    EMP # | ' - ' || lname | ', ' || fname AS EMPLOYEE


    I'm using Oracle 11 g Express. Please let me know if you need any information to help you.

    I appreciate your help! Thank you.

    Query

    SELECT EMPLOYEE, PREPARED,

    Rank() over (ORDER BY DESC prepared) AS rank

    FROM (SELECT lname EMPLOYEE, COUNT (DISTINCT reportnum) PREPARED

    The EMPLOYEE

    LEFT OUTER JOIN faultreport using (empno)

    GROUP BY lname

    ORDER BY DESC prepared)

    WHERE rownum < 15;




    Hello

    Thus, you do not want to group by the concatenated employee, lname not only.  Here's a way to do it:

    WITH got_rnk AS

    (

    SELECT e.empno. ' - '

    || e.Lname

    || ', '

    || e.fname AS an employee

    COUNT (DISTINCT f.reportnum) AS prepared

    Rank () OVER (ORDER BY COUNT (DISTINCT f.reportnum) DESC)

    LIKE rnk

    E employee

    LEFT OUTER JOIN faultreport f ON f.empno = e.empno

    GROUP BY e.empno, e.lname, e.fname

    )

    SELECT *.

    OF got_rnk

    WHERE rnk<>

    ORDER BY rnk

    employee

    ;

    You only need the subquery if you want to limit output employees to the top 14 (or whatever the number).

    Analytic functions (for example, RANK) are calculated after the clause GROUP BY has been applied and aggregate (such as COUNT above) functions were calculated.  This is why you can use an aggregate function in an analytical clause (e.g. "RANK () OVER (ORDER BY COUNT...)"

  • SQL output format

    Dear all,

    Select emp_no in emp;

    my output is

    1

    2

    3

    4

    But I want that as output format

    1,2,3,4

    Could you please tell me which application should I write it to achieve.

    Concerning

    Rajat

    Hi, Rajat,

    This is called the aggregation of the chain and this page:

    ORACLE-BASE - String aggregation Techniques

    shows several ways to do so.  What sense does use?  It depends on your requitrements and your version of Oracle.  The LISTAGG built-in aggregate function is good for most purposes.

  • Question output formatting

    Hello community! Sorry, it's so rudimentary. Can anyone offer advice on how to better format the output of the below? As it is, it prints it just without formatting - I want out as the output format-table and I would have zero decimal places in the output of Write-Host $CurrentItemHdd.CapacityGB.  Thank you!

    foreach ($VmItem to $MyVms)

    {

    $CurrentItemHdd = get-disk hard - VM $VmItem

    Write-Host $VmItem.Name $CurrentItemHdd.CapacityGB

    }

    To create an exit in your PowerCLI script like the Format-Table output, you must create an output object. There are several ways you can do. One way is to use the PowerShell New-Object as shown in the below script cmdlet. The properties in the New-Object cmdlet output are not classified. That's why I redirect the output to the Select-Object cmdlet to order.

    Your original script will generate a table for the CapacityGB property, if a virtual machine has more than one hard drive. That's why I introduced a second foreach to browse the hard drives. Because you probably want to know that CapacityGB belongs to the hard drive, I added the property 'hard drive '.

    [Math] .NET: Round() function is used to supplement the CapacityGB to zero decimal places.

    The character '&' at the beginning of the script and the scriptblock around the script are necessary to allow to channel the output of the script to another cmdlet as Export-CSV. foreach is not a cmdlet, and therefor you cannot use the out of foreach in the pipeline without using this trick.

    & {foreach ($VmItem to $MyVms)

    {

    foreach ($CurrentItemHdd in (Get-disk hard - VM $VmItem))

    {

    New-Object PSObject-property @ {} TypeName

    VM = $VmItem.Name

    "Hard drive" = $CurrentItemHdd.Name

    CapacityGB = [Math]: Round($CurrentItemHdd.CapacityGB,0)

    } |

    Select-Object - property, CapacityGB VM, 'Hard drive'

    }

    }}

    Post edited by: Robert van den Nieuwendijk

  • Simultaneous report runs very slowly when the output format is 'XML' on IBM 6.1

    We have recently updated one of our test server database IBM AIX 5.3 to 6.1 operating system. We are witnessing a strange question in the execution time-out of simultaneous reports that have output in XML format (no server of publication and the Publisher). Whenever the output format is set to XML, the execution time seem to have increased very high than it used to be less than 5.3. A report to take 10 seconds which takes about 4 minutes to complete which is huge in comparison. Information about the version as below

    Oracle EBS 11.5.10

    Oracle 10.2.0.4.0 DB

    IBM AIX 6.1 OPERATING SYSTEM

    Oracle reports 6.0.8.28.0 (I know old enough)

    Provide expert advice.

    Thank you!

    All the

    We have solved the problem. I would like to share for the benefit of the readers of the community, if they are facing similar problems.

    The reason for the slowness of the report was due to lack of installation of the 'VIEW' option that is used when XML reports. Reports whose outputs are in format PDF, XML, HTML etc, Post Script, they all need a virtual display makes setup and configuration properties of config pointing to this server whenever settings are do. It could be a windows machine with X-Server running on it for display purposes or it could be services that are running on the same server for Unix/Linux applications where the application runs. We have installed VNC as X-Server that hosts services for virual (X) output for display on UNIX itself and have configured it in the reports configuration file. It seems to have solved the problem and the reports are run as expected (must faster!)

    Thank you

    Girish

  • ud32 output format

    Hi all

    We use ud32 to test service using fml32 buffer. One of the result field is a double, when the value of the field data are displayed in exponential format.

    Is it possible config output format? I don't want no exponential format. Its config possible in ud32?, it's a shell config?

    I thank in advance.

    Hello

    Unfortunately, there is not a way to control the release of ud/ud32. It just uses Fprint() which uses the format string "%g" to print floats and doubles. What you're asking for sounds reasonable. As an alternative it would be not difficult to use a script (awk or other) to convert the exponential value to format numbers in no exponential format.

    If you really need, I would suggest opening and enhancement with the Oracle customer support request.

    Kind regards
    Todd little
    Chief Architect of Oracle Tuxedo

    PS ud/ud32 is really a pretty simple utility and it reproduce yourself would not be a lot of work.

  • Error in the REST Web Service with the text output Format

    Hi all

    I am referencing a REST web service and can successfully connect to it and retrieve the results with the output XML value Format.

    I don't need the node values, I want to just grab the entire XML string and fill a table with her column.

    When I create a new Rest web service reference, including the text output Format value and then create a form/report to run it, I get the following error when I click on "send":

    ORA-06550: line 1, column 63: PLS-00103: encountered the symbol "end-of-file" when expects it one of the following numbers: (- + new case mod not null to other current County avg exists max min prior sql stddev sum variance execute forall time timestamp interval date fusion pipe)
    Error sending request.

    There is control in the XML characters, but surely, this is handled by the Apex, so I'm not sure what the problem is here.

    Any ideas most welcome.

    Thank you
    Rhodri

    Rhodri:

    Request Express waiting for answer text actually be answer text, delimited by other characters that denotes a new value and a new Recordset. You should leave the response as XML. The XML document will be stored in the column xmltype01 in the collection that you specify. You can then convert this column xmltype01 in a clob, if you like using the. toClobVal().

    Kind regards

    Jason

  • HP 50 g RPL program to list the factors needing help the formatted output; Matrices, vectors, lists, etc.?

    Hello

    I have not always perfer the output of the DIVIS HP 50 g.

    DIVIDED lists all the factors of a number in a way that is ineffiecent and confusing when there are many factors of a given number.

    For example, when you run 1000 DIVIS you are treated to a large "block" of numbers organized vertically in such a way that only 4-5 of the 16 factors of 1000 are still visible to you without additional keys.

    I'm trying to create a program that simply formats the output of DIVIS differently when there are a lot of factors for a given number. I'm a newbie to the USER RPL. I have the factors that come out a while loop in this format. (100, 10) Unfortunately, my time loop depends on these factors enters NOT the battery until AFTER he calculated all the. I need to find a way to store a set of factors by the execution of the loop in a kind of variable, and then remind each other both on the stack at the end of the program execution. If the code is necessary for you to see, I can post it. The problem is that it is unclear how many factors will be present at this stage. It will be the original number / 2 because I have through each pair of factor in jurisdiction parens with R-> C. In addition, the capture method must be in the loop because that if it is not the loop won't work correctly because the method by which he organized the factors in their concerned couples depends on a process of battery undisturbed during the execution of the loop. Leaving the parens at the bottom of the battery causes there are an odd number of factors in the stack, which invalidates my program for various reasons. In addition, it would be useful to include a function that could test whether or not the number of factors of an odd number, because I will need to include separate code for this. I don't know any such function in USER - RPL, but I am a beginner in this area. Thanks for any help!

    Zekelegge

    Ranothil wrote:
    (...)

    For 1000, my dream program would output;

    (...)

    Try this:

    ' DUP DIVIS SWAP ON / SWAP R-> C EVAL.

    or:

    "DIVIS DUP DUP SIZE 2 / 1 SWAP SUB DUP UNROT / R-> REVLIST C EVAL.

  • Helps the formatting of multi-line output in comma sorted output

    I have 2 tables:
    ####################################
    SQL > table_1 desc;
    Name Null? Type
    ===================================
    ID NOT NULL NUMBER
    DATA1 NOT NULL VARCHAR2 (440)
    DATA2 NOT NULL VARCHAR2 (1024)
    ####################################
    SQL > table_2 desc;
    Name Null? Type
    ===================================
    ID NOT NULL NUMBER
    ATTNAME NOT NULL VARCHAR2 (255)
    ATTVAL VARCHAR2 (4000)
    DATA1 NOT NULL CHAR (1)
    DATA2 VARCHAR2 (2000)
    DATA3 VARCHAR2 (255)
    ####################################
    I need to get ATTVAL where for example ATTNAME = att_name1 to ATTNAME = att_name6 for each entry (with its unique ID) and format the output to the format delimited by commas in for example the following order:
    att_val1, att_val3, att_val6, att_val4, att_val5, att_val6

    So e.g. entry with ID "9812" the query below, the output I need would be:
    187,179,156,134,1436,1809

    What I have so far is the following:
    ####################################
    SQL > SELECT id, attname, attval FROM table_2 WHERE id in (SELECT id from table_1 WHERE data2 = "xxx")
    AND attname in ('att_name1', 'att_name3', 'att_name6', 'att_name4', 'att_name5', 'att_name6');

    ID ATTNAME, ATTVAL
    ===============================
    1970 att_name1 123
    ABC att_name2 1970
    1970 att_name3 1234
    def att_name4 1970
    1970 att_name5 1134
    ghj att_name6 1970

    9812 att_name4 134
    9812 att_name5 1436
    9812 att_name3 156
    9812 att_name1 187
    9812 att_name2 179
    9812 att_name6 1809

    77 att_name1 1980
    77 att_name5 1867
    77 att_name3 174
    77 att_name4 1345
    77 att_name2 1345
    77 att_name6 1345
    ...
    ####################################

    but I don't know how to format the decimal output limited in certain order. (or if it's the best way to get the data)
    Anyone idea how this could be done?

    846954 wrote:
    Thanks Frank!

    I got a lot further now :).
    I've got Oracle 10 g so I used the "SYS_CONNECT_BY_PATH' for my query.

    Now, I get the output in the format I want, however, it comes out in order that are the attributes (which is pretty random).

    The values you have posted are in order: "attval1."< 'attval2'=""><>

    So I use it now (had to use "|" as the separator because SYS_CONNECT_BY_PATH wouldn t with comma because of the attval have comma in them sometimes):

    Do not contain the values that you have posted and commas.

    You hide what is the problem. It would really help if you posted real data. It is always helpful if you post the CREATE TABLE and INSERT statements for some examples of data and outcomes from these data.

    Assuming that you really have something that needs to be in a certain order, and that order is not based on what in the values themselves, then DECODE might be a good way to do it. Store the value of sorting in a table can be even better.

    It seems that you use an exanple Oracle 9. In Oracle 10, using SYS_CONNECT_BY_PATH is simpler:

    SELECT     id
    ,     LTRIM ( SYS_CONNECT_BY_PATH (attval, '|')
               , '|'
               )          AS attvals
    FROM     (
              SELECT     id
              ,     attval
              ,     ROW_NUMBER () OVER ( PARTITION BY  id
                                  ORDER BY          DECODE (...)
                                )     AS curr
              WHERE     id     IN (
                             SELECT  id
                             FROM     table_1
                             WHERE     data2     = 'xxx'
                             )
              AND     attname     IN ('attname1','attname2','attname3','attname4','attname5','attname6')
         )
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     curr     = 1
    CONNECT BY     curr     = PRIOR curr + 1
         AND     id     = PRIOR id
    ;
    

    You don't need two almost identical ROW_NUMBERs; We do it very well.

  • Need help output PDF in bigger format!

    I am trying to create a banner of 36 "x 94". I designed it with Quark Xpress 8.5, which does not allow for models that large, that's why I created the banner at 25%. I intended to create a PDF of it to 400% for the printer (using Acrobat X), but I can't figure out how to do this, because I don't have an option of page size that is large enough. Help, please!

    You cannot print to PDF to 400%, but your printer should be able to take the pdf file and print the pdf to the scale of 400%. If this isn't the case, it's time for a new printer.

  • Excel output format in the xml editor question field

    Hi all

    I have a problem with the release of excel as below.

    I developed a report to xml editor having exit excel, I designed the layout to the rtf model.

    one of the parameters in the report as 11000048,11000050

    so when I check the output excel the above setting is displayed as below.

    1,100,004,811,000,050

    But I need the parameter will be displayed in the format 11000048,11000050 , as written, please help me.

    Thank you

    Please try this

  • output format of the index

    Hi dev

    I am currently using below version
    BANNER                                                                         
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production           
    PL/SQL Release 11.2.0.1.0 - Production                                           
    CORE     11.2.0.1.0     Production                                                         
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production                          
    NLSRTL Version 11.2.0.1.0 - Production                                           
    {CODE}
    
    
    here is my query to find out the list of indexes and positions in a single schema.
    SELECT
    USER_INDEXES. TABLE_NAME | CHR (9) |
    USER_INDEXES. INDEX_NAME | CHR (9) |
    TRIM (user_ind_columns. COLUMN_NAME) | CHR (9) |
    user_ind_columns.Column_Position | CHR (9) |
    trim (user_ind_columns. DOWN) ORDERTYPE
    From user_indexes, user_ind_columns
    WHERE user_indexes. Table_name = user_ind_columns. TABLE-NAME
    AND user_indexes. Index_name = user_ind_columns. INDEX_NAME
    AND user_indexes.index_name NOT IN (select index_name FROM user_constraints where index_name is not null);
    The output is like :
    Table_name column_name position OrderType index_name
    ----------------- ------------------ ------------------- ----------- ---------------
    ACS_TEST ACS_TEST_IDX COL2 CSA 2
    ACS_TEST ACS_TEST_IDX COL1 1 CSA
    C_COLLEGE INX_COLL DEPT_ID 4 CSA
    C_COLLEG LAST_NAME INX_COLL 3 ASC
    C_COLLEGE INX_COLL FIRST_NAME 2 CSA
    C_COLLEGE INX_COLL STUDENT_ID 1 CSA
     i am trying to spool the output to .txt file. in textfile the output should be in below format :
    Table_name Index_name column_names
    ---------------- ---------------- ------------------
    ACS_TEST ACS_TEST_IDX COL1, COL2
    C_COLLEGE INX_COLL STUDENT_ID, FIRST_NAME, LAST_NAME, DEPT_ID
    Note : Based on the position value the column name have to be  placed.
    
    
    Please help me to get such ouput format.
    
    
    Thanks,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Hello

    Please edit and reformat your message it's horrible.

    A way to get what you need using the LISTAGG:

    SELECT ui.table_name
         , ui.index_name
         , LISTAGG (uic.column_name, ',')
              WITHIN GROUP (ORDER BY uic.column_position) cols
      FROM user_indexes ui, user_ind_columns uic
     WHERE     ui.table_name = uic.table_name
           AND ui.index_name = uic.index_name
           AND NOT EXISTS
                  (SELECT 1
                     FROM user_constraints
                    WHERE index_name = ui.index_name)
     GROUP BY ui.table_name, ui.index_name;
    

    Kind regards.
    Al

Maybe you are looking for

  • Done "buttons of external applications 2 0.13 ' have a bug in FF 33.1.1?

    When I install the "external applications 2 buttons 0.13 ' FF 33.1.1, the small rectangle that appears in the toolbar contains a button that I can't remove. This button can be edited is not the problem, but at the same time a new entry appears at the

  • How to write messages in the Nepali script instead of the English script?

    When sending messages to Nepali friends, I need to use the Nepalese devanagri script instead of the English script. How can I change the face of the type which I can do using gmail but not thunderbird?

  • How to replace HP Pavilion 14-v044tx with SSD?

    Dear experts, I would like to replace HP Pavilion 14-v044tx HDD with SSD, but I can't seem to find SSD compatibility information. Here are a few questions and I hope that some of you could give advice: 1. the list of SSD compatibility? 2 may I know i

  • installation software

    I have a HP Laserjet P1005. The driver is damaged. I have the installation disc, but all of a sudden my CD ROM doesn't no longer works. How can I transfer the files from the CD to a USB key to reload the driver?

  • 'Unidentified network' after every reboot with Windows 7

    Hi guys,. It seems to be a large number of people with this problem and a multitude of suggestions on how to fix it. I had no chance.So far, I've tried everything, including the quite this long list here (excluding those of the 'method III' that I'm