Requried helps the creation of function

Hi all

I need assistance to create feature my input parameters for this function will be 1 or 1,2 1,2,3

my output should be

If I pass 1 as an input parameter, it should return 1
If I spend 1, 2 as input parameter it should return 1.2 in different lines
Even if I switch 1,2,3 as an input parameter it should return 1,2,3 in different lines.

Can someone help me please in the creation of this function.

Thanks in advance.

Published by: p78 on January 16, 2012 03:31

Published by: p78 on January 16, 2012 03:31

Hello

It will be something like that. You must first type to return lines (use another number, for example data type if you must):

CREATE OR REPLACE TYPE t_list AS TABLE OF VARCHAR2 (4000);
/

Then, the function will be a pipeline function:

CREATE OR REPLACE FUNCTION in_list (p_list  IN  VARCHAR2)
  RETURN t_list PIPELINED
AS
  l_text  VARCHAR2(32767) := p_list || ',';
  l_idx   NUMBER;
BEGIN
  LOOP
    l_idx := INSTR(l_text, ',');
    EXIT WHEN NVL(l_idx, 0) = 0;
    PIPE ROW (TRIM(SUBSTR(l_text, 1, l_idx - 1)));
    l_text := SUBSTR(l_text, l_idx + 1);
  END LOOP;

  RETURN;
END;
/

now, you can query (or whatever the needs):

select * from table(in_list('aa','bb'));

Herald tiomela
http://htendam.WordPress.com

Tags: Database

