Need help to format the output of the query.

First of all i would like to say I m newbi in oracle query
and of course thanks to read the thread.
I have a problem formatting a query output.
Actually the query is like the following :
select a1
,b1
,c1
from table
where id.table=1
UNION
select a2
,b2
,c2
from table2
where id.table2=1
order by 1;
exit;
my actual output
a1 b1 c1
a2 b2 c2
a1 b1 c1
a2 b2 c2
my desired output
a1 b1 c1
a2 b2 c2
a1 b1 c1
a2 b2 c2
So what i need is an empy row between the groups of results
and to shift the union query.
thanks in advance

SQL>select * from t1;
        C1         C2         C3
         1          2          3
         2          3          4
         3          4          5
SQL>select * from t2;
        C1         C2         C3
        30         40         50
        20         30         40
        10         20         30
SQL>select c1,c2,c3
  2  from( select c1,c2,c3,1 flg
  3           from t1
  4           union all
  5           select c1,c2,c3,2
  6           from t2
  7           union all
  8           select null,null,null,1
  9           from dual)
10  order by flg,c1,c2,c3 nulls last;
        C1         C2         C3
         1          2          3
         2          3          4
         3          4          5
<br>
        10         20         30
        20         30         40
        30         40         50
7 rows selected.
Funny.......                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Need help for formating text output

    Is there a way to dynamically store special characters(eg. new line character) into a text field? This is because, the data is inserted into the DB from a textbox where the user divides the text into several lines but when it is viewed, it is just a single string of text

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by malaybiswas ():
    Is there a way to dynamically store special characters(eg. new line character) into a text field? This is because, the data is inserted into the DB from a textbox where the user divides the text into several lines but when it is viewed, it is just a single string of text<HR></BLOCKQUOTE>
    Generally speaking, you can store any characters in a plain ASCII string if you properly encode them. If you have Oracle Web Server look at URL_ENCODE procedure, it's probably not exactly what you need, but it gives you an idea.
    null

  • Need help in formatting the Date - Date does not

    Need help in formatting the Date - Date does not formats and give Not a valid month error in the below scenario.
    select oc.ST_PGM_MGR, r.ag_dnum, get_major_work_type(r.perf_eval_rtng_id) "v_work_code", r.ag_dnum_supp "supp", r.intfinal, to_char(r.formdate,'MM/DD/YYYY') "formdate", to_char(r.servfrom,'MM/DD/YYYY') "srv_from", to_char(r.servto,'MM/DD/YYYY') "srv_to", descript, add_months(to_char
    --- Bellow line of Code on trying to format it to mm/dd/yyyy gives the error
    (r.formdate, 'DD-MON-YYYY'),12) "formdate2"
    from  table REdited by: Lucy Discover on Jul 7, 2011 11:34 AM
    Edited by: Lucy Discover on Jul 7, 2011 1:05 PM

    Your syntax is wrong - look at the post above where this syntax is given:
    to_char (add_months(r.formdate,12), 'MM/DD/YYYY') "formdate2"Look at the formula from a logical perspective - "inside out" to read what is happening -
    take formdate, add 12 months
    add_months(r.formdate, 12)then apply the to_char format mask - basic syntax
    to_char(date, 'MM/DD/YYYY')Compare to your syntax:
    to_char(add_months(r.formdate, 'MM/DD/YYYY'),12) "formdate2"You will see your format string inside the call to add_months, and your 12 inside the call to to_char.
    Good luck!

  • I need help, yesterday I installed and reinstalled the Yosemite system and take long to turn on my laptop, the bar takes to fill, and I'm worried. Can you help? thank

    I need help, yesterday I installed and reinstalled the Yosemite system and take long to turn on my laptop, the bar takes to fill, and I'm worried.
    Can you help? thank

    revert back to Maverick that is what I had to finally do. This was the worst upgrade I have ever seen. Hopefully you have Time Machine backup and can revert back. It was pretty painless except for a few issues. I will wait until Apple gets their stuff together on this upgrade or may never will.

  • How to get the output of the report in pdf format

    how to get the output of the report in pdf format?
    Thanks in advance,
    madan.

    Refer these links
    http://www.sap-img.com/bc037.htm
    http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
    CONVERT_ABAPSPOOLJOB_2_PDF FM convert abap spool output to PDF

  • Hi i need help one of my key on the keyboard dosen't work for some reason please help

    hi i need help one of my key on the keyboard dosen't work for some reason please help

    try smc reset
    http://support.apple.com/kb/ht3964
    and Pram reset
    http://support.apple.com/kb/ht1379
    (Try pram a few times to get correct sequence)
    Check what you have selected in
    system preferences/system/accessibility/keyboard
    and system preferences/hardware/keyboard  (keyboard and keyboard short cuts tabs)

  • I need help writing a script that finds the first instance of a paragraph style and then changes it

    I need help writing a script that finds the first instance of a paragraph style and then changes it to another paragraph style.  I don't necessarily need someone to write the whole thing, by biggest problem is figuring how to find just the first instance of the paragraph style.  Any help would be greatly appreciated, thanks!

    Hi,
    Do you mean first instance of the paragraph style
    - in a chosen story;
    - on some chosen page in every text frames, looking from its top to the bottom;
    - in a entire document, looking from its beginning to the end, including hidden layers, master pages, footnotes etc...?
    If story...
    You could set app.findTextPreferences.appliedParagraphStyle to your "Style".
    Story.findText() gives an array of matches. 1st array's element is a 1st occurence.
    so:
    Story.findText()[0].appliedParagraphStyle = Style_1;
    //==> this will change a paraStyle of 1st occurence of story to "Style_1".
    If other cases...
    You would need to be more accurate.
    rgds

  • New airport user need help setting up a pc on the network

    went and bought a airport extream today and my mac works fine on it but i also have a pc and need help getting it to work with the airport express. it seems to see the airport in the network slection screen but after i put in the pass i get nothing and it returns to the "chose a wireless network" can anyone help?

    Thanks for the reply.
    That's interesting, I guess I had assumed that would be a basic thing.
    Right now the 4000 number is in port 1, and then 4244 is in port 2. So if no one else is on the phone, and my  boss picks up his phone, dials 9 then XXX-XXXX, he will be routed outbound on the 4000 line on port 1. Then while he's talking, if I pick up the phone and dial 9 then XXX-XXXX, I will be routed out on the 4244 line on port 2.
    Am I understanding that correctly?
    If that is the case, then that is a bit frustrating. Our 4000 line has everything on it, call waiting, caller id, long distance, etc. But the 4244 line is just a basic service. So if I'm calling local or toll free, I don't want to tie the other line up in case someone else needs to make a long distance call to a client. Is there any work around to that at all? Is there any way to use steering digits to point the call to the right line? Would we have to put the PSTN lines on seperate SPA400's?
    Again, any comments and suggestions are much appreciated!
    Message Edited by VoIP_Me on 07-30-2008 06:27 AM
    Message Edited by VoIP_Me on 07-30-2008 06:28 AM

  • I NEED HELP!! Been calling since the end of Nov and being charged for a Warranty device. The device was returned the next day!! Been calling twice a week.. NEED RESOLUTION

    I NEED HELP!! Been calling since the end of Nov and being charged for a Warranty device. The device was returned the next day!! Been calling twice a week.. I NEED HELP 6 TCC TICKETS HAVE BEEN OPENED - PROMISED CALLS BACK AND NEVER GET CALLS.
    About to cancel my account and move to AT&T
    TCC TICKETS:  (removed)
    I am trying here for the last resort. After this evening my account along with my business account will be cancelled. Total lines that Verizon will have lost will be 93 lines.
    PLEASE SOMEONE JUST HELP ME!!!!
    I already tweeted and facebook messaged Verizon. Your CS group has gone down hill over the last 3-6 months. I use to enjoy being a customer.
    >> Edited to comply with the Verizon Wireless Terms of Service <<

    not all the lines have ETF's. I have 30 tablets and the rest phones. The phones have ETFs and the tablets are all month to month.
    The total to move my account over is going to come out to about $8500.
    Rep has been trying to get my business for years.  I was always loyal to Verizon until this happened.

  • Help with formatting multiline output into comma delimited ordered output

    I have 2 tables:
    SQL> desc table_1;
    Name Null? Type
    ===================================
    ID NOT NULL NUMBER
    DATA1 NOT NULL VARCHAR2(440)
    DATA2 NOT NULL VARCHAR2(1024)
    SQL> desc table_2;
    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 from where e.g. ATTNAME=att_name1 to ATTNAME=att_name6 from every entry (with its unique ID), and format the output into comma delimited format in e.g. this order:
    att_val1,att_val3,att_val6,att_val4,att_val5,att_val6
    So e.g. for entry with ID "9812" from the query below, the output I need would be:
    187,179,156,134,1436,1809
    What I've got so far is as follows:
    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
    1970 att_name2 abc
    1970 att_name3 1234
    1970 att_name4 def
    1970 att_name5 1134
    1970 att_name6 ghj
    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 output comma limited in certain order. (or if this is the best way of getting the data out)
    Would someone have idea how this could be done?

    846954 wrote:
    Thanks Frank!
    I got much further now :).
    I've got Oracle 10g 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 the order that the attributes are (which is pretty random).The values you posted are in order: 'attval1' < 'attval2' < ...
    So I'm using this now(had to use "|" as separator because SYS_CONNECT_BY_PATH would not work with comma due to some of the attval having comma in them ):The values you posted don't contain and commas.
    You're hiding what the problem is. It would really help if you posted actual data. It always helps if you post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data.
    Assuming you really have something that has to be in a certain order, and that order is not based on anything in the values themselves, then DECODE might be a good way to do it. Storing the sort value in a table might be even better.
    It looks like you were using an Oracle 9 exanple. 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; one will do just fine.

  • How to get the output of the Send Separate Remittance Advices in XML in R12

    Hi All,
    I have a requirement where we want the output of the standard report 'Send Separate Remittance Advices' to come in XML, currently its coming in PDF format.
    Can you please help?
    Thanks,
    Dilip
    Edited by: 990784 on Mar 12, 2013 2:57 PM

    Refer these links
    http://www.sap-img.com/bc037.htm
    http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
    CONVERT_ABAPSPOOLJOB_2_PDF FM convert abap spool output to PDF

  • To get the output  in the chart for a single selection

    Hi all,
    I used a query to get the output of the table, and for the same query i have  created a view to get the result in the chart.
    to get the output of the table for  a particular region i have created an input field and added value help to it. When i selected one particular region, i will be getting the data, in the table. But when i select a particular row in the table i need to get the data of that particular row only in the chart. (which i am getting)
    But when i select multiple regions at a time, then i am facing the issue. I get result of multiple regions data(at a time two rows are displayed in the chart) in the chart. where in i want to get data only for one region (only one row needs to get selected at a time) to get the result.
    Can any one throw a light of what needs to be done here.
    Thanks,
    Rani

    Hi Rani,
    I am not sure if I understand your question exactly, but it sounds like you need to set the selection mode for your table to "Single". If you do that the user will only have the possibility of selecting one row at a time in the table; they will not be able to select multiple rows.
    You make that setting in the Configure Element panel for the table.
    I hope this suggestions helps.
    Margaret

  • How to send the output of the 1st BPEL process as a input to 2nd BPEL Proce

    Hi,
    I am working on OBPM 11G and my requirement is like below,
    From Mediator we need to call two different BPEL process. 1st one is Synchronous one and second one will be a one way interface. We need to call a java call out from Mediator and then give the output to the first BPEL process. The output from the first BPEL process has to be given to the second BPEL process with a filter condition.
    However we have achieved to call Java callout as well as call to two different BPEL process but facing issues in sending the output of the first BPEL process as a part of input to the second BPEL process.
    Any help on this would be appreciated.
    Bibhu

    Hi,
    Why do you need the third step, if the second step is a Numeric Limit Test step type, you can setup the limits of this step for your required limits of 11V and 12V. Your result is returned from your VI to Step.Results.Numeric which will be evaluated in the Status Expression giving you a Pass / Fail status.
    Look at the example TestStand\examples\demo\..\Computer Motherboard Test\computer.seq
    But to answer your reoriginal question, some additional information is required.
    What are your inputs and outputs assigned to in TestStand, do you use the Step properties, Locals, FileGlobals?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Need help for Format HD

    Hi I need Help for Formating HD so Wat Key need hold on start up for format HD I apprciated you Help

    Jesus:
    Formatting, Partitioning Erasing a Hard Disk Drive
    Warning! This procedure will destroy all data on your Hard Disk Drive. Be sure you have an up-to-date, tested backup of at least your Users folder and any third party applications you do not want to re-install before attempting this procedure.
    • With computer shut down insert install disk in optical drive.
    • Hit Power button and immediately after chime hold down the "C" key.
    • Select language
    • Go to the Utilities menu (Tiger) Installer menu (Panther & earlier) and launch Disk Utility.
    • Select your HDD (manufacturer ID) in left side bar.
    • Select Partition tab in main panel. (You are about to create a single partition volume.)
    • _Where available_ +Click on Options button+
    +• Select Apple Partition Map (PPC Macs) or GUID Partition Table (Intel Macs)+
    +• Click OK+
    • Select number of partitions in pull-down menu above Volume diagram.
    (Note 1: One partition is normally preferable for an internal HDD.)
    • Type in name in Name field (usually Macintosh HD)
    • Select Volume Format as Mac OS Extended (Journaled)
    • Click Partition button at bottom of panel.
    • Select Erase tab
    • Select the sub-volume (indented) under Manufacturer ID (usually Macintosh HD).
    • Check to be sure your Volume Name and Volume Format are correct.
    • Click Erase button
    • Quit Disk Utility.
    cornelius

  • Get the output of a query in a textpad..

    Hi..
    I need to get the output of a query in a notepad..
    Can anyone help me..

    spool c:\emp.txt
    fire select * from emp;
    spool off;
    go to c: and check your text file.
    hare krishna
    Alok

  • EXIT/BADI  for enhancing the output of the transaction S_ALR_87013532

    Hi,
      greetings to all!! I have a problem here guys-I need to find any exit or badi for enhancing the output of the tcode S_ALR_87013532.This tcode is used for seeing the planned/actual/variance of project cost.
    In  the output we have got 3 columns-total of years, previous years and 2009. Under each column we have Plan, Actual, Variance and VAR %. Our requirement is to show Functional Location(PRPS-TPLNR), Budget Number(TCN01-SWRT0), SBU (TCN01-SWRT1) and Region (TCN01-SWRT2) in each of the clolumns-you can also get the last 3 fields in PRPS table as USR00, USR01 and USR02.
    Can anyone help please?could not find anything worthwhile on SDN. Thnx  a lot !

    Hi,
    Check   these User-Exits..
    Exit name  Short text
    KAHFEX01  Selection data for commercial reporting in PS
    KAP10001  PS: Hierarchy Reports for Projects
    KAP60001  PS: Export Project Key Figures into R/3 EIS
    Also check the BADI
    WBS_USER_FIELDS_F4
    Regards
    Raghu
    Edited by: Raghavendra  Rao G on Sep 2, 2009 12:26 PM

