Output of select query in a single line

hi,
I want to know how to get the each row in a table to be printed in a single line.. Each row in the table will be of 1500 characters length..
Thanks

Is there any limit to the value that we can specify
for linesize.. I read somewhere that the max value is
dependent on systemIn [url http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#SQPUG085]the documentation, they don't talk about a maximum, but I saw there is one:
SQL> set linesize 1500
SQL> set linesize 32767
SQL> set linesize 32768
SP2-0267: linesize optie 32768 ligt buiten toegestane bereik (1 t/m 32767).Regards,
Rob.

Similar Messages

  • Label styled output by select query

    Hi,
    How do i get output of select query of EMP table of scott schema as below :
    Using Oracle 10g on windows xp machine :
    1.  EMPNO:7499                    2.   EMPNO:7521                    3.   EMPNO:7566
        ALLEN                         WARD                         JONES     
        SALESMAN                         SALESMAN                         MANAGER     
        HIREDATE:20-FEB-81                    HIREDATE:22-FEB-81                    HIREDATE:02-APR-81     
        SAL:1600                         SAL:1250                         SAL:2975
    <<<<BLANK LINE 1>>>>  This is not part of output
    <<<<BLANK LINE 2>>>>
    <<<<BLANK LINE 3>>>>
    <<<<BLANK LINE 4>>>>                                                  
    4.  EMPNO:7654                    5.   EMPNO:7698                    6.   EMPNO:7782
        MARTIN                         BLAKE                         CLARK     
        SALESMAN                         MANAGER                         MANAGER     
        HIREDATE:28-FEB-81                    HIREDATE:01-MAY-81                    HIREDATE:09-JUN-81     
        SAL:1250                         SAL:2850                         SAL:3000
    <<<<BLANK LINE 1>>>>  This is not part of output
    <<<<BLANK LINE 2>>>>
    <<<<BLANK LINE 3>>>>
    <<<<BLANK LINE 4>>>>                                        Means, i wish to print the addresses of my address table; so here i am giving you EMP as example that how it will create create above output if :
    (A) suppose above it is in 3 columns; i wish to change in N number of columns?
    (B) above there are 4 blank lines, i wish to change in N number of blank lines?
    (C) above order by empno, i wish to change in any order by column as well.
    Thanking you,
    Regards
    Nisha Sharma

    WITH t AS (
               SELECT  e.*,
                       ROW_NUMBER() OVER(ORDER BY CASE :order_indicator
                                                    WHEN 1 THEN to_char(empno,'9999')
                                                    WHEN 2 THEN ename
                                                    WHEN 3 THEN job
                                                    WHEN 4 THEN to_char(hiredate,'yyyymmdd')
                                                  END
                                        ) rn
                 FROM  EMP e
    SELECT  REPLACE(SYS_CONNECT_BY_PATH(RPAD(TO_CHAR(rn,'999') || '.  EMPNO:' || empno,30),','),',') ||
            CHR(13) || CHR(10) || '       ' ||
            REPLACE(SYS_CONNECT_BY_PATH(RPAD(ename,30),','),',') ||
            CHR(13) || CHR(10) || '       ' ||
            REPLACE(SYS_CONNECT_BY_PATH(RPAD(job,30),','),',') ||
            CHR(13) || CHR(10) || '       ' ||
            REPLACE(SYS_CONNECT_BY_PATH(RPAD('HIREDATE:' || TO_CHAR(hiredate,'DD-MON-YY'),30),','),',') ||
            CHR(13) || CHR(10) || '       ' ||
            REPLACE(SYS_CONNECT_BY_PATH(RPAD('SAL:' || sal,30),','),',') ||
            LPAD(CHR(13) || CHR(10),2 * :blank_lines,CHR(13) || CHR(10)) line
      FROM  t
      WHERE CONNECT_BY_ISLEAF = 1
      START WITH mod(rn,:column_count) = 1
      CONNECT BY rn = PRIOR rn + 1
             AND level <= :column_count
    /For example:
    SQL> SET LINESIZE 132
    SQL> SET PAGESIZE 0
    SQL> VARIABLE column_count NUMBER
    SQL> EXEC :column_count := 3;
    PL/SQL procedure successfully completed.
    SQL> VARIABLE order_indicator NUMBER
    SQL> EXEC :order_indicator := 1;
    PL/SQL procedure successfully completed.
    SQL> VARIABLE blank_lines NUMBER
    SQL> EXEC :blank_lines := 6;
    PL/SQL procedure successfully completed.
    SQL> WITH t AS (
      2             SELECT  e.*,
      3                     ROW_NUMBER() OVER(ORDER BY CASE :order_indicator
      4                                                  WHEN 1 THEN to_char(empno,'9999')
      5                                                  WHEN 2 THEN ename
      6                                                  WHEN 3 THEN job
      7                                                  WHEN 4 THEN to_char(hiredate,'yyyymmdd')
      8                                                END
      9                                      ) rn
    10               FROM  EMP e
    11            )
    12  SELECT  REPLACE(SYS_CONNECT_BY_PATH(RPAD(TO_CHAR(rn,'999') || '.  EMPNO:' || empno,30),','),',') ||
    13          CHR(13) || CHR(10) || '       ' ||
    14          REPLACE(SYS_CONNECT_BY_PATH(RPAD(ename,30),','),',') ||
    15          CHR(13) || CHR(10) || '       ' ||
    16          REPLACE(SYS_CONNECT_BY_PATH(RPAD(job,30),','),',') ||
    17          CHR(13) || CHR(10) || '       ' ||
    18          REPLACE(SYS_CONNECT_BY_PATH(RPAD('HIREDATE:' || TO_CHAR(hiredate,'DD-MON-YY'),30),','),',') ||
    19          CHR(13) || CHR(10) || '       ' ||
    20          REPLACE(SYS_CONNECT_BY_PATH(RPAD('SAL:' || sal,30),','),',') ||
    21          LPAD(CHR(13) || CHR(10),2 * :blank_lines,CHR(13) || CHR(10)) line
    22    FROM  t
    23    WHERE CONNECT_BY_ISLEAF = 1
    24    START WITH mod(rn,:column_count) = 1
    25    CONNECT BY rn = PRIOR rn + 1
    26           AND level <= :column_count
    27  /
       1.  EMPNO:7369                2.  EMPNO:7499                3.  EMPNO:7521
           SMITH                         ALLEN                         WARD
           CLERK                         SALESMAN                      SALESMAN
           HIREDATE:17-DEC-80            HIREDATE:20-FEB-81            HIREDATE:22-FEB-81
           SAL:800                       SAL:1600                      SAL:1250
       4.  EMPNO:7566                5.  EMPNO:7654                6.  EMPNO:7698
           JONES                         MARTIN                        BLAKE
           MANAGER                       SALESMAN                      MANAGER
           HIREDATE:02-APR-81            HIREDATE:28-SEP-81            HIREDATE:01-MAY-81
           SAL:2975                      SAL:1250                      SAL:2850
       7.  EMPNO:7782                8.  EMPNO:7788                9.  EMPNO:7839
           CLARK                         SCOTT                         KING
           MANAGER                       ANALYST                       PRESIDENT
           HIREDATE:09-JUN-81            HIREDATE:19-APR-87            HIREDATE:17-NOV-81
           SAL:2450                      SAL:3000                      SAL:5000
      10.  EMPNO:7844               11.  EMPNO:7876               12.  EMPNO:7900
           TURNER                        ADAMS                         JAMES
           SALESMAN                      CLERK                         CLERK
           HIREDATE:08-SEP-81            HIREDATE:23-MAY-87            HIREDATE:03-DEC-81
           SAL:1500                      SAL:1100                      SAL:950
      13.  EMPNO:7902               14.  EMPNO:7934
           FORD                          MILLER
           ANALYST                       CLERK
           HIREDATE:03-DEC-81            HIREDATE:23-JAN-82
           SAL:3000                      SAL:1300
    SQL> EXEC :column_count := 4;
    PL/SQL procedure successfully completed.
    SQL> EXEC :blank_lines := 2;
    PL/SQL procedure successfully completed.
    SQL> /
       1.  EMPNO:7369                2.  EMPNO:7499                3.  EMPNO:7521                4.  EMPNO:7566
           SMITH                         ALLEN                         WARD                          JONES
           CLERK                         SALESMAN                      SALESMAN                      MANAGER
           HIREDATE:17-DEC-80            HIREDATE:20-FEB-81            HIREDATE:22-FEB-81            HIREDATE:02-APR-81
           SAL:800                       SAL:1600                      SAL:1250                      SAL:2975
       5.  EMPNO:7654                6.  EMPNO:7698                7.  EMPNO:7782                8.  EMPNO:7788
           MARTIN                        BLAKE                         CLARK                         SCOTT
           SALESMAN                      MANAGER                       MANAGER                       ANALYST
           HIREDATE:28-SEP-81            HIREDATE:01-MAY-81            HIREDATE:09-JUN-81            HIREDATE:19-APR-87
           SAL:1250                      SAL:2850                      SAL:2450                      SAL:3000
       9.  EMPNO:7839               10.  EMPNO:7844               11.  EMPNO:7876               12.  EMPNO:7900
           KING                          TURNER                        ADAMS                         JAMES
           PRESIDENT                     SALESMAN                      CLERK                         CLERK
           HIREDATE:17-NOV-81            HIREDATE:08-SEP-81            HIREDATE:23-MAY-87            HIREDATE:03-DEC-81
           SAL:5000                      SAL:1500                      SAL:1100                      SAL:950
      13.  EMPNO:7902               14.  EMPNO:7934
           FORD                          MILLER
           ANALYST                       CLERK
           HIREDATE:03-DEC-81            HIREDATE:23-JAN-82
           SAL:3000                      SAL:1300
    SQL>     SY.
    Edited by: Solomon Yakobson on Oct 25, 2009 6:02 AM

  • 3 buttons and 2 select lists in a single line

    Hi,
    I have an application which has 3 region buttons ( say, b_1, b_2, b_3) and 2 selects lists (say, sl_1, sl_2). I want to display all the five buttons and items in a single line in the following order:
    b_1 b_2 sl_1 b_3 sl_2
    I have set Begin on new line = no
    and Begin on new field = no, for both the two select lists.
    But it does not seem to work.
    Do anyone have any idea, how to sort out this issue?
    A quick reply would really be appreciated.
    Regards,
    AM

    Hi Vikas,
    Please have a look into the application at
    http://apex.oracle.com/pls/otn/f?p=34363:1:6206621111100168:::::
    I have created two select lists P1_X and P1_Y. These items are hidden on page load event. When the associated button is clicked the list should appear on the page.
    Written the following code in 'Pre element text' for each of the items:
    P1_X :: <input type="button" value="X" onclick="f_X();" class="t17Button" />
    P1_Y:: <input type="button" value="Y" onclick="f_Y();" class="t17Button" />
    Where, f_X() and f_Y() are displaying the select lists.
    As you can see, the select lists are appearing just below the html buttons, which I want side by side with the buttons.
    Could you please figure out the issue?
    If you want I can share my login details.
    Regards,
    AM

  • Simplify the select query to get single record

    Please let me know what is wrong with my query.
    Max(p_received_date) is returning null columns too. But i need to have only null record per period, if there is date and null record for the same billing then return the date record. please check november and september records. september should return only 09/13/10 record but it is returning null record too. please help to get expected out put.
    SELECT DISTINCT B_BILLING_KEY,
    to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
    trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
    B_company_id company,
    sum((nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))) "PeriodBalance",
    Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) LastPaymentDate,
    decode(sign(
    (nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))), 1,'Yes','No') Outs
    FROM mv_program_dict P, tuff_balance_view T WHERE
    b_company_id = 'U-7052-C' group by B_REPORT_PERIOD,B_company_id,B_BILLING_KEY,B_ORG_SURCH_AMOUNT,
    B_ORG_PI_AMOUNT,P_AMOUNT
    order by B_BILLING_KEY desc
    Actual
    Billing key Billing company periodbalance lastpayment date outs
    110631534073 November 2010 U-7052-C 270 Yes
    110631534073 November 2010 U-7052-C 690 Yes
    110631534073 November 2010 U-7052-C 66 Yes
    110461533197 October 2010 U-7052-C 4740 Yes
    110461533197 October 2010 U-7052-C 27000 Yes
    110461533197 October 2010 U-7052-C 0 No
    110251532527 September 2010 U-7052-C 0 09/13/10 No
    110251532527 September 2010 U-7052-C 0 No
    110251532527 September 2010 U-7052-C -18 09/13/10 No
    110251532484 August 2010 U-7052-C 0 09/13/10 No
    110251532484 August 2010 U-7052-C 2001 09/13/10 Yes
    110251532484 August 2010 U-7052-C 0 No
    Expectedoutput(need only following columns)Outs is outstanding balance
    Billing key Billing company l astpayment date outs
    110631534073 November 2010 U-7052-C Yes
    110461533197 October 2010 U-7052-C Yes
    110251532527 September 2010 U-7052-C 09/13/10 No
    110251532484 August 2010 U-7052-C 09/13/10 YES
    By using below query i am getting all output as NO. HOw to modify this query.
    SELECT company,
    billing,LastPaymentDate,
    CASE
    WHEN SUM (DECODE (outs, 'YES', 1, 0)) > 0 THEN 'YES'
    ELSE 'NO'
    END Outstanding
    FROM (
    SELECT DISTINCT B_BILLING_KEY,
    to_char(to_date('01/'||trim(substr(B_REPORT_PERIOD,5,2))||'/'||
    trim(substr(B_REPORT_PERIOD,1,4)),'DD/MM/YYYY'),'Month YYYY') Billing,
    B_company_id company,
    sum((nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))) "PeriodBalance",
    Max(to_char(P_RECEIVED_DATE,'MM/DD/YY')) LastPaymentDate,
    decode(sign(
    (nvl(T.B_ORG_SURCH_AMOUNT,0)+nvl(T.B_ORG_PI_AMOUNT,0))-(nvl(T.P_AMOUNT,0))), 1,'Yes','No') Outs
    FROM mv_program_dict P, tuff_balance_view T WHERE
    b_company_id = 'U-7052-C' group by B_REPORT_PERIOD,B_company_id,B_BILLING_KEY,B_ORG_SURCH_AMOUNT,
    B_ORG_PI_AMOUNT,P_AMOUNT
    order by B_BILLING_KEY desc)
    GROUP BY company, billing,LastPaymentDate;
    Note:in the actual out put max(lastpayment date) is returing null values. if there is any date in one billing return that date only remove null example is september. in september it should return only 09/13/10 this date not null date. but if there is no other within one biling then consider that as null example november..
    Thanks,
    v

    Another solution is setting NLS_SORT to CI - case insensitive (or whatever_your_language_is_CI) and NLS_COMP to ANSI:
    SQL> with t as (
      2             select 'HARI' name from dual union all
      3             select 'Hari' name from dual union all
      4             select 'HaRi' name from dual
      5            )
      6  select  *
      7    from  t
      8    where name = 'hArI'
      9  /
    no rows selected
    SQL> alter session set nls_sort = binary_ci
      2  /
    Session altered.
    SQL> alter session set nls_comp=ansi
      2  /
    Session altered.
    SQL> with t as (
      2             select 'HARI' name from dual union all
      3             select 'Hari' name from dual union all
      4             select 'HaRi' name from dual
      5            )
      6  select  *
      7    from  t
      8    where name = 'hArI'
      9  /
    NAME
    HARI
    Hari
    HaRi
    SQL> SY.

  • Report output displaying all rows in a single line

    Sometimes
    Edited by: 845142 on Mar 17, 2011 11:12 AM

    Hi,
    There might be some mistake in your layout. the print direction should be down.
    Look at the below link for more information:
    http://oracleapps4u.blogspot.com/2011/03/layout-mode-print-direction.html
    Some guide lines in developing the report layout:
    http://oracleapps4u.blogspot.com/2011/03/layout-guidelines-to-increase-report.html
    If this didnt help you. detail more about your problem

  • To lock the output of a SELECT query

    Hi,
    I want to lock the output of a SELECT query to some transaction.
    I have wriiten it as follows , the output of the query is a single row;
    SELECT empname
    FROM employees
    where empid = 100
    FOR UPDATE;
    Specifying only FOR UPDATE is proper or do i need to specify some more clause ??
    Thanks.

    bscalzo wrote:
    You can also specify the columns to lock if you like:
    select x, y, z from aaa where x = 1 for update of x, y;
    But the locking is still currently only done at the row level - but who knows what the future might offer. May not hurt to have the columns named for thay day when the syntax and engine sync up :)It might be worth to amend that specifying the columns is already particularly relevant if you select from multiple tables/views in order to specify which rows of which table/view to lock.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Delimited output of a select query

    Hi, How to write comma delimited output
    of select query from within a PL/SQL stored
    procedure to a file. for example
    select a &#0124; &#0124; ',' &#0124; &#0124; b
    from test3
    I know it can be done at SQL prompt using spool command, but
    don't know how it can be done from within PL/SQL procedure without using cursors
    thanks
    Pramod

    Hi Pramod,
    Why don't u try with use of UTL FILE.
    select the necessary values into some local variables.
    With the use of utl_file.fopen open a file.
    And use utl_file.put_line to write the values
    in to the file.
    Try it and let me know.
    Regards
    Arun
    null

  • Need help in writing a select query to pull required data from 3 tables.

    Hi,
    I have three tables EmpIDs,EmpRoles and LatestRoles. I need to write a select Query to get roles of all employees present in EmpIDs table by referring EmpRoles and LatestRoles.
    The condition is first look into table EmpRoles and if it has more than one entry for a particular Employee ID than only need to get the Role from LatestRoles other wise consider
    the role from EmpRoles .
    Sample Script:
    Create Table #EmpIDs
    (EmplID int )
    Create Table #EmpRoles
    (EMPID int,Designation varchar(50))
    Create Table #LatestRoles
    EmpID int,
    Designation varchar(50)
    Insert into #EmpIDs values (1),(2),(3)
    Insert into #EmpRoles values (1,'Role1'),(2,'Role1'),(2,'Role2'),(3,'Role1')
    Insert into #LatestRoles values (2,'Role2')
    Employee ID 2 is having two roles defined in EmpRoles so for EmpID 2 need to fetch Role from LatestRoles table and for
    remaining ID's need to fetch from EmpRoles .
    My Final Output of select query should be like below.
    EmpID Role
    1 Role1
    2 Role2
    3 Role1
    Please help.
    Mohan

    Mohan,
    Can you check if this answers your requirement:
    Create Table #EmpIDs
    (EmplID int )
    Create Table #EmpRoles
    (EMPID int,Designation varchar(50))
    Create Table #LatestRoles
    EmpID int,
    Designation varchar(50)
    Insert into #EmpIDs values (1)
    Insert into #EmpIDs values (2)
    Insert into #EmpIDs values (3)
    Insert into #EmpRoles values (1,'Role1')
    Insert into #EmpRoles values (2,'Role2')
    Insert into #EmpRoles values (2,'Role1')
    Insert into #EmpRoles values (3,'Role1')
    Insert into #LatestRoles values (2,'Role2')
    --Method 1
    select e.EmplID,MIN(ISNULL(l.Designation,r.Designation)) as Designation
    from #empids e
    left join #emproles r on e.emplID=r.EmpID
    left join #latestRoles l on e.emplID=l.EmpID
    group by e.EmplID
    --Method 2
    ;with cte
    as
    select distinct e.EmplID,r.Designation,count(*) over(partition by e.emplID) cnt
    from #empids e
    left join #emproles r on e.emplID=r.EmpID
    select emplID,Designation
    from cte
    where cnt=1
    UNION ALL
    select a.EmplID,l.Designation
    from
    (select distinct EmplID from cte where cnt>1) a
    join #Latestroles l on a.EmplID=l.EmpID
    order by emplID
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Mercator xml single line translation

    hi guys,
    I have a map that reads in an xml file and outputs an edifact msg.
    When the xml is formatted, i.e spaced apart according to the tags, the map performs fine.
    Unfortunately, my xml file is generated by another application that outputs the xml all on one single line.
    i.e
    <line1>A</line1><line2>B</line2><line3>C</line3>when i run the input file (single line xml) through the map, i get an invalid input message!!
    I've already removed all the <cr> and <nl> from all the Terminators in my input type tree, but i still get an Invalid input error message. has anyone experianced this before?
    Any help or suggestions are greatly appreciated.

    Mallik,
    I do not think that this can be achieved in XML to XML (unless you can create a specific module and add to the module tab)
    But if you create say a CSV or TXT file and use the <b>Content Conversion Parameters</b> option
    Here you can specify the fieldSeparator to be 'nl'
    <b>Input</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <record>
    <field1>f1</field1>
    <field2>f2</field2>
    <field3>f3</field3>
    </record>
    <b>Output</b>
    f1
    f2
    f3
    Here you have retained your data and each field is separated by a new line.  Unfortunatley with this method you lose your XML tags
    Regards,
    Mike

  • MSSQL Query/View Single Line Output For Combined Multiple Data Elements - Possible Pivot Table?

    HELLO...
    I hope you experts out there can help me.  Consider the following (2) Tables in MSSQL:
    1. TENDERED --> Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
    DATE
    DOC_NO
    PMNT_SEQ_NO
    PAYCODE_TYPE
    AMOUNT
    2. TENDERED_CR_CARD -->Primary Key = DATE / DOC_NO / PAYMENT_SEQ_NO
    DATE
    DOC_NO
    PMNT_SEQ_NO
    CR_CARD_NO_MASKED
    CR_CARD_NAME
    CR_CARD_EXP_DATE
    These two tables are certainly related, based on their Primary Key values.
    Now, consider the following data in those two tables:
    DATE            
    DOC_NO      PMNT_SEQ_NO              
    PAYCODE_TYPE               
    AMOUNT
    03/10/2014         100001 
    1             
    CASH            
    100.00
    03/10/2014         100001 
    2             
    CASH                             
    -9.75
    03/10/2014         100002 
    1             
    CASH                             
    50.00
    03/10/2014         100002 
    2             
    VISA                             
    100.00
    03/10/2014         100002 
    3             
    VISA             
                   250.00
    03/10/2014         100003 
    1             
                            MC
    125.00
    03/10/2014         100003 
    2             
    AMEX           
    75.00
    DATE          
    DOC_NO PMNT_SEQ_NO  CR_CARD_MASKED     
    NAME            
    CR_CARD_EXP
    03/10/2014  100002   2                       4225******801289  
    MARY JONES   2016/08/31
    03/10/2014  100002   3                       4121******637442  
    JOHN DOE      2015/04/30
    03/10/2014  100003   1                       5428******971134  
    MIKE BAKER   2018/09/30
    03/10/2014  100003   2                       3732*****344756    
    LINDA LIU      2017/07/31
    OK...so what we NEED...is a Combined, SINGLE RECORD Audit Report type query. 
    The resulting query should show, based on the Data from above, the SINGLE LINE represented in the Attached Spreadsheet. 
    NOTE...what's important to point out here..is that ONLY the 'CASH' Tender gets "summed"...EACH INDIVIDUAL Credit Card record MUST have its own Field...as represented in the corresponding Columns of the Spreadsheet (i.e. PMT_TYP_1, AMT_1, PMT_TYP_2,
    AMT_2, and so forth).
    PLEASE HELP!  Any suggestions/advice would be most appreciated! 
    Thank You!...Mark

    I would not do this in SQL if I could possibly avoid it.  Instead do it in the front end.
    If you must do it in SQL, this is a dynamic pivot on multiple columns.  Naomi Nosonovsky has a blog at
    http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/dynamic-pivot-on-multiple-columns/ on how to do that.  Look especially at her second example using the claims table.  Of course, you must do some manipulation even before you do the multi-column
    pivot, since you must first combine all the cash entries.
    So one way to do it would be to build a temp table with all the entries you have except the cash entries combined into one payment sequence number.  To do that you may need specifications that are not clear to me from what you have given us.  For
    example, if PMT SEQ 1 is VISA,  PMT SEQ 2 is CASH, PMT SEQ 3 is VISA, PMT SEQ 4 is CASH, and PMT SEQ 5 is VISA, you want to combine the two cash payments.  So they become PMT SEQ 2?  If so, what happens to PMT SEQ 4 - is it left N/A or does
    PMT SEQ 5 become PMT SEQ 4?
    But once you have this temp table with the cash payments combined in the algorithm you need, then you can use Naomi's method to do the multi-column pivot.  Note that Naomi uses the code
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_Name = 'Claims'
    to get the column names from the permanent table Claims.  To get the column names from a temp table use code like the following.  To find the column names in a temp table named #MyTempTable, do
    From tempdb.sys.columns
    Where object_id = OBJECT_ID('#MyTempTable')
    But as I say, if feasible, I would do this in the front end, not in SQL.  T-SQL is a very good language for storing and retrieving data, not so good at formatting it. 
    Tom

  • CohQL command line Tool select query output in file (unix)

    Ho to insert Coherence CohQL command line Tool select query result in file in unix platform. I have tried below query but failed
    query.cmd -s -c -l "select * from 'dist-example'" >myOutput.txt
    I also tried below query, result is displayed in command line but no file is created in folder.
    select * from dist-example >myOutput.txt
    I also tried one more query, result is displayed in command line but no file is created in folder.
    select * from dist-example >/opt/bin/myOutput.txt

    Hi,
    In Unix you should use query.sh instead of query.cmd
    In your case then the command would be smething like:
    query.sh -s -c -l "select * from 'dist-example'" >myOutput.txt
    You can also try using '>>' instead of '>' in order to redirect to a text file.
    Hope this helps.
    -Cris

  • Query - Get data from the same table and field two times on a single line

    I have prepared a query showing the bill of material. At each line each component will be a new line and I want to have the description of the material at the top (the master material composed of the component ones) and also the description of the component materials on the same line. This means that I should be able to use MAKT table 2 times on a single line of the query. I have used the query tool with SQ01 and SQ02 tcodes. How can I get the the description of the material at the top and also the description of the component material on a single line?
    Thanks in advance for the answers.

    Yasar,
    Any time you wish to use a table twice in an SQ01 query, you have to create an alias.
    SQ02 > select the infoset, 'change' > go to Join definitions.
    Select 'Alias' button.  Create. Select your table name (such as MAKT) and define an alias, such as 'COMP_MAKT' for component descriptions.
    Now you can insert the Alias table into your infoset just like it was a regular table, and use standard join method to join COMP_MAKT to your component material number.
    Best regards,
    DB49

  • Select query in case of Multiple line items

    Hi Gurus ,
                  I've a doubt in general SQL select query. I want to know , if suppose I've an internal table - itab . I've fetched G/L Account numbers 1st, based on the input selections . Next , I want to loop on those G/L accounts. However, if the G/L account has multiple line items, then I personally use this select query -- >
    loop at itab.
    select <field> from <table> appending corresponding fields of  <itab1> where hkont eq itab-hkont.
    endloop.
    Now, the execution time for this query is longer than expected. The biggest problem here is, i've to sum up the totals as well. So totaling is an added load. I want to reduce the execution time of this. Kindly suggest me some good method in case u have any.
    I've pasted the code which I've written , for u ppl to understand--
    SELECT DISTINCT HKONT BELNR
      FROM BSIS
       INTO CORRESPONDING FIELDS OF TABLE OTAB
        WHERE HKONT IN S_RACCT
    *      AND PRCTR IN P_PRCTR
          AND MONAT IN S_POPER
          AND BUKRS EQ P_BUKRS
          AND GJAHR EQ P_GJAHR
          AND PRCTR IN S_PRCTR.
    ***The code below takes a lot of time to execute.***
    LOOP AT OTAB .
      SELECT DMBTR HKONT
      FROM BSIS APPENDING CORRESPONDING FIELDS OF TABLE CREDITS
        WHERE HKONT EQ OTAB-HKONT
          AND BELNR EQ OTAB-BELNR
          AND MONAT IN S_POPER
          AND BUKRS EQ P_BUKRS
          AND GJAHR EQ P_GJAHR
          AND PRCTR IN S_PRCTR
          AND SHKZG EQ 'H'.
      COLLECT CREDITS.
    ENDLOOP.

    Hi,
    First of all try to avoid doing select into corresponding fields. THis would improve the performance of the program.
    Try to do a single fetch from the BSIS table . fetch the hkont, belnr, dmbtr fields in to a master internal table. Manipulate and play with the data as required.  Don't hit the data base table more than once (unless it is required) . This would improve the performance of your code.
    Try to code this way.
    types: begin of ty_bsis,
                 hkont type hkont,
                 belnr type  belnr_d,
                 dmbtr type dmbtr,
              end of ty_bsis.
    data: it_bsis type standard table of ty_bsis,
             wa_bsis type ty_bsis,
    select hkont belnr dmbtr
              from bsis
              into table it_bsis
              WHERE HKONT IN S_RACCT
            AND PRCTR IN P_PRCTR
              AND MONAT IN S_POPER
             AND BUKRS EQ P_BUKRS
             AND GJAHR EQ P_GJAHR
              AND PRCTR IN S_PRCTR.
    Using the data availabe in the it_bsis, you can manipulate as required.
    Hope this would be helpful
    Regards
    Ramesh Sundaram

  • How to print long raw text data in report output in single line?

    Hi All,
    I have a requirement where I need to print raw comma separated text data in the report output which end user will open in excel and can sort as required. I can not directly generate excel output.
    Now there is huge set of data and each row from the report query should be get printed on single line, It should not get printed on the next line.
    I tried to extending the report with 240 characters but still there are some text data which is getting printed on the next line.
    Please share your view if someone has any solution on this issue.
    Thanks in Advance.
    Arun

    Make the report even wider. By default a report layout can be 10 pages wide. If you need more, change the "Max. Horizontal Body Pages" property, and extend your layout too.
    IMHO, I wouldn't even use Reports to create a csv file. Utl_file or an sqlplus script that spools to a file are better options I think.

  • How to format generated XML using XMLELEMENT() my output is coming in a single line i want it to be in a XML format

    hi I am having problem in formatting XML file which I generated with xmlelement() when I execute it gives me putput in a single line
    is there any way that I got my output as a XML file HAS......

    That is expected behavior. PRETTY print(ing) is only needed for humans. XML Parsers don't need the XML to be pretty printed. If you open the XML file in a browser like Windows Explorer or Firefox, the browser will pretty print the output for you.
    In all, the "single line" output is done because of PERFORMANCE reasons (lack of unneeded end of line and CTRL line breaks etc)
    SELECT xmlelement("Employee Name", dummy) as "XML RESULT"
    FROM DUAL;
    <Employee Name>X</Employee Name>
    SELECT xmlelement("Employee Name", xmlelement("SurName", dummy)
                                     , xmlelement("LastName", dummy)
                     ) as "XML RESULT"
    FROM DUAL;
    <Employee Name><SurName>X</SurName><LastName>X</LastName></Employee Name>
    XMLSERIALIZE can pretty print the output if needed via INDENTation
    SELECT XMLSERIALIZE(CONTENT xmlelement("Employee Name", xmlelement("SurName", dummy), xmlelement("LastName", dummy)) as CLOB indent SIZE=1 )
    FROM DUAL;
    <Employee Name>
         <SurName>X</SurName>
         <LastName>X</LastName>
    </Employee Name>

