How to list comma separated data field...?

I need to separate the list data in a column for the rendering of the data more readable.

For example:

Select * from myTable;
ID     TEXT
--     -----------
1      RED,GREEN,BLUE,YELLOW,ORANGE,VIOLET
2      GREEN,ORCHID,SLATEBLUE,RED,YELLOW
What I'd like to see instead:
ID     TEXT
--     -----------
1      RED
       GREEN
       BLUE
       YELLOW
       ORANGE
       VIOLET
2      GREEN
       ORCHID
       SLATE
       RED
       YELLOW
The number if items in the TEXT column varies from a minimum of four points... She also could have more than 20!
The items are all separated by a comma (no spaces).
Finally, the for now, the data doesn't have to be sorted, but would be nice in the future!

Thanks, I really appreciate any idea that you all might be able to provide!

KSL.

Tom Kyte has been answering this question for years, and there's a FAQ about this somewhere here. In any case, here's my variant which manages the entrances to the channels up to 4000 bytes, because stops Tom 3998. Furthermore, some may suggest REGEXP functions which avoid because they are nice time CPU.

with indata as (
  select id rowlabel, text x from mytable
)
select a.rowlabel, b.column_value from indata a,
table(cast(multiset(
  SELECT trim(SUBSTR(
    x,
    (case level
      when 1 then 1
      else instr(x, ',', 1, level-1) + 1
    end),
    (case instr(x, ',', 1, level)
      when 0 then 4000
      else instr(x, ',', 1, level) - 1 -
        (case level
          when 1 then 0
          else instr(x, ',', 1, level-1)
        end)
    end)
  ))
  FROM dual
  CONNECT BY level <= LENGTH(x) - LENGTH(REPLACE(x, ',', '')) + 1
) as sys.odcivarchar2list)) b
order by 1, 2;

Published by: stew Ashton on October 29, 2012 18:30 - example modified to use mytable OP.

Tags: Database