Similar Questions

  • help in the creation of function.

    Hi guys I am a newbie in pl/sql...
    I want to create a function that bed alll the lines of a table containing hundreds of lines...
    Break all the lines separated by space in several blocks or columns and check certain conditions on each block/columns...
    For example:
    I have a table that is to have a GBA and hundreds these lines...

    12345 1234 12345 12345 12345 12345 12345 12345
    .
    .
    .
    .
    Now, I want to create a function or a procedure that reads all the lines and check certain conditions on every word of each line...

    for example: 1st condition:
    1st, 2nd, 3rd, 4th and 5th Word is 12345 or not...
    2nd, 3rd, 4th, 5th, 6th Word is 1234 or not
    3rd word has a length = 5 or not, and various other conditions... but one thing is sure, I must check all the words in the line with respect to each condition...


    thnx in advance...

    Or...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with testdata as (select '12345 12345 12345 12345 12345 12346 12347 12348' as txt from dual union all
      2                    select '54321 1234 1234 1234 1234 1234 32785' from dual union all
      3                    select '10101 10101 10101 10101 10101 10101 10101' from dual union all
      4                    select '123 123 123 123 123 123 123' from dual)
      5  --
      6  -- end of test data, use query below
      7  --
      8  select txt
      9        ,case when wrd1 = '12345' and wrd2 = '12345' and wrd3 = '12345' and wrd4 = '12345' and wrd5 = '12345' then
     10                'True'
     11         else 'False' end as cond1
     12        ,case when wrd2 = '1234' and wrd3 = '1234' and wrd4 = '1234' and wrd5 = '1234' and wrd6 = '1234' then
     13                'True'
     14         else 'False' end as cond2
     15        ,case when length(wrd3) = 5 then
     16                'True'
     17         else 'False' end as cond3
     18  from (
     19        select txt
     20              ,regexp_substr(txt,'[^ ]+',1,1) as wrd1
     21              ,regexp_substr(txt,'[^ ]+',1,2) as wrd2
     22              ,regexp_substr(txt,'[^ ]+',1,3) as wrd3
     23              ,regexp_substr(txt,'[^ ]+',1,4) as wrd4
     24              ,regexp_substr(txt,'[^ ]+',1,5) as wrd5
     25              ,regexp_substr(txt,'[^ ]+',1,6) as wrd6
     26        from testdata
     27*      )
    SQL> /
    
    TXT                                             COND1 COND2 COND3
    ----------------------------------------------- ----- ----- -----
    12345 12345 12345 12345 12345 12346 12347 12348 True  False True
    54321 1234 1234 1234 1234 1234 32785            False True  False
    10101 10101 10101 10101 10101 10101 10101       False False True
    123 123 123 123 123 123 123                     False False False
    
  • Helps the creation of a continuous horizontal line < hr >

    Well, this should be a real easy. Should be...

    Thus,.

    I'm trying to create a horizontal line in Dreamweaver.

    So I added < hr > - here's my code:

    < hr style = height: 1px; COLOR = "#A2CAE0" >

    Here's what it looks like on the page:

    http://www.rerdownloads.com/?page_id=2245

    The line that I did then is second, under the alphabet. The problem is that I want it to look as the other lines - really thin. BUT... I can't. I tried to copy the same code as the other lines without success. And I've tried about 30 different code combinations. AM very frustrated, I can't even do a simple thing like this on my own so I humbly request assistance here.

    It would make my day if someone could help me. Thank you

    Or, to get rid of the

  • Helps the creation of a custom component.

    Hello. I created a very simple custom component called myComp. It's a simple canvas 100 pixels x 100 Basic with a component of Image control.
    < mx:Canvas >
    < mx:Image id = "image1" >
    < / mx:Canvas >

    After the instantiation of the component in Main.mxml for example. var pic1:myComp = new myComp(); I'm having a problem setting the source property of the Image element.

    "image1" is the id of the mx:Image in the custom compoenent, then I tried pic1.image1.source = ' assets/ball.jpg' but I get a runtime error ' Error #1009: cannot access a property or method of a null object reference.

    Don't really know what I'm doing wrong.

    Any help please!


    In your custom component, try adding a public var bindable that contains the path to your image. In addition, the value the image.source this var.
    In your main application, set the var within the tags in the custom component. Since this is a public var, it will appear in the indication of the code. You can also now change the var of the image of the main application whenever you like using ActionScript code.

  • Helps the creation of a simple fade in/out slide show

    I have Flash MX (not pro). I just want to have a cover page at about 5 or 6 pictures that fade in and out on a loop of rotation. I know it must be simple, basic stuff - but can someone point me in the right direction (total newbie obviously).

    I found a good tutorial here:

    http://journalism.Berkeley.edu/Multimedia/Tutorials/Flash/slideshow.html

  • create indexes on the upper part of the column - reminders function is not deterministic

    Hi all

    I'm having a problem on a database. When you create an index on an existing table on the upper part of a column, Oracle triggers an ORA-30553. I've done this 40 index other databases, with the same and different versions, without problem. When you create the index on a copy of the table, it is created with success...

    Here is the code:

    SQL > select * from v version $;

    BANNER

    --------------------------------------------------------------------------------

    Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for 64-bit Windows: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    SQL > CREATE INDEX IDX_SRE_E_MAIL_UPPER on fsynrelatie (upper (sre_e_mail)) tablespace idx;

    CREATE the INDEX IDX_SRE_E_MAIL_UPPER on idx tablespace fsynrelatie (upper (sre_e_mail))

    *

    ERROR on line 1:

    ORA-30553: the function is not deterministic

    SQL > create table fsynrelatie2 in select * from fsynrelatie;

    Table created.

    SQL > CREATE INDEX IDX_SRE_E_MAIL_UPPER on fsynrelatie2 (upper (sre_e_mail)) tablespace idx;

    The index is created.

    SQL > drop table fsynrelatie2;

    Deleted table.

    SQL > show parameter query_rewrite_enabled

    VALUE OF TYPE NAME

    ------------------------------------ ----------- ------------------------------

    query_rewrite_enabled string TRUE

    Hi all

    Thank you for the answers. I found the problem:

    On the table, there are 54 index:

    Select index_type, uniqueness, count (*) from user_indexes where table_name = 'FSYNRELATIE '.

    Index_type group, uniqueness

    INDEX_TYPE SINGLE CHARACTER COUNT (*)
    FIELD ARE NOT UNIQUE 1
    BASED ON A NORMAL FUNCTION ARE NOT UNIQUE 4
    NORMAL UNIQUE 3
    NORMAL ARE NOT UNIQUE 46

    3 unique indexes are the primary key and 2 another witch number field contains unique identifiers for rows in other systems. The domain index is an index of Oracle text on a couple of fields. There are 3 indices of function based on a high on a field and 1 on an individual function. This last clue has caused the problem. Apparently, on the creation, this function is deterministic, but when rolling a new version of the software. It became a non-deterministic function. When I delete the index, my original index on upper (sre_e_mail) has been created successfully! Now, I did the deterministic function again and could recreate the function without problem.

    Thanks for your comments!

  • With the help of API OIM10g for the creation of a certificate custom...

    Hello

    I had a need to create certificate requests in bulk may be 100 + number. Can I have some information about the creation of certificate by using the OIM10g API. I could find the function for creating it - AttestationDefinitionOperationsIntf.createAttestationDefinition (com.thortech.xl.vo.AttestationProcessDefinitionVO definition)

    but do not know what is this 'AttestationProcessDefinitionVO' mean and how to pass the details required for the creation of certificate like name, code, description, critical, scope user, scope of resource, departure, delay etc.?

    Use link below:
    Issue certificate - need help

  • the program associated with the creation of a virtual instrument of Lab View. Please help me

    I have a question with the program associated with the creation of a virtual instrument of Lab View. 1. creation of virtual instrument based on the NI 9401 module mounted on the chassis NI DAQ of Compaq (nor-cDAQ-9172). Creating a virtual tool should apply the following counting pulses in series of the pulse, visualization of data by means of a digital indicator, by comparing the number of impusite with a predetermined value, this value can be assigned by the user. Indicator light when you get to reach the number of pulses, the ability to reset the counter of a button on the front panel. Digital output switch when reaching the number. I hope someone can help me.

    What is your question? You have described what the program is supposed to do, but it is unclear what you're asking about. Do you need help to get started? If so, what you have gone through the tutorials of LabVIEW? You and look at the material in tutorials the NI Developer Zone Learning Center , which provides links to other materials and other. You can also take a course online for free. Have you looked through numerous examples provided with LabVIEW for data acquisition?

  • I did an update yesterday and now my lightroom 6 and elements will not open. I get error messages / error 16 on lightroom and we have tried everything, including the creation of a new Director. Help!

    I did an update yesterday and now my lightroom 6 and elements will not open. I get error messages / error 16 on lightroom and we have tried everything, including the creation of a new Director. Help!

    In Adobe Creative Suite or Adobe Creative Cloud configuration error

  • ERRO: 21 cloud of the creation of the installation. Help!

    ERRO: 21 cloud of the creation of the installation. Help!

    Hello Rogerio,.

    Please, try the following steps:

    (1) uninstall Adobe CC (https://helpx.adobe.com/creative-cloud/help/uninstall-creative-cloud-desktop-app.html)

    (2) restart the machine.

    (3) install the latest Adobe Creative cloud version from the link: CC help | Creative cloud desktop


    Kind regards

    Sheena

  • Help with the creation of the Datagrid column

    I am trying to get a better understanding of the way the Spark DataGrid works so that I can create and version extended for one of my projects. One of the things that really left me speechless is how the datagrid sets up the columns based on the dataprovider when no explicit column is defined. I was able to debug through the initialization of the datagrid to the point where the setter for dataprovider is called. At this point, my debug trace goes "down the rabbit hole" so to speak and when she returns, the columns are initialized but I can't figure out how. Could someone tell me please to the class or function that is actually responsible for creating the columns of the dataprovider if they are not defined explicitly?

    So, as you have discovered, the Grid method / generateColumns (private) is called if the list of columns is always set to null when the commitPropertes().   Subsequently becomes the columns property, as a consequence of the liaison, should update the list of columns as expected.

    Could create an example that illustrates the problem you meet?   I'd be happy to look at it.

    -Hans

  • Problems with the creation of PDFs in Acrobat Pro 11

    We are going to have problems with shared PDF files created in Acrobat Pro 11.0.11 or above.

    When some users to create shared PDF files and send for shared review, they can be considered as shared PDF in Acrobat Pro (yellow bar appears, with shared PDF functions), but not in Adobe Reader 11.0.11 or higher (without shared review menu bar appears, can't we seem to view manually).

    Anyone know what could be the problem? It's only for PDF files created by some users, another shared review, a PDF file created with Acrobat Pro 11.0.11 or superior open fine in drive 11.0.11 or above. I think maybe it's a setting that is not correct for some users...

    Thank you!!

    -Paul Masalsky

    McAfee (which is now part of the security of Intel)

    Hi paulm85910772,

    Please see this KB document for the creation of a shared review Acrobat help. Starting a PDF review. On the other end uses can participate in a shared review using Adobe Reader help of Acrobat Reader | Share, comment and review from.

    Try the most recent Adobe Acrobat Reader DC Adobe - Adobe Acrobat Reader DC Distribution.

    Let me know how it goes.

    Kind regards

    Nicos

  • by default the currency used at the time of the creation of opportunity

    Hello

    How default currency used at the time of the creation of the opportunity. At the time conversion of lead it is set by default according to the currency of lead, but when creating a new it does not work very well.

    Thank you
    Olivier

    Dominique,
    You can default currency by using the function of join field at the level of the currency of the opportunity.
    Choose the currency of the user.
    Default post that he will record it as the currency of the USER.
    I hope this helps.

    Thank you and best regards.,.
    Chaouche

  • Hi, me - Joshua, using Mozilla Version 38.0.1, please share the information of the creation of tab double... Thank you.

    Hi, me - Joshua, using Mozilla Version 38.0.1, please share the information of the creation of tab double... Thank you.

    Hello!

    https://support.Mozilla.org/en-us/questions/762043

    This solution should help you

    "

       Ctrl-click or middle-click the Reload button to open the current page in a new tab.
       Ctrl-click or middle-click items in the history of the Back and Forward buttons to open a page from that list in a new tab.
       Duplicate a tab with its history by pressing CTRL and dragging the tab to a new position on the tab bar.
       Dragging a tab in the browser window will detach the tab and move it to a new window, this is called tab tearing.
       Drag a tab back to the tab bar in the original or anther window to undo a detach or move a tab to a specific window. If a window gets empty (you tear off the last tab) then that window will be closed automatically. "
    
  • Cannot complete installation of Firefox 34.0.5. The installer of Mozilla Firefox crashes at the creation of shortcut (.lnk Mozilla Firefox) (see downloaded the image)

    Cannot complete installation of Firefox 34.0.5. The installer of Mozilla Firefox crashes at the creation of shortcut (.lnk Mozilla Firefox) on the status bar of the installation window. OS: Windows 8.1 system had old version of Firefox, but is no longer in the list programs. There is no file helper.exe manually uninstall any previous version or remnant of an older version, but I don't have folder C:\Program Files (x 86) \Mozilla Firefox to. Thank you.

    Try this:

Maybe you are looking for

  • Load the options down

    When I load PDF files or pictures, I used to display a pop-up window asking me if I want to OPEN or SAVE. At some point, I put save as default. How to reset it?

  • Salvation for laptop: administrator password

    I forgot the password code and pass administrator... the error I get is 57545583.someone please help

  • The screen of my laptop not turn on after being in mode 'sleep'

    Let me start by saying that I am a novice in computer repair, so advice please put in laymon's terms! My problem started a few weeks ago, when my Dell inspiron 1526 would not resume when I opened the lid of the laptop.  (I rarely have to cut the powe

  • Blackberry torch Smartphone blackBerry, charging me to browse the web

    I have a blackberry 9810 torch, I ' have had the phone for 3 months. have not had a problem with it, but Saturday, March 24, 2012, started getting charges for browsing the internet, have now a contract with BIS and now how can blackberry promote a se

  • Fingerprint reader problem

    Fingerprint reader has stopped working.  Tried to re-register fingerprints, got the window: software error of fingerprints, in which it says an internal error has occurred (rpnp2: No. - svr (00000000usserver)). Another similar message has added a cod