How to get result in comma separated

I have the follwing query with simple join
select c.f_category_id,c.f_category_name,sc.f_subcategory_id,sc.f_subcategory_name
from mcp_adv_category c join mcp_adv_category_trans ct on c.F_CATEGORY_ID =ct.F_CATEGORY_ID join mcp_adv_subcategory sc
on ct.F_SUBCATEGORY_ID =sc.f_subcategory_id
CID      CNAME    SID      SNAME
C152     M123456  SC107    FOOTER
C152     M123456  SC108    TOP
C152     M123456  SC111    LFT
C152     M123456  SC100    right
C153     AMA      SC108    TOP
C153     AMA      SC107    FOOTER
C155     RAMA     SC108    TOP
C155     RAMA     SC100    right
C155     RAMA     SC107    FOOTER
9 rows selected.the required is
CID      CNAME    SID                           SNAME
C152     M123456  SC107,sc108,sc111,sc100    FOOTER,top,lft,right
C153     AMA      SC108,sc107                 TOP,footer
C155     RAMA     SC108 ,sc100,sc107          TOP,right,footerhow to do this?

Example..
SQL> ed
Wrote file afiedt.buf
  1  select deptno, ltrim(sys_connect_by_path(ename,','),',') as enames
  2  from (
  3        select deptno, ename, row_number() over (partition by deptno order by ename) rn from emp
  4       )
  5  where connect_by_isleaf = 1
  6  connect by deptno = prior deptno
  7         and rn = prior rn + 1
  8  start with rn = 1
  9* order by deptno
SQL> /
    DEPTNO ENAMES
        10 CLARK,KING,MILLER
        20 ADAMS,FORD,JONES,SCOTT,SMITH
        30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
Or to ensure names are distinct...
SQL> ed
Wrote file afiedt.buf
  1  select deptno, ltrim(sys_connect_by_path(ename,','),',') as enames
  2  from (
  3        select distinct deptno, ename, dense_rank() over (partition by deptno order by ename) rn
  4        from emp
  5       )
  6  where connect_by_isleaf = 1
  7  connect by deptno = prior deptno
  8         and rn = prior rn + 1
  9  start with rn = 1
10* order by deptno
SQL> /
    DEPTNO ENAMES
        10 CLARK,KING,MILLER
        20 ADAMS,FORD,JONES,SCOTT,SMITH
        30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
SQL>