Similar Questions

  • How can I insert a date field?

    I have download a date field widget, but I can't seem to make it work. Any suggestions?

    Exactly how did you download the file? You can import the library file, and then use on the pages, or if you have downloaded the CC widget addon then synchronize first with CC in the active section, then use in Muse.

    Thank you

    Sanjit

  • How can I fill a date field when the document is signed?

    I have 4 fields of digital signature in a PDF form.  Next to each signature is a field of date (format dd/mm/yyyy).  I would like it so when a user registers the signature box that fills the date next to her field with today's date, then change to read only (so it cannot be changed).

    In Adobe Acrobat 9 Pro, I have this form and it has the following fields

    Signature1

    Signature2

    Signature3

    Signature4

    DateField1

    DateField2

    DateField3

    DateField4

    Signature fields trigger a Topaz.GemSignPlus driver where the end-user will sign on an electronic signature pad.

    How do I use Javascript to detect when one of these Signature fields is populated and fill in the date in the appropriate date field?  I tried to create Boolean variables initialized as false for each field of GIS.  Then when the signature is complete, I try to change it true, but for some reason any my javascript detect that the value does nothing.

    I searched the net endlessly for this solution.  I can't believe I'm having a difficult time finding an answer.  I mean how many places you go where they ask you to "sign and date here."  Each document signature base I've ever seen also requires a date.

    In any case, here's what I have.  Functions, I have a script called JavaScript Document name populate date:

    function populatedate()
    {
    var bSignature1 = new Boolean();
    var bSignature2 = new Boolean();
    var bSignature3 = new Boolean();
    var bSignature4 = new Boolean();

    If {(bSignature1)
    DateField1.value = util.printd ("d/m/yyyy", new Date());
    }

    If {(bSignature2)
    DateField2.value = util.printd ("d/m/yyyy", new Date());
    }

    If {(bSignature3)
    DateField3.value = util.printd ("d/m/yyyy", new Date());
    }

    If {(bSignature4)
    DateField4.value = util.printd ("d/m/yyyy", new Date());
    }
    }

    In each signature field, I on the signing tab "this script is run when the field is signed:

    var bSignature1 = new Boolean (true);

    I'm changing to true see.  My thought is that if it is true that DateField1.value should print jj/mm/aaaa in her building in the Date() function.

    But maybe I do not get the correct context.  I'm new to Javascript in Adobe.

    It's a round script. Why not just use the signature signature of script to set the value of the field date? The correct syntax for this is:

    this.getField("DateField1").value = util.printd ("d/m/yyyy", new Date());

  • How to do a mandatory date field if you select No in the field before?

    I am very new to this program, it's my first form.  I'm stuck on how to make the date field becomes mandatory once you select No for the before option buttons (options are Yes or no).

    Any help would be greatly appreciated.

    Thank you

    You can write in the click / release the Radio button event...

    Language: Java Script

    DateField1.mandatory = 'error '; This line is the Date field mandaotory.

    DateField1.mandatory = "disabled"; This line will remove the control mandaotory.

    Replace DateField1 with your name of the control...

    Thank you

    Srini

  • How to find a custom date field?

    I'm trying to recover contacts based on the value in a custom date field, and I can't get the search function to work. It works fine for me with other custom fields, for example this query:

    / data / contacts? Search = C_Job_Role1 = * HR & depth minimum = & count = 5

    Returns all contacts whose ends the Job role in HR properly. However, if I try the same thing with a date field, for example this query:

    contacts / data /? Search = C_Contract_Expiration_Date1 = * 1 * & depth minimum = & count = 5

    I get a response with the http 500 code - it's an internal server error, so presumably that choke the server when asked to perform a search on a date field.

    Is there a way to do this?

    Hi Eli,

    I ran a few tests and it seems that endpoint to search as standard format (MM/DD/YYYY) date type, not deal with time at the time of unix. The following query (example) will work: C_Contract_Expiration_Date1 = 01/04/2012

    I'm sorry for the initial response. There are some points of endpoints that use the time unix for types date, and we will be more cautious about calling the difference in each context.

    Thank you

    Fred

  • How to read pdf form data/fields

    Hello

    I want to orchestrate a process where the entrance is formed interactive and is the xml data output.

    I mean that I want to read/data fields of the pdf form.

    What activity are used on bench.

    Concerning

    Sunil

    Try the ExportData or ProcessFormSubmission service.

    I hope that helps!

    Vikas - Vijayrania

  • How to fill in a date field item with sysdate whit a LOV field

    Hello

    It started with APEX. I have experience with ORacle Forms and reports before. Just started to create an application of small expenses with APEX. A month ago LOV that has every month this year. In the case of change, with the submission of the Page, I am able to run a report for all fees for the selected month. My question is as in the case of forms, we could add a trigger of an element, as, when list item changed or key the agenda, where we could do the simple things like call a PL/SQL procedure or fill in any other field of the form. Could you please let me know how can I run this Summit? For example, when I change the field LOV fresh months running the report for all fees for the month selected, I also just want to fill another (single) field of the month. Just as simple as that. Also, what happens if I want to call a PL/SQL procedure at the same time.

    I have tried searching forums and the internet. Could not find anything. Not sure if this is not possible in the APEX.

    Thank you
    Sun

    I think you could find one of your fire done dynamic actions with onLoad of the page.

    Check the attributes of your DAs, there will be a "Fire dependent" checkbox, there would be some pl/sql that you call raises no_data_found

  • How to create a date field that is fixed at the signing?

    Hello

    I created a series of PDF forms on Adobe Pro XI which are designed to be filled out using Adobe Reader (where are saved as Adobe Reader Extended). Once the form is complete there are fields of signature that the user who digitally sign then it disables the specific form fields of editing more far. Next to the signature field, I have a date field that, at present, is using JavaScript to automatically generate the date of business at the opening. However, the question that I have is that I want this field date which will be fixed when the form is signed, rather than update again when the form is opened. Is this possible?

    The document JavaScript that I use to generate the date currently is:

    this.getField("Date1").value = util.printd ("dd/mmm/yyyy", new Date());

    But obviously, this is independent of the signature field.

    How can I create a date field which is set by the current date at the signing?

    I am very new to Adobe in general so I don't have much of an idea about how to go about doing this. Could someone please help me to do it if possible?

    Thank you

    KC

    Go to the properties of the field of Signature and on the signing tab, add

    Copy the following code in the section previous "this script is run when the field is signed.

  • Date field

    How can I put a date field in blackberry qml?

    I did a textfield, but can't find any inputtype as date.

    You must use a selector of...

    http://developer.BlackBerry.com/native/documentation/Cascades/UI/pickers/DateTimePicker.html

  • Date field will not update

    Apex using pre-packaged "Group calendar" app I work on page 10. I updated the form to include a custom date field and added all the code to the EBA_ca_api package

    My problem is that my custom date field will not retain the value on the edition of an event. I have other custom fields that are not date fields (field numbers and text) that update without any problem...

    How can I update my date fields?

    Update:

    I am sure that the issue is somewhere in the package, the values are not updated for some reason any.

    The pre-existing app code uses this statement

    If to_char()c1.event_date_time,' DD-MON-RRRR HH:MIam ') ! = TO_CHAR ()p_event_date_time ' DD-MON-RRRR HH:MIam '( ) then

    Update EBA_ca_events

    set event_date_time = p_event_date_time

              where event_id = p_event_id ;

          end if ;


    and it works for this field when updating. I tried to use this code on my custom date field and it didn't work, so now I'm looking for something like this

    if TO_CHAR (nvl(c1.event_due_date,'0')) ! = TO_CHAR (nvl(p_event_due_date,'0')) then

    Update EBA_ca_events

    set event_due_date = p_event_due_date

               where event_id = p_event_id ;

    end if ;  -Copy the following code causes an error when you try to apply changes (not a month valid)


    Because the following code works and updates to my date no fields


    If nvl(c1.event_not1,'0')! = nvl(p_event_not1,'0') then

    Update EBA_ca_events

    Set event_not1 = p_event_not1

    where event_id = p_event_id;

    end if;

    Does the code work if I'm on the right track? -At the end of the day what I'm trying to do, it is to be able to add a date field for the application of group calendar pre-packaged on the creation form and event on page 10, and then later change this event and updated it to the database.


    Richie V wrote:

    No I did not, but do you know how to fix the error happen and allow the new field custom_date to be edited and saved in the database?

    Thereafter. The missing pieces of the puzzle were the type of the values concerned was TIMESTAMP WITH LOCAL TIMEZONE, and that type conversion had already been made in the process of page APEX. Therefore, the required code in the package:

    -- custom date code
    
    if nvl(to_char(c1.custom_date,'DD-MON-RRRR HH:MIam') , 'X')!= nvl(to_char(p_custom_date,'DD-MON-RRRR HH:MIam'), 'X')
    then
        update EBA_ca_events
        set custom_date = p_custom_date
        where event_id = p_event_id;
    end if;
    
  • Date field - allows any string?

    I use a date and time standard on LC form field, data format = date.  However, it allows users to enter any string and am need it being only date.  I'll put a schema validation, but before adjustment, want to be sure everything first, is - it normal, that a date field allows any string type to be entered manually (they used 30 September 2014 as their answer, and when I imported the answer in Access, of course, it is not passed on the side of the access of gathering in a date field).

    One thing I noticed, is that you must put your cursor in the date fields before the datePicker drop-down menu will appear.  Is there a future plan to have the spectacle of the down arrow even if there is no cursor in the field?  Just a request for 'improvement', as someone can not notice that and keep typing.  I had assumed wrongly a date field would only accept the date in the format data, then by way of solution, put validation schemas, but it has been the hope of a better understanding of this area for the future.  Thank you!

    Post edited by: sparrowce Information - when I test validation, have put all the necessary model date, in tests, it will give the error message if I get a string, and then the field always accepts the string.  I need to know how to correctly validate the date field, thank you!

    Hi, this is the standard behavior and is the same for a decimal field when you add a format of edition as num {$zzzz9.99} you can type what you want.  So, you'll need validate the value yourself.  If the value entered corresponds to the model to edit then it will be converted to the format YYYY-MM-DD in-house, then the invalid value will be copied as it through.  This means that as long as your display template is YYYY-MM-DD an invalid date will be one who possesses a formattedValue == rawValue.  You may need to change multiple formats as well allow different formats to enter.

    These messages my help;

    http://cookbooks.Adobe.com/post_An_alternative_Date_Picker_for_LiveCycle_Designer-18455.ht ml

    http://cookbooks.Adobe.com/post_Date_handling_in_Livecycle_Designer_ES_forms-19697.html

    Concerning

    Bruce

  • Try to update tcDataSet date null date field.

    I'm trying to set a field to a null user-defined. I am able to update the field with a valid date but cannot be set to null. Here is an example of the code that I use.

    ...
    HashMap.put ("usr_udf_new_last_name_effdt", "1970-01-01 00:00:00.0");
    ...
    tcuseroperationsintf.updateUser (new tcMetaDataSet (usrDataSet, getDataBase()), hashmap).

    The problem is when I try to update the date that follows.

    ...
    HashMap.put ("usr_udf_new_last_name_effdt", null);
    ...
    tcuseroperationsintf.updateUser (new tcMetaDataSet (usrDataSet, getDataBase()), hashmap).

    When I try this I get an exception. How do you update a date field to a null with tcDataSet?

    Hello

    You cannot update the daye with null field. You must put a fictitious date.

    Concerning
    Nitesh

  • How to split string separated by commas and pass to the clause of the select statement

    Referring to article How to divide string separated by commas, then pass to clause of a select statement, tquery that there the following plan:

    Query1:

    select * from emp where ename in (
        select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) from dual
        connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null );
    

    Base1:

    Plan hash value: 4242290184
    
    
    --------------------------------------------------------------------------------------------
    | Id  | Operation                       | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                |          |     1 |   133 |     7  (29)| 00:00:01 |
    |*  1 |  HASH JOIN                      |          |     1 |   133 |     7  (29)| 00:00:01 |
    |   2 |   VIEW                          | VW_NSO_1 |     1 |    46 |     3  (34)| 00:00:01 |
    |   3 |    HASH UNIQUE                  |          |     1 |       |     3  (34)| 00:00:01 |
    |*  4 |     CONNECT BY WITHOUT FILTERING|          |       |       |            |          |
    |   5 |      FAST DUAL                  |          |     1 |       |     2   (0)| 00:00:01 |
    |   6 |   TABLE ACCESS FULL             | EMP      |    14 |  1218 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       1 - access("ENAME"="$nso_col_1")
       4 - filter( REGEXP_SUBSTR ('SMITH,ALLEN,WARD,JONES','[^,]+',1,LEVEL) IS NOT NULL)
    

    However, the following query generates the plan I want:

    Query2:

    select * from emp where ename in ('SMITH','ALLEN','WARD','JONES');
    

    Plan2:

    Plan hash value: 3956160932
    
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |     4 |   348 |     3   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| EMP  |     4 |   348 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       1 - filter("ENAME"='ALLEN' OR "ENAME"='JONES' OR "ENAME"='SMITH' OR
                  "ENAME"='WARD')
    

    Can I change the query1 query for plan2?

    As Juliet was mentioned in the first SQL that you generate from the ENAME list that you must pass in the IN clause when executing. But in the second SQL, it passed as a static value. So first SQL must do more work. So you see a different execution plan.

    But this is a work around to get what you are looking for. But I can't say it's a foolproof method. But anyway here you go.

    SQL > var ename_list varchar2 (100)
    SQL > exec: ename_list: = 'SMITH, ALLEN, WARD, JONES ';

    PL/SQL procedure successfully completed.

    SQL > select *.
    2 of PEM
    where the 3 «,» | : ename_list | ',' like '%', | Ename | ',%';

    EMPNO, ENAME, JOB HIREDATE DEPTNO ID COM SAL MGR
    ---------- ------ --------- ---------- --------- ---------- ---------- ---------- ----------
    7369 SMITH COMMITTED 7902 2975 2 APRIL 81 0 20
    7499 ALLEN 7698 1600 20 FEBRUARY SALESMAN 81 300 30
    7521 WARD 7698 1250 22 FEBRUARY SALESMAN 81 500 30
    7566 JONES MANAGER 7839 2975 2 APRIL 81 0 20

    SQL > select * from table (dbms_xplan.display_cursor);

    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------------------------------
    SQL_ID, 848zhvbvgf7d6, number of children 0
    -------------------------------------
    Select * from emp where «,» | : ename_list | ',' like '%', | Ename
    || ',%'

    Hash value of plan: 2872589290

    --------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |      |       |       |     2 (100) |          |
    |*  1 |  TABLE ACCESS FULL | EMP |     1.    38.     2 (0) | 00:00:01 |
    --------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    1 - filter(','||:ENAME_LIST||',' LIKE '%,'||") ENAME "|", %')

    19 selected lines.

    SQL >

  • How to make uneditable Date field in ADF

    Hello

    I use Jdev 11.1.1.7.1.

    In the fragment, I added the DATE of the ENTRY component. How to make uneditable date field. He should just take the input value of the grille.

    Kindly advice me.

    Thank you

    Swathi

    Your date. MinValue must be like this:

    
                
                
                  
              
    
  • How can I automatically populate the date field after only one "digitally signs" a .pdf form? Help, please! Thank you!

    How can I automatically populate the date field after only one "digitally signs" a .pdf form? Here's a sample:

    _ Digital Signature___ (signs), Date (Auto-remplit)

    Under field properties of the signature on the signature tab, you can use a custom script, like this:

    this.getField("Date").value = util.printd ("mm/dd/yyyy", new Date());

    You know, however, that a digital signature always displays the date and time, it has been applied?

Maybe you are looking for