Maybe you are looking for

  • Sending Purchase Order in mail without the spool generation

    Dear All, When i create a Purchase Order using Tcode ME21N, the PO should go by mail to an external email id as a pdf attachment. A Z sapscript is used . The spool request is not generated. Could anyone please let me know the method/code to use the s

  • What's the meaning of these information?

    I use java -verbose:gc to run MyApp, and there are two information displayed on the console. [GC 905K->905K(1984K), 0.0198318 secs] [Full GC 945K->944K(2152K), 0.0497921 secs] what's the every part's meaning of these information?

  • Tehnical data tab in work centre.

    HI While creating work centre in technical data tab by mistake i input some value but now i am not able to delete those value as system is showing it as mandetory field. Please help.... Thanks in advance. Regards, Anand

  • Graph to be displayed in 11g Forms

    Hi all I had a graph to be displayed....it is working fine when the data is fetching into the graph through cursors...but I want it to be displayed when it is with pl/sql table rather than displaying it with cursors(calling again and again) any sugge

  • Final Cut and multiple user accounts

    Hi all. I've got Final Cut Studio 5.1.4 installed and just setup a separate account on my PowerPC G5 running Mac OS X ver 10.4.9. When I run Final Cut from my original account it loads fine. When I run it from the new user account (that I went ahead