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.

Tags: Database

Similar Questions

  • AutoComplete - see value in the form of multi line + return value.

    Hi Experts,

    I had a simple solution for AutoComplete to see the multi line like: select line1 | Chr (10) | Line2 | Chr (10) | line 3 of une_table.
    In onblur DA it is a process that reduces the value, set the fields another request based on the process of pl/sql.

    After the upgrade to the latest version of apex + modified model - the integer value is displayed as a single line only (no need to any text is indicated).

    I want to manage something like: ExtJs - Ajax search field
    http://Apex.Oracle.com/pls/OTN/f?p=PLAYPEN:1:264121214928301:

    Is there a solution to the APEX to use AutoComplete with multi display value line without incorporating the ExtJs?
    Sorry for my English :)

    Thank you!
    Concerning
    J :D

    I'll add my plugin in 2 or 3 days...

    Welcome

  • 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.

  • from the drop-down list selection to multi-line output

    I am trying to create a pdf form with Adobe XPro, where I will have multiple delivery addresses. I want to have is that the user can select the correct recipient group in the drop-down list.

    Given that the drop-down lists pdf format are just simple lines the drop-down list selection could only display the name of the company (e.g., COMPANY A) and selecting the company wanted to, this would trigger the whole address (multiline) to appear as described below (on another text field is ok if necessary)

    THE COMPANY

    StreetAddress 1

    City of ZIP-1234

    Does anyone have an easy solution for this?

    I have created a sample form for you, please look at attachment.

    PDF form does exactly what you want.

  • The formatting String and Integer output in the field of rich text in Blackberry development

    Hello

    well to help try to string format and Intreger (of a method called getScore()). but not output as required.

    example code:

    VFM. Add (new RichTextField ("% - s 15% 15 %n d", name, getScore())); > not Workin not at all

    VFM. Add (new RichTextField ("% - s 15% 15 %n d" + name + getScore())); > name and Score of return but not formatted

    My goal is to have

    NAME                                                                            SCORE

    sam                                                                                20

    BB                                                                                   5

    Hello

    Thanks for your reply, I have dealt with the issue of a reference I got online, solved my probled.sample below

    private String getModifiedName (String name) {}
    String testString = "this is a very large string";

    While (getFont () .getAdvance (testString) > getFont () .getAdvance (name)) {}
    name = name + "";
    }
    return the name.
    }

  • The device independent Postscript file will not let me choose the format of paper or output options

    I am trying to output separated PDFs from InDesign (Mac OS 10.8) CS6. My only output options are a laser printer that can actually produce 2 pages on a single document or a device independent postscript file for which all output options are grayed out.

    I used to do all of this from a previous version of InDesign using the plugin Adobe PDF as the PPD, with Acrobat Pro has been installed, but I have the latest version of Acrobat Pro, and that no longer works.

    (If you know ' why the PDF previously separated: the driver to press the company that prints our book was never able to determine its RIP settings to save me from this nonsense without end.)

    You can get the PPD 9 Adobe InDesign CS6 optionally print but not sure it will work on Mac 10.8, follow the below steps and then check: -.

    1. Quit InDesign.

    2. Navigate to/Applications/Adobe Indesign CS5/Presets /.

    3. In the Presets', folder create a file called PPDs (the name of the file is case-sensitive).

    4. Control-click on the following link and choose Save link under download the Acrobat 9 PPD:

    5. Place a copy of the PPD downloaded into the folder created in step 3.

  • How can I add multi line selection in a drop-down list

    I just started with Acrobat DC. Everything is simple, until it isn't. I try to add items to my drop-down list. It's easy. I'm trying to make the choice of multi line. It is an inspection report and the choice will not fit on a single line. So after making the choice, can not read the answer. Thank you-Tim

    It is possible to do it, but only with a script and it's a kind of buggy. In other words, not really a good idea.

  • the formatting generated XML using XMLELEMENT() my output approximates to a single line, I want to be in an XML format

    Hi I have a problem in the formatting of XML file, that I generated with xmlelement() when I run it gives me putput in one line

    is it possible that I got my output as an XML file...

    This is the expected behavior. PRETTY print (ing) is required for humans. XML parsers do not need XML to be pretty printed. If you open the XML file in a browser such as Windows Explorer or Firefox, the browser will display enough output for you.

    In all, the exit 'single line' is made for PERFORMANCE reasons (lack of useless end of line and CTRL line breaks etc.)

    SELECT xmlelement ("employee name", model ") as"RESULT XML.

    FROM DUAL;

    X

    SELECT xmlelement ("employee name", xmlelement ("name", false))

    , xmlelement ("LastName", dummy)

    ) as "RESULT XML.

    FROM DUAL;

    X X

    XMLSERIALIZE enough to print the result if necessary via indentation

    SELECT XMLSERIALIZE (SIZE of withdrawal CONTENT xmlelement ("Employee Name", xmlelement ("name", model), xmlelement ("LastName", false)) as CLOB = 1).

    FROM DUAL;

    X

    X

  • Help! Multi-format editing - which the Format transcode to?

    Hello world

    Recently, I had a lot of footage that is given to me to change.

    He left retirement to the Sheriff.

    It was shot on 3 different camera.
    ______________________________________________

    A JVC Pro GY-HM750
    Sequence sheet: XdCam Ex 720 p 60 (35 Mb/s VBR)

    A 70 D DSLR

    Sequence record: H.264 720 p (FPS - 59.9)

    And a GoPro

    Footage Specs: GoPro (FPS - 59.9) 720 p AVC encoder

    _______________________________________________

    FPS and size are the same.

    However, the formats are all different.

    I have a subscription to the CC and will be all about CEP edition.
    I was wondering what format should I transcode everything well to be able to change all
    and maintain the highest possible quality?

    Any feedback would be greatly appreciated!

    Thanks for your time!

    The beauty of the first is that there is usually no need to transcode, it will edit the native images mixed together. Looks like all the clips are 720 p 60, so it's good that there is no mixed frame rate. Simply pick a 720 p 60, such as AVCHD for example and start sequence to edit.

    If you want to make a Blu - ray player, you can use Media Encoder and export to 720 p 60 for this. For Youtube, 720p30. For DVDs, using "MPEG-2 DVD" and a "Preset" "widescreen progressive."

    One thing that could be a problem - images of the GoPro are sometimes difficult to play/edit due to the high compression, as well as images a lot of fisheye in she. GoPro software can transcode the native AVI or MOV clips for easy editing and can also remove/reduce the fisheye in the process (check box for this option). So you can transcode this sequence, but in general, you can almost always change anything natively in first.

    I should also mention, if you have the memory cards original, copy ALL of the content of each in a single hard disk folder, then in the first, use the "media browser" import instead of "file > import", which can help in many areas. If the people you gave the video clips themselves, then you have to work with what you have.

    Thank you

    Jeff Pulera

    Safe Harbor computers

  • Upgrade to 3.6.15. Now my Add ons (1 password, Download Helper, Multi line Bookmark Toolbar) disappeared. Everyone knows about this problem? Any ideas on how to solve this problem? Thank you.

    Upgrade to 3.6.15. Now my Add ons (1 password, Download Helper, Multi line Bookmark Toolbar) disappeared. Everyone knows about this problem? Any ideas on how to solve this problem? Thank you.

    There may be a problem with one of the files which stores details of the installed extensions. Try to delete these files as described in the section "Corrupt extension files" of this link - https://support.mozilla.com/kb/Unable+to+install+add-ons

    Although this article is not specifically about your problem, the method indicated in the corrupted files extension section can help. When you restart Firefox after you delete these files, the list of installed extensions is rebuilt and cela hopefully solve your problem.

  • How to calculate the height of LabelField when it displays in multi lines

    Hello friends,

    We use LabelField.getPrefereredHeight () to calculate the height of the label field. But he returned the same value when it is displayed online singel or multi line.

    Please help me for differing from the height of the label while displaying field multi-line and single-line

    Thank you very much in advance

    If the code is simple, then you might want to go ahead and post it.  I can't really speculate on exactly the problem in this case unless I see code.  It doesn't sound like you should not show the width and height of your Manager 1 however.  Here is an example of a sublayout of one of my managers:

        protected void sublayout(int width, int height) {
            int numFields = getFieldCount();        int availableHeight = height;
            int totalHeight = 0;
    
            for (int i = 0; i < numFields; i++) {
                Field field = getField(i);
    
                layoutChild(field, width, availableHeight);
                            availableHeight -= field.getHeight;
                totalHeight += field.getHeight();
            }
    
            setExtent(width, totalHeight);
        }
    

    This code is educating the Manager to use the full width so much to her and didn't use as much height as it needs (drunk on her children and adding up their respective Heights).  I don't know if this helps, but if you have any other questions please do not hesitate to post the code and we'll see what happens.

  • Help with a script that detects the content in a cell and apply the cell style to line

    Hello


    I am trying to add an article to my table formatting script that is a cell with the word 'Budget' (but this can be written as ' Budget:' or ' Budget: (E) "- but without the speech marks) and apply the cell Style - SponsorCells - to all the cells of the whole line. I currently have on what it will, but it does not work:


    function checkWhichTable()
    {
    // ensure the user made a selection
    if (app.selection.length != 1)
    return null;
    var currentTable = app.selection[0];
    if (currentTable.hasOwnProperty("baseline"))
    {
    currentTable = app.selection[0].parent;
    }
    while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column)
    currentTable = currentTable.parent;
    if (!(currentTable instanceof Table))
    {
    // No table selected
    return null;
    }
    return currentTable;
    }
    app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table");
    
    
    function checkUserSelection ()
    {
    var a_table = checkWhichTable();
    if (a_table == null)
    {
    if (confirm("No table selected. Do you want to process *all* tables?") == false)
    return;
    allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (aTable=0; aTable<allTables.length; aTable++)
    {
    processTable (allTables[aTable]);
    }
    } else
    {
    processTable (a_table);
    }
    }
    function processTable(table)
    {
    // do something here!
    
    
    //Set 1st Row Height
    table.rows[0].height = "30mm";
    
    
    //Find Text in Cell and apply Cell Style to Row 
    var  
      myCellText=['Budget', 'Budget:', 'Budget: (E)'];  
     var myRegEx = new RegExp("^("+myCellText.join("|")+")$");
      for (i=0; i<table.cells.length; i++)
      {
        if (table.cells[i].texts[0].contents.match(myRegEx))
          table.cell[i].appliedCellStyle = "SponsorCells";
      }
    
    
    //end - do something here!
    }  
    


    I can get the script to apply the cell style to "SponsorCells" for each cell that contain the word 'Budget' etc, but I need cell ever on this line to have the cell style applied. I tried to re-write line 56 which applies the style to a cell, but I can't seem to make it work. Any help would be great.


    Separate on this issue, I would like to have a line of code similar to the 46 line, which sets the 1st height of lines, but I would like to say "If a cell has 'A cell Style' and then applies the value height 10 mm". If someone could result as a help of bonuses, things would be great double.


    Thanks in advance!

    But that could be painfully slow. To speed things up, follow these steps:

    var cells = table.cells.everyItem().getElements();
    for (var i=0; i
    

    It is faster, because it creates an array of cells with a call to table.cells, which is several times faster than calling table.cells. And before assigning to line 12mm height is useful to check if it is already 12 mm. checking things in InDesign and do things only when it is necessary is much more effective than simply doing things even if they are not necessary.

  • Help for a date and time string in the format of get-date

    When you take a date / time string of an object:

    The format of the entry is a string and get-date doesn't seem to be able to convert to the

    a System.DateTime.

    I want to compare this value to 30 days so there are get-date ((get-date).adddays(-30))

    When I try the following, it seems to work then import it:

    (get-date - UFormat "%d/%m/%Y %T" ("2010-06-30 00:00:00" ""))

    If I add the following:

    "[datetime]" (get-date - UFormat "%d/%m/%Y %T" ("2010-06-30 00:00:00" ""))

    He can't convert it.

    Without the datetime component, when I try a superior test uses only the date

    the part as well:

    $Test = '2009-10-06 00:00:00.

    If ($Test - gt (get-date - UFormat "%T"("06/05/2010 00:00:00") %d/%m/%Y ""))

    {

    $Tested = 'Yes '.

    }

    On the other

    {

    $Tested = 'no '.

    }

    $tested

    Results in a Yes tentatives being earlier.

    In the script it returns all records where the date is after

    as 05 and ignore the year, month, and time.

    Any help with this would be greatly appreciated.

    Thank you

    This has to do with the 'culture' that you use in your PowerShell session.

    You can use the Get-Culture cmdlet to see that one you use.

    If you try

    [datetime](get-date -UFormat "%m/%d/%Y %T"("30/06/2010 00:00:00"))
    

    The parameter - UFormat produces a string and

    the cast is expected default mm/dd/yyyy format, for the part of the date.

    So, by reversing the month and day of your UFormat string - that has been corrected.

    BTW, I have attached the line because the SW forum do not have hooks.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • change the format of output file

    Hi all

    Can someone help me how to change the output file I get after clicking on the button EXPORT space separated to Comma seperated.. ?

    When I click on EXPORT, the output file (.dat file) is generated in the folder Outbox. I want to change the format of the data in this file as described above.

    Ex: "Account 9556545 hasnaoui" should convert as "account, 9556545, hasnaoui.

    Thanks in advance!

    In the adapter, go to export action script. There is a variable called strDelimiter that defines the delimiter character. By default it is set to "" change it simply to «,»

  • Changing the format of output for simultaneous Standard programs

    Hi gurus,

    Can someone let me know if we can change the output format of the simultaneous Standard program.

    I have a requirement where I need to change the output format of the program simultaneous to text in the PDF Format.

    Will be supported Oracle if we make this change in the Standard program to print output to PDF Format.

    Thanks in advance

    Yes it is possible to change the output format of Standard concurrent programs.

    for our needs.

    We changed the output format of simultaneous program 'Active users' text to PDF...

Maybe you are looking for

  • How to connect Lenovo IdeaPad Yoga 13 5.1 speakers?

    Hello I want to buy Lenovo IdeaPad Yoga 13 (with processor i7, 8 GB RAM and SSD 256). But the main problem is that I don't know how to connect to System 5.1 surround. Currently, I have Dell Studio 1555 with 3 audio ports, so it's very simple, but thi

  • Unreadable discs

    We install a new AX4 - 5i which will be connected to a server on Win2003 SP2 x 64 edition. The connection is via a QLogic QLE4060C; the firmware version is 3.0.1.33 and driver is 2.1.4.19 (STOR wx64) who are both present. The storage unit has install

  • HP deskjet 2510 is not shared with the group home

    Followed the instructions to install this new printer but can't download via setupweb cause of the above troubleshooting using Windows error message

  • Columns null ODI SCD

    Hi allI am using SDC KM in my interface. Insert in I$ Code is below.So there is a problem of performance because where clause. My target table has hundrand of millions of documents.or (s. [column] IS NULL and t [column] IS NULL)I want to use NVL func

  • Shares of LR do not copy in windows Explorer.

    I import photos from my camera in a single folder in LR5 and then expand them before you drag / drop in several other cases, all within LR. When I subsequentlylook the photos in windows Explorer, I find that they are duplicated and are still displaye