Similar Messages

  • How to get result without single cotes in ''Cast(Multiset( '' Result.

    select cast(multiset(select column_name
    from user_tab_columns
    where table_name = 'DAILY_PRODN_MIS'
    and column_name like '%STOCK%'
    order by column_name) as tab_type) result from dual;
    RESULT
    TAB_TYPE('BAGS_STOCK', 'BLUE_DUST_STOCK', 'CEMENT_STOCK', 'CEMENT_STOCK_33', 'CEMENT_STOCK_43', 'CEMENT_STOCK_53', 'CK_ADJ', 'COAL_IND_D_STOCK', 'COAL_IND_D_STOCK_ADJ', 'COAL_IND_E_STOCK', 'COAL_IND_E_STOCK_ADJ', 'COAL_IND_F_STOCK','OCK_ADJ', 'MTD_COAL_IMP_D_STOCK_ADJ', 'MTD_COAL_IMP_E_STOCK_ADJ', 'MTD_COAL_IND_A_STOCK_ADJ', 'MTD_COAL_IND_B_STOCK_', 'YTD_COAL_IMP_B_STOCK_ADJ', 'YTD_COAL_IMP_C_STOCK_ADJ', 'YTD_COAL_IMP_D_STOCK_ADJ', 'YTD_COAL_IMP_E_STOCK_ADJ')
    How can i get result without single cotes for each column.

    Your query currently returns a collection type (tab_type) whereas it appears you want to return a delimited string.
    There are actually quite a few ways to achieve this - with your own function, with a user-defined aggregate functions (e.g. Tom Kyte's stragg), with the MODEL clause or with CONNECT BY, e.g.
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> SELECT table_name,
      2         SUBSTR (MAX (SYS_CONNECT_BY_PATH (
      3            column_name, ',')), 2) column_names
      4  FROM  (SELECT table_name, column_name,
      5                ROW_NUMBER () OVER (
      6                   PARTITION BY table_name
      7                   ORDER BY column_id) column_order
      8         FROM   user_tab_columns
      9         WHERE  table_name = 'BANK_ACCOUNT'
    10         AND    column_name LIKE '%U%') utc
    11  START WITH column_order = 1
    12  CONNECT BY column_order = PRIOR column_order + 1
    13  AND    table_name = PRIOR table_name
    14  GROUP BY   table_name;
    TABLE_NAME           COLUMN_NAMES
    BANK_ACCOUNT         ACCOUNT_NAME,ACCOUNT_NUMBER
    SQL>

  • How to get result of PING whether TRUE/FALSE and prompt message to user?

    Hi all!!!!
    In Forms 6i, I need to know how to get the result of a ping if the ping is sucessful or not. It should prompt the user whether the connectivity is there or not after the ping statement which is HOST('PING 191.10.10.40'). As of now, when the user select the desired LOV, the corresponding HOST statement is executed. But if the connectivity is not there, the user is left in blank with a hanging situation... So can we not prompt the user if the connection has been failed or not?
    Regards

    Hi,
    You can try this.
    Redirect the output of the ping test to a file. Read the file using TEXT_IO and see if the test is passed. For ex
    host('ping <your_ip> > c:\ping_test.log');Will redirect the ping output to ping_test.log file under c:\ drive.
    Open the file using TEXT_IO and check if you have the text "Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)". If you have, then the host is reachable. Otherwise its not. Depending on that, you can change the flow of your application.
    -Arun

  • How to get result of Select from stored function.

    I need to get result of select from a stored function.
    In the end of my stored function I makes final select (four columns).
    How it can be retrived from function?

    Hi,
    A function can only return one value, but it sounds like you want to return 4 values.
    The one value that you return can be a record, with many columns, such as a ROWTYPE, or a TYPE that you define.
    You can return an XMLTYPE that has whatever elements you want.
    You can write a procedure that has several OUT parameters. (You can have OUT parameters in a function, but a lot of people find that confusing.)
    In very special circumstance, you might consider returning a string that is a delimited list of values, such as '7639,SMITH,,17-DEC-1980'.
    Someoneelse has a good point.
    We could give a better answer if you ask a specific question, like:
    "I have this table ...
    I want a function such that, if I call it with these parameters ... I get ...
    but if I call it like this ... then I get ..."

  • How to get result of MDM validation expression with type warning?

    I need  to get result of MDM validation expression with type WARNING (in automatic execution),
    but - method validationResult.getFailedValidations(..) returns validation if it has type ERROR,
    so all Warnings treated only as success despite it returned false or true.
    My question - how can I get that 'false or true' expression resut for validation.
    thanks

    Hello Vladimir
    By my opinion, hook warning exception isn't make sense because after warning message data will be change(upload).
    Moreover  if you start validation from WF Warning exception doesn't work at all.
    If you want to do some data changes you should use and hook Error exception.
    Regards
    Kanstantsin Chernichenka

  • How to get result

    hi
    i created a java source coded below
    CREATE OR REPLACE JAVA SOURCE
    NAMED "Welcome"
    as import java.lang.*;
    public class Welcome
    public static void main(String s[])
    System.out.println("Welcom to java");
    java created.
    but how to get the result "welcome to java"
    how call or execute Welcome class file.
    thanks any one help
    bye

    Try this:
    CREATE OR REPLACE JAVA SOURCE NAMED Welcome
    as
    import java.lang.*;
    class Welcome
      public static void main(String s[])
        System.out.println("Welcome to java");
    CREATE OR REPLACE PROCEDURE welcome
    AS LANGUAGE JAVA NAME 'Welcome.main(java.lang.String[])'; 
    set serveroutput on
    call dbms_java.set_output(2000);
    exec welcome;

  • How to get Result Count Content By Search Webpart (ContentBySearchWebPart)?

    I'm writing a webpart that extends the out of the box ContentBySearchWebPart.
    Does any one know how to get the search result count from this webpart?
    I did not find any property?

    Hi 
    Thanks but you are referring to the "Search Webpart". I am referring to the "Content Search" or often called "Content by Search" which is different. It's the one under Content Rollup.
    Although very similar they're not - Content Search WP doesn't have that property.
    What I am really after is to hide the whole webpart if there are no results coming back. I tried to figure it out and even write a jQuery that would search for the text "There are no results" message which comes from the webpart when result count=0
    and hide the parent webpart that way. There will be a short flash once the page loads rendering the webpart for a split second and then disappear by jQuery - which is not great UI experience.
    There is this property: "ShouldHideControlWhenEmpty" but it doesn't do anything when there are no results. The webpart is still visible. Webpart has a the Title and the Border around it so when there are no results the title and the border show
    up with no results. Like I said I want to hide the whole thing in that case.
    So I thought I could extend the OOTB ContentBySearchWebPart and get a hold of some kind property that would get me the result count. If the results count is 0 simply I would hide the webpart server side.
    Thoughts?

  • How to get result after click alert view by itms-services://?action=download

    hi,
    is any possible to get result after click alert view by using [[UIApplication sharedApplication] openURL:@"itms-services://?action=download-manifest&url...
    when i close app, the alert view ([[UIApplication sharedApplication] openURL) is aleady exist, is it not uialertview?, i can't find any alert view by
    for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows])   {
            if ([[keyboardWindow description] hasPrefix:@"<UIALERT"] == YES) {
                isExists = YES;
    any help, thanks.

    I have the MS-6968 device and i want to use driver 1.4.x or 3.0.x. I found the driver 1.4.2.10 but i cannot find any WIDCOMMSecurity code.
    So, can anyone give me a link for BTWPatcher.exe???
    It cannot be found here (Jon's Bluetooth ) anymore.
    Thanks

  • How to get result set

    Hi all,
    Please tell me how to get the below required out put.
    this is my table and data
    with t as (select 11 plcy,1 nm from dual union all
    select 11 plcy,2 nm from dual union all
    select 11 plcy,3 nm from dual union all
    select 11 plcy,5 nm from dual union all
    select 22 plcy,1 nm from dual union all
    select 22 plcy,2 nm from dual union all
    select 22 plcy,3 nm from dual union all
    select 33 plcy,1 nm from dual union all
    select 44 plcy,2 nm from dual union all
    select 55 plcy,4 nm from dual union all
    select 66 plcy,3 nm from dual )
    select * from t
    this my required output.
    from above query required output is below
    plcy      nm
    11      5
    33      1
    44      2
    55      4
    66      3
    if pass nm = 5 then 11
    if i pass nm= 1 then 33
    if i pass nm=2 then 44
    if pass nm = 4 then 55
    if i pass nm =3 thne 66
    it means it has only one value from plcy
    11 5
    33 1
    44 2
    55 4
    66 3
    thanks,

    Something like this:
    SQL > with t as (select 11 plcy,1 nm from dual union all
      2             select 11 plcy,2 nm from dual union all
      3             select 11 plcy,3 nm from dual union all
      4             select 11 plcy,5 nm from dual union all
      5             select 22 plcy,1 nm from dual union all
      6             select 22 plcy,2 nm from dual union all
      7             select 22 plcy,3 nm from dual union all
      8             select 33 plcy,1 nm from dual union all
      9             select 44 plcy,2 nm from dual union all
    10             select 55 plcy,4 nm from dual union all
    11             select 66 plcy,3 nm from dual
    12  )
    13  SELECT     MAX(plcy) plcy
    14  ,  NM
    15  FROM       t
    16  GROUP BY NM
    17  ORDER BY PLCY
    18  /
          PLCY         NM
            11          5
            33          1
            44          2
            55          4
            66          3

  • SUBMIT RFGLBALANCE WITH selection criteria, then How to get resulted itab?

    Hi Experts,
    Am looking to develop a similar report which is doing by SAP at detail/item level, but am looking to develop a SUMMARY level.
    SAP report is = FS10N (bhind prog. is RFGLBALANCE / RFGLITEMS )
    my_alv = shuld show only TOTALS / SUMMARY line
    Almost the selection screen is same in both cases.
    So, I wanna to use the same prog. by using SUBMIT from my_alv_report.
    So, when I use
    SUBMIT RFGLBALANCE
      WITH ..........................
      WITH ........................
    AND RETURN.
    then, my_alv_report control goes to RFGLBALANCE prog. there my input is processed and the output internal table is populating in RFGLBALANCE.............so, now, I wanna to get / fetch / pull this populated internal table into my_alv_repor and there by using the same for my alv display.
    ( I know that, if both r Z prog.s/ Z_BAPIs, then, I can use EXPORT & IMPORT )
    So, pls. let me know that,
    Is it possible ?
    If so, How to get it done?
    SUBMIT Syntax pls.
    thanq

    thanq.
    so, then, Can I use like, *INCLUDE RFGLBALANCE*(Standard Prog.) in my_alv_report, I mean, like
    report my_alv_report message-id Z1.
    INCLUDE RFGLBALANCE.
    own_Logic.
    thanq

  • How to get result of select query from  oracle  in VC

    Dear All ,
    I have a application in oracle which insert the data in the oracle database table.
    Now i want to show all the data that has been inserted into the database table in my VC application but i don't know how to handle select query in VC.
    Regards
    Krishan

    Hi Goivndu
    Thanks for your reply .
    I know all those things.
    I have created the system & alias  for my backend oracle system.
    I can also see all the stored procedure that are there in my oracle system.
    I just want to know how to write a select query in a stored procedure .
    you can insert data , Update data through oracle procedure but i don't think there is any way to get the result of select query in stored procedure .
    If you know any way to do that please do let me know .
    Regards
    Krishan

  • How to get results of search help window?

    Hi, experts,
    I have a question here.
    For a field vendor id there is pre-defined search help, with which the detailed information of vendor inclusive the vendor id will be returned. But it will only fill this vendor id field. other information in the result like vendor name will be lost. I still need this information for other fields. And I hope to get other fields filled with the info in the results.
    How can I get the complete info in the result delivered by search help window?
    Can anybody help?
    Best regards,
    Fan

    In short you need to fill the other fields on the screen using the same search help.
    for that read this thread, Thomas nicely explained the same with an example
    Re: Help On Search Help !!!!!
    Abhi

  • NumberFormat Parse gives incorrect result for comma separator

    I have a string 1,5 and i am creating NumberFormat with US locale. I expect NumberFormat.parse method to give me exception for string 1,5 string. But it doesn't. The result is 15 for 1,5 string. Please help.
    I have a class where i did test. I have tried 3 cases. All 3 cases didn't work. Any idea how to solve it?
    import java.util.*;
    import java.text.*;
    public class testv
         public static void main(String[] args)
              DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
              System.out.println("Decimal separator: "+symbols.getDecimalSeparator());
              System.out.println("Group separator: "+symbols.getGroupingSeparator());
              String s = "1,5";
              NumberFormat fmt = NumberFormat.getInstance(Locale.getDefault());
              Number num = null;
              try
                   //start of case 1*********
                   num = fmt.parse(s);
                   //end of case 1************ desn't work
                   //start of case 2*********
                   /*ParsePosition parsePosition = new ParsePosition(0);
                   num = fmt.parse( s, parsePosition);
                   if (! ((parsePosition.getIndex()) == ( s.length() )) )
                        throw new ParseException("parseerror",0);
                   //end of case 2*********          desn't work     
                   //start of case 3*********
                   /*if (fmt instanceof DecimalFormat)
                        ParsePosition parsePosition = new ParsePosition(0);
                        num = fmt.parse( s, parsePosition);
                        if (! ((parsePosition.getIndex()) == ( s.length() )) )
                             throw new ParseException("parseerror",0);
                   //end of case 3************ desn't work
              catch (Exception e)
                   e.printStackTrace();
              System.out.println("Parse string: "+s+" result: " + num.toString()+" result in double: "+num.doubleValue()+" locale: "+Locale.getDefault());
         }

    Hi,
    According to your description, I am afraid your problem is out of support in C# forum. For ASP.NET question, please go to
    ASP.NET Forum to post your thread.
    Best Wishes!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and
    makes it easier for other visitors to find the resolution later.

  • How to get result from another JSP file?

    I have to write a jsp (my.jsp) to get information from another jsp file (other.jsp).
    The other.jsp return integer value (0 / 1) so that user can tell if certain service is available or not. And in my.jsp I need to collect such result and other information from a text file to make up of a XML string.
    How can I call other.jsp to get the result? Thanks a lot.

    Hi, I think I didn't describe the problem clearly
    enough. In fact, there is a JSP file, and if our
    database is currently connected, the JSP will return
    value 1, otherwise, it will return 0. My java program
    need to get that result, and then form an XML string,
    and send the string back to the client. I'm just
    wonder how can I write such a program to read result
    from JSP file. Thanks a lot.Why is this function implemented as a JSP file? It should be implemented as a bean. It would be simple to get the information you require from that bean.

  • How to get result of HTTPService within a function?

    Hello all,
    I'm trying to call an HTTPService's send() and get the
    resulting data from within a function, and assigning it locally.
    Specifically, this is what I want:
    private function getData():void {
    myRPC.send();
    //How do I set the result of myRPC.send to a variable here?
    // Neither myRPC.send().result, nor myRPC.lastResult works! I
    get null both times!
    // But if I set myRPC.result to a separate function that
    handles an event, I get the correct data...but not what I want.
    var myObject:Object = ???? myRPC.???
    <mx:HTTPService result="???" fault="???" id="myRPC"
    method="GET" resultFormat="e4x" url="someurl" useProxy="false">
    <mx:request xmlns="">
    <somedata>hi</somedata>
    </mx:request>
    </mx:HTTPService>
    I am also not sure what to put in 'result' and 'fault' since
    I don't want the result/fault to be passed to another
    function...could anyone explain this please? Thanks!

    "Hamshmam" <[email protected]> wrote in
    message
    news:g70olu$jcd$[email protected]..
    > Hi Greg,
    >
    > While this is not what I am looking for, thanks for your
    response.
    >
    > I am familiar with traditional HTTPService requests and
    passing the
    > resulting
    > event to a function handle directly and then modifying
    the object from
    > there.
    > However, as I described in my earlier post, I'm looking
    for a way to get
    > the
    > resulting event of the HTTPService.send() within a
    different function.
    >
    > I am doing this because if I have another function
    dependent on the
    > HTTPService.send()'s data, I cannot simply call the
    HTTPService.send()
    > from
    > within that function and update a class private var with
    the data, which I
    > access from the wrapping function. This is because the
    HTTPService is by
    > nature
    > asynchronous, so it is possible that the class private
    var will remain
    > null
    > while further lines of code are executed, all the while
    the HTTPService is
    > interacting with the server concurrently.
    >
    > I hope it is clear now why I need to assign the result
    of a HTTPService
    > result
    > directly within a function, if you or anyone else could
    shed some light on
    > that, I would appreciate it! Thanks for your response.
    http://www.johnwilger.com/2007/03/future-value-pattern-in-actionscript-3.html

Maybe you are looking for

  • How to use standard BADi?

    Good day experts. I have a requirement which I need to save details (such as amount, description, doc. no. etc) on F-22 (screen 0700) into a ztable which I will going to create. Since F-22 is a SAP standard, I need to use Exits or BADi to accomplish

  • Forté Icon in the Window Title Bar.

    Hi, I would like to know if it is possible to change the Forté little Icon in all windows of our application for our company logo. Example: <<...OLE_Obj...>> <<Forte.zip>> Thank. Allen Vachon INFLUATEC Inc. Programmer Analyst (819)/(888) 595-1794 ava

  • Where do you enter meta data?

    I have been working my Business Catalyst site under the vew version with reasonable success for months until today, when I decided I should review and maybe update the meta data, specifically the keywords.  I've been all over the menu looking for the

  • Disabling Tab Navigation

    I am writing an editor that extends JPanel and is added to a JFrame. The main frame has a JToolbar. When ever the tab key is pressed, the focus goes to the next button on the toolbar and comes back to my editor, but doesn't stay there. My editor over

  • OCFS2 , ASM and Raw Device for Voting Disk and OCR

    Dear all , My manager assigned me to establish a 11gRAC , 3 node on OEL. He likes to locate ASM with datafiles , at the same time, 2 OCR vol on OCFS2 and RawDevice respectively , 2 voting disks on OCFS2 and RawDevice respectively also. This really an