Maybe you are looking for

  • Peformance issue with iSetup for loading fnd_flex_value_norm_hierarchy recs

    Hi The customer site where I am working in currently has implemented isetup to load data from Hyperion DRM to Oracle GL. They are currently on 11i.AZ.F patch level. The customer has constantly had problems in two areas with iSetup - 1. iSetup has a l

  • BPM - Simple integration process

    Hi guys, I'm new at BPM and I've created a simple process. Looking at the weblog "Walkthrough with BPM" by Krishna, i was able to create the simple scenario: Source System -(File Adapter)->BPM-(File Adapter)->Target System. Now imagine I wanted to in

  • Problem opening CC and downloading Photoshop

    I just got a brand new iMac, and installed the Creative Cloud. At the first go it opened a window at the top right corner but then didn't do anything else (page was blank). Since then I've been trying everything from uninstalling, to installing again

  • I tried contact apple support and it says my serial number is invalid

    when I try to contact apple support for a chat  (about maveric)  it asks for my computers serial number.  I have read it off the bottom plate of my my stand 3 times to make certain I have it correctly but I get a message that says it is not a valid s

  • Oracle Receivables - Release 12

    Where do I find the Logical Data Model of the Oracle Receivables. I am particularly interested in understanding the ERD model of the Subledger Accounting with Accounts Receivables.