Wm_concat(column_name) order by [SOLVED]

The question is based on a other thread:
column values separated by ,
Aketi Jyuuzou Posted: Nov 23, 2007 3:17 AM
with the next statement there will be 4 records displayed
(there are 4 columns for this constraint)
select constraint_name, wm_concat(column_name) over(order by position) as column_names
from user_cons_columns
where constraint_name='EUL5_DOC_UK_2'
1 EUL5_DOC_UK_2     DOC_EU_ID
2 EUL5_DOC_UK_2     DOC_EU_ID,DOC_NAME
3 EUL5_DOC_UK_2     DOC_EU_ID,DOC_NAME,DOC_BATCH
4 EUL5_DOC_UK_2     DOC_EU_ID,DOC_NAME,DOC_BATCH,DOC_FOLDER_ID
is it possible to select only the last (4) record?
Thanks in advance..

Note that wmsys.wm_concat is undocumented and unsupported.
It looks like the script below, which I use to show me the constraints on a table, might be useful to you:
column "Constraint" format a20
column "Kolom(men)" format a40
column "Soort" format a11
column "Verwijst naar" format a23
column "Inhoud check constraint" format a36 truncate
accept P_TABEL char prompt 'Van welke tabel wil je de constraints zien? '
set verify off
select c.constraint_name "Constraint"
     , case c.constraint_type
       when 'P' then 'Primary key'
       when 'U' then 'Unique key'
       when 'R' then 'Foreign key'
       when 'C' then 'Check'
       else 'Anders: ' || c.constraint_type
       end "Soort"
     , rtrim(cc.cols,',') "Kolom(men)"
     , case when c.r_owner is not null then c.r_owner || '.' || c.r_constraint_name end "Verwijst naar"
     , c.search_condition "Inhoud check constraint"
  from user_constraints c
     , ( select constraint_name
              , p
              , c cols
           from user_cons_columns
          where table_name = upper('&&P_TABEL')
          model
                partition by (constraint_name)
                dimension by (nvl(position,row_number() over (partition by constraint_name order by null)) p)
                measures (column_name c)
                ( c[any] order by p desc = c[cv()] || ',' || c[cv()+1]
       ) cc
where c.constraint_name = cc.constraint_name
   and cc.p = 1
order by
       case c.constraint_type
       when 'P' then 1
       when 'U' then 2
       when 'R' then 3
       when 'C' then 4
       else 5
       end
     , c.constraint_name
undefine P_TABEL
set verify onGroet,
Rob.

Similar Messages

  • HT3529 I'm having trouble with my iPhone 5 iMessage service. The device does not recognize the users who have iMessage when I try to contact them using this feature. Who have the same issue and what did you do in order to solve it?

    I'm having trouble with my iPhone 5 iMessage service. The device does not recognize the users who have iMessage when I try to contact them using this feature. Who have the same issue and what did you do in order to solve it?

    Read here:
    http://support.apple.com/kb/ts2755

  • Job nfs-server.service/start deleted to break ordering cycle [SOLVED]

    I have the following entries in my journal:
    Found ordering cycle on rpc-statd-notify.service/start
    Found dependency on nfs-server.service/start
    Found dependency on rpc-gssd.service/start
    Found dependency on nfs-client.target/start
    Found dependency on rpc-statd-notify.service/start
    Breaking ordering cycle by deleting job nfs-server.service/start
    Job nfs-server.service/start deleted to break ordering cycle starting with rpc-statd-notify.service/start
    and nfs-server does not start. So it would seem that the nfs services are starting in the wrong order. Could some kind person explain why and tell me how to fix this?
    Apart from following the arch wiki for nfs I don't believe that I have changed anything.
    Thanks
    Andrew
    Last edited by fdservices (2014-08-11 07:14:05)

    Thanks for the quick reply.
    So I just need to install this new file:
    # /etc/systemd/system/nfs-client.target.d/DefaultDependenciesFalse.conf
    [Unit]
    DefaultDependencies=False
    Andrew

  • Is there a place to report mavericks bugs to  in order to solve them?

    For example...in launchpad all the app icons are missing...showing me just the text under!
    Where can I report this sort of problems?

    Here, because that is not a bug in Mavericks, rather a problem arising from upgrading an existing system that is dysfunctional. I recommend that you reinstall Mavericks and see if the problem isn't fixed. You can report legitimate problems, that is problems that not only exist on your system but others as well, to:
    Apple Feedback
    Using Apple Bug Reporter
    Fixing a Mavericks Installation Problem
    How to manage a failed OS X Mavericks installation | MacFixIt - CNET Reviews.
    1. Intel-based Macs: Resetting the System Management Controller (SMC).
    2. Repair the Hard Drive and Permissions - Lion/Mountain Lion/Mavericks
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu. Select Restart from the Apple menu.
    3. Re-download and reinstall Mavericks.
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion/Mavericks: Select Reinstall Lion/Mountain Lion/Mavericks and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • After the full clean installation of Lion, the MBP 13" has started too be too much slow. How can i check it out in order to solve this big problem? tks in advance!

    After i completed a full and clean installation of Lion, (it's to say not upgrading Snow Leopard but inizialing the hd and installing the new OS), every operations have started to make the laptop too much slow just working on Safari or Iphoto. How can i check out if everything is running finely or searchinf out something wrong?
    thanks in advance

    BS heißt "Bull___****". *lol* "Betriebssystem" heißt imemr noch "operating system". GoLive wirste wohl gar nicht zum laufen kriegen. ohnehin würde man es nicht mehr verwenden, weil es noch nicht mal CSS2 voll unterstützt geschweige denn HTML 5 und andere moderne Webstandards. Wenn überhaupt, dann findeste vielleicht noch 'ne OEM CD von Strato oder 1und1 bei eBay. Die haben das damals mit jedem neuen Hostingvertrag rausgehauen. Aber wie gesagt, es ist den Aufwand nicht wert. Illustrator sollte sich durchaus installieren lassen. Eventuell einfach nochmal die Installer im Win XP Kompatibilitätsmodus laufen lassen...
    Mylenium

  • Reg: WMSYS.WM_CONCAT or LISTAGG

    All,
    I am trying to select the column names which start with 'E' in my sql query projection area. For this i have used USER_TAB_COLS with WMSYS.WM_CONCAT / LISTAGG too.
    I got the column names, with ',' delimeter, but not able inject this to the sql query. Please help me.
    SQL> SELECT WMSYS.WM_CONCAT(column_name)
      2    FROM user_tab_cols
      3    WHERE table_name='EMP'
      4    AND column_name LIKE 'E%';
    WMSYS.WM_CONCAT(COLUMN_NAME)
    EMPNO,ENAME
    SQL> SELECT
      2    (SELECT WMSYS.WM_CONCAT(column_name)
      3    FROM user_tab_cols
      4    WHERE table_name='EMP'
      5    AND COLUMN_NAME LIKE 'E%'
      6    ) a
      7  FROM EMP where rownum<=4;
    A
    EMPNO,ENAME
    ERROR:
    ORA-22922: nonexistent LOB value
    ---LISTAGG
    SQL> select (select ListAgg(column_name,',')
      2         WITHIN GROUP(ORDER BY COLUMN_NAME DESC) AS CONCATV
      3  from user_tab_cols
      4    WHERE TABLE_NAME='EMP'
      5    AND COLUMN_NAME LIKE 'E%') a FROM EMP WHERE ROWNUM<=3;
    A
    ENAME,EMPNO
    ENAME,EMPNO
    ENAME,EMPNO
    Thanks,

    The SQL Projection must be defined and known to the SQL Engine during compilation time. So you cant pick a column name dynamically and expect it to return its values.
    So you have two options to achieve what do you want.
    1. Dynamic SQL
    2. XML
    Example for Dynamic SQL has already been shown to you. Below is a example for obtaining to the output as XML.
    SQL> select * from v$version where rownum = 1;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    SQL> select dbms_xmlgen.getxmltype
      2         (
      3             'select ' || ltrim(sys_connect_by_path(column_name, ','), ',') ||
      4             '  from ' || table_name
      5         ) xml_output
      6    from (
      7            select table_name
      8                 , column_name
      9                 , row_number() over(partition by table_name order by column_name) rno
    10              from user_tab_columns
    11             where table_name = 'EMP'
    12               and column_name like 'E%'
    13         )
    14   where connect_by_isleaf = 1
    15   start
    16    with rno = 1
    17  connect by rno = prior rno + 1
    18     and table_name = prior table_name;
    XML_OUTPUT
    <ROWSET>
    <ROW>
      <EMPNO>7369</EMPNO>
      <ENAME>SMITH</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7499</EMPNO>
      <ENAME>ALLEN</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7521</EMPNO>
      <ENAME>WARD</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7566</EMPNO>
      <ENAME>JONES</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7654</EMPNO>
      <ENAME>MARTIN</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7698</EMPNO>
      <ENAME>BLAKE</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7782</EMPNO>
      <ENAME>CLARK</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7788</EMPNO>
      <ENAME>SCOTT</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7839</EMPNO>
      <ENAME>KING</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7844</EMPNO>
      <ENAME>TURNER</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7876</EMPNO>
      <ENAME>ADAMS</ENAME>
    </ROW>
    </ROWSET>
    SQL>
    My version of oracle does not support LISTAGG. So i have used SYS_CONNECT_BY_PATH. But you can use LISTAGG to achieve the same.

  • Query gaves duplicate rows due to wm_concat()

    Here is the query that i need to run
    SELECT distinct UI.INDEX_NAME,ui.owner ,UI.TABLE_NAME ,wm_concat(uic.column_name) over (partition by uic.index_name order by column_position ) column_name ,ui.index_type, parameters
                             FROM
                             all_INDEXES UI JOIN all_IND_COLUMNS UIC
                             ON UIC.INDEX_NAME = UI.INDEX_NAME
                             where
                             SUBSTR(ui.index_name,1,3) not IN ('PK_', 'UQ_','DR$')
                             and ui.index_name not like 'SYS_C00%'
                             and ui.index_name not like 'SYS_IOT_TOP_%' and owner='USER1'
                        order by UI.INDEX_NAME
    The problem is wm_concat() because the table all_IND_COLUMNS contains the duplicate entry for index (index1 of type table(column1,column2,column3))
    for this wm_concat return the result as below:
    column1
    column1,column2
    column1,column2,column3
    But in *result i need only this for one particular index-name (distinct index)
    as a example i have two index in schema::::
    index1 on table1(column1,column2,column3) and
    index2 on table2(column5)
    need this result
    row1-- index1 column1,column2,column3
    row2-- index2 column5
    my query returns
    row1-- index1 column1
    row2-- index1 column1,column2
    row3-- index1 column1,column2,column3
    row4-- index2 column5

    smart000 wrote:
    You haven't mentioned the error or oracle version. listagg is valid from 11g Rel 2
    Soln1: Use wm_concat and use "group by UI.INDEX_NAME, ui.owner, UI.TABLE_NAME, ui.index_type, parameters"
    Soln2: (select wm_concat(column_name) from all_IND_COLUMNS uic
    where UIC.INDEX_NAME = UI.INDEX_NAME
    group by UIC.INDEX_NAME) as column_list
    For this solution change your sql, Avoid joining with all_IND_COLUMNS directly in the query, in this case distinct is also not required. [NOT TESTED]
    e.g
    SELECT UI.INDEX_NAME,
    ui.owner ,
    UI.TABLE_NAME ,
    (select wm_concat(column_name) from all_IND_COLUMNS uic
    where UIC.INDEX_NAME = UI.INDEX_NAME
    group by UIC.INDEX_NAME),
    ui.index_type,
    parameters
    FROM
    all_INDEXES UI
    where .................Using WM_CONCAT is not a solution... It is an undocumented function and Oracle does not support it, or any application developed using it. It's functionality may also change in future release without warning, or it may be removed from the database without warning. It is stupid to use undocumented functions.
    Unless of course, you know better than Oracle or Tom Kyte? Re: DISTINCT not working with  wmsys.wm_concat

  • Transfer Order: discrepancies between GI and GR management

    Hi everybody!
    I'll appriciate your suggest to manage this critical scenarios:
    Transfer Order from Pant A to Plant B (both the plants belong to the same company)
    Case 1:
    for an item GI qty  is major than GE qty
    For an item  GI qty is less then GE qty
    Case 2:
    for an item the material code entered into STO and into Delivery and so registered at GI moment, is different from that effectively delivered and received at receiving plant.
    Which are the necessary material documents that have to be created  and so the necessary stock adjustements that  have to be executed in order to solve every one discrepancies above described?
    Many thanks
    Roberta

    Many thanks for the answers;
    I'll try to explain better than before the scenarios
    Case 1:
    for an item GI qty is major than GE qty
    --> do an addition Goods receipt for the remaining in-transit quantity.
    alternative cancel the goods receipt, cancel the goods issue, redo the case with correct quantities
    The case is that in the Delivery created against the STO the GI qty registered is major than that effectively receipt from the receipt plant; If I cancel the movements I've not traces if the discrepancies happened
    For an item GI qty is less then GE qty
    --> how can this be possible? anyhow, cancel the goods receipt and post it with the correct quantity.
    alternative : cancel the goods receipt, cancel the goods issue, redo the case with correct quantities
    The case is that in the Delivery created against the STO the GI qty registered is less  than that effectively receipt from the receipt plant ( the whareauser has made a mistake during the picking activity); If I cancel the movements I've not traces if the discrepancies happened
    Case 2:
    for an item the material code entered into STO and into Delivery and so registered at GI moment, is different from that effectively delivered and received at receiving plant.
    cancel the goods receipt, cancel the goods issue, redo in SAP with material that you shipped physically.
    If I cancel the movements I've not traces if the discrepancies happened

  • Error in Asset Purchase Order

    Hi,
    We are in SRM 7.01, EHP1. I created a shopping cart with asset account assignment. Shopping cart created without any problem. When i am creating PO against shopping cart in sourcing cockpit or with source of supply in shopping cart i am getting the following error.
    Line 1: Enter another transaction type (Transaction typedoes not exist)
    Line 1: Error in account assignment for item 1
    And i am not able to create the purchase order. I am able to create the purchase order with all other account assignments for example:  WBS, cost center, Order .
    Please advise where i am doing mistake.
    (N. Kiran Kumar)

    Hi Kiran,
    Please implement the note below in order to solve this issue.
    954904   Follow-on Note of Note 905635
    Also please take a look at the note below.
    1410321  Shopping cart w/ asset acct assignment:Checks are
    Best regards,
    Christian Zeuch

  • Can anyone solve this PLL puzzle?

    I created a Phase Locked Loop circuit using Multisim10.0.   It uses the Multisim clock oscillator, and the circuit appears to work great.
    However, I just discovered that if I use the same parts that I used to create the Phase Locked Loop circuit in an oscillator circuit added to the same schematic, the Phase Locked Loop circuit doesn't work any more, while the new oscillator circuit pumps out a frequency that is way off.  4+MHz is no where near 1kHz, the design frequency.
    What happened?   The evidence says my newly-added oscillator brings in something that kills a previously working circuit that uses the same old parts.   Every part used was taken from the previously working circuit, aside from the variable resistor values.  How did the Multisim rules change from 10.0 to 10.1?  What am I missing here?
    Did the Phase Locked Loop circuit really work to begin with?  Which circuit is the broken one?
    As I see things, in order to solve this puzzle, I need to come up with a factor that involves both circuits.  Some factor is going to kill both simultaneously.
    Note what I'm saying here.  (At least when I ran them this was the case.)  Delete just the oscillator circuit, and run the circuit that remains.  It works.  Undo the deletion.  The oscillator reappears where it was, and the previously working circuit stops working.  There's something in that oscillator circuit that kills.  It's like switching on and off a light bulb.
    When I tried to upload both circuits, the extension isn't acceptable now.  Therefore, change the extensions to ms10.   (What the frig is going on??  I just uploaded here yesterday and didn't change the extension.  Am I in the Twilight Zone or something?) 
    Attachments:
    phase_locked_loop.txt ‏1 KB
    phase_locked_loop_puzzle.txt ‏1 KB

    Just curious
    Attachments:
    phase_locked_loop.txt ‏1 KB
    phase_locked_loop_puzzle.txt ‏1 KB

  • Can anyone solve this Phase Locked Loop puzzle?

    I created a Phase Locked Loop circuit using
    Multisim10.0.   It uses the Multisim clock oscillator, and the circuit
    appears to work great.
    However,
    I just discovered that if I use the same parts that I used to create
    the Phase Locked Loop circuit in an oscillator circuit added to the
    same schematic, the Phase Locked Loop circuit doesn't work any more,
    while the new oscillator circuit pumps out a frequency that is way
    off.  4+MHz is no where near 1kHz, the design frequency.
    What
    happened?   The evidence says my newly-added oscillator brings in
    something that kills a previously working circuit that uses the same
    old parts.   Every part used was taken from the previously working
    circuit, aside from the variable resistor values.  How did the Multisim
    rules change from 10.0 to 10.1?  What am I missing here?
    Did the Phase Locked Loop circuit really work to begin with?  Which circuit is the broken one?
    As
    I see things, in order to solve this puzzle, I need to come up with a
    factor that involves both circuits.  Some factor is going to kill both
    simultaneously.
    Note what I'm saying here.  (At least when I ran
    them this was the case.)  Delete just the oscillator circuit, and run
    the circuit that remains.  It works.  Undo the deletion.  The
    oscillator reappears where it was, and the previously working circuit
    stops working.  There's something in that oscillator circuit that
    kills.  It's like switching on and off a light bulb.
    Message Edited by Euler's Identity on 08-02-2008 12:10 AM
    Attachments:
    phase_locked_loop1.ms10 ‏649 KB
    phase_locked_loop_puzzle1.ms10 ‏174 KB

    Ah hey why not?
    After all, I still can't predict what the next filenames I uplaod are going to look like, not yet at least.
    However, at this point, it is safe to say it won't be what I uploaded.
    [drum roll]
    Attachments:
    phase_locked_loop1.ms10 ‏649 KB
    phase_locked_loop_puzzle1.ms10 ‏174 KB

  • Problem when creating a customer order (VA01)

    I'm trying to create a customer order to sell a material which has serial no. I use transaction VA01.when i wrote the serial no of the material that gives an error "the serial no doesn't exist in SNUM".when i checked that table, i saw that there is no data. Probably some missing or mistake about customizing.
    Does anyone have any idea, what should i do???
    Thanks...

    Create serial number profile in <b>T.code: OIS2</b> and
    Please Assign the serial number profile to the material master (Sales orgn/plant data) present in the sales order. Then recreate the order.this solves your problem.

  • Error in posting - Internal Orders

    Dear Forum,
    The users are trying to post the FI Document with the orders entered in the order field. However, the system does not allow the postings and gives the error message - FI Posting not allowed (Order xxxx).
    Could you please advise what needs to be checked in the system to resolve the error. The users are new in using the concept of Internal Orders.
    Thanks for the help!
    Regards
    Moderator: Please, search SDN

    Hi
    You need to release the order in order to solve this issue.
    Go to KO02 and enter the internal order number.  Go to the control data tab.  Clikck on the release.
    And now try to post the document
    ~THanks
    Rajesh

  • Error while issue material against production order

    Hi,
      In our development server recently we have created on ecompnay code and plant by copying the one existing company code and plant,  now for this new plant I have created new profit center with KE51  and after that I have create done cost ceneter in that this new profit center is assign   now while goods movment with MB1A with movmen type 201, 202  it works OK system is not giving any error  but while issue the material against production order in MB1A with movement type 261 system is giving error message
    No postings can be made to profit center DUMMYBAOPC in company code MT50
    Message no. KM183
    Diagnosis
    Profit center DUMMYBAOPC cannot receive postings in company code MT50.
    this profit center DUMMYBAOPC we use in old compnay code and for this new company code is not activated  for new we have new profit center  then it is  linking to that  what can be the solution.
    regards,
    zafar

    Hi,
      After asigning new profit center in the Production order problem solve.
    regards,
    zafar

  • Group by order by in same query

    Hi,
    I am wondering whether it is possible to use group by and order by in same query
    For example if i have a table like the one below
    Col1 Col2 col3
    C 36 2
    A 25 5
    B 12 8
    A 25 6
    B 12 9
    C 36 1
    A 25 7
    I need a result like below
    A 25 5
    A 25 6
    A 25 7
    B 12 8
    B 12 9
    C 36 1
    C 36 2
    can the select statement with group by and order by solve this? How?

    Yes you can - though I am not sure that it is what you want. In your example you do not need to group the data, you just need to order by the first column, then the third. If required, you could also throw in the second column;
    SQL> with t as  ( 
       select 'C' col1, 36 col2, 2 col3 from dual union all 
       select 'A', 25 ,5 from dual union all 
       select 'B', 12 ,8 from dual union all 
       select 'A', 25 ,6 from dual union all 
       select 'B', 12 ,9 from dual union all 
       select 'C', 36 ,1 from dual union all   
       select 'A', 25 ,7 from dual)  
    select col1,col2,col3  
    from t
    order by col1,col3
    COL1       COL2       COL3
    A            25          5
    A            25          6
    A            25          7
    B            12          8
    B            12          9
    C            36          1
    C            36          2

Maybe you are looking for