How build a function with an array in input and another array in output

Hi, I need to create a function, which receive in input a list of Group's name and retrieve the correspondent list of Group's id.
So I need to have these conditions:
1) The parameter in input has to be only one "p_user_name" (an array of values)
2) the return parameter has to be p_user_id (array of values)
3) in the WHERE condition p_user_name has to be used in order to retrieve the list of user_id I need
Following, a little example:
FUNCTION get_group_id (p_user_name IN VARCHAR2) RETURN p_user_id
IS
BEGIN
SELECT group_id FROM jtf_rs_groups_vl
WHERE group_name = p_user_name
RETURN p_user_id;
END get_group_id;
I think I have to create a new type with p_user_name, but I don't know after, how to join group_name (varchar2) with p_user_name.....
Anybody can help me to find the light ?
Thanks in advance
Alex

I need to create a function, which receive in input a list of Group's name and
retrieve the correspondent list of Group's idAt the beginning the argument "p_user_name IN VARCHAR2" is not what you need. You should create global type - nested table of varchar2 values where you
can keep the list of names. And you also need to create nested table of numbers
to return IDs (if you really need collection but not ref cursor !):
SQL> select empno, ename from emp;
     EMPNO ENAME
      7369 SMITH
      7499 ALLEN
      7521 WARD
      7566 JONES
      7654 MARTIN
      7698 BLAKE
      7782 CLARK
      7788 SCOTT
      7839 KING
      7844 TURNER
      7876 ADAMS
      7900 JAMES
      7902 FORD
      7934 MILLER
14 rows selected.
SQL> create type d_v is table of varchar2(10);
  2  /
Type created.
SQL> create type d_n is table of number;
  2  /
Type created.
SQL> create or replace function get_ids
  2  (names d_v) return d_n
  3  is
  4   ret_ids d_n;
  5  begin
  6   select empno
  7   bulk collect into ret_ids
  8   from emp, table(names) t
  9   where ename = t.column_value;
10   return ret_ids;
11  end;
12  /
Function created.
SQL> declare
  2   d d_n;
  3  begin
  4 
  5   d := get_ids(d_v('KING','ALLEN'));
  6 
  7   for i in 1..d.count loop
  8    dbms_output.put_line(d(i));
  9   end loop;
10 
11  end;
12  /
7839
7499
PL/SQL procedure successfully completed.Rgds.

Similar Messages

  • Is it possible to create a Webservice in BI which takes XML as an input and gives PDF as output with an additional requirement that Siebel expecting the XSD from BI to send data in the BI requested format

    Is it possible to create a Webservice in BI which takes XML as an input and gives PDF as output with an additional requirement that Siebel expecting the XSD from BI to send data in the BI requested format. Siebel wants to send the data as xml to BI but not sure of the BI capabilities on giving WSDL embedded with XSD (input is a hierarchical)

    Hi All,
    I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
    Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
    Please let me know if there is any oracle functionality to do this.
    If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
    For eg, /$APPL_TOP/ar/1.0/sql or something.
    Regards,
    Swapnil K.

  • How come every time i'm on the phone and another call enters I answer it but it doesnt tell me anywhere who is who on each line so i can go back and forth?? it only says multiple calls and i cant hang up the other line

    how come every time i'm on the phone and another call enters I answer it but it doesnt tell me anywhere who is who on each line so i can go back and forth?? it only says multiple calls and i cant hang up the other line.

    My carrier is Sprint. But I actually have checked with others and theirs work fine.

  • How do I select texte discontinuouly : one word here and another there

    How do I select texte discontinuouly : one word here and another there, etc.

    Use Pages '09.
    Feature has been removed from Pages 5, along with 100+ others.
    Peter

  • How do I use one audio jack as input and one as output?

    On my MacBook Pro, if I get a USB-headphone connector (to add another audio port), will I be able to set one audio port as input and the other as output? To use the port coming out of the USB jack as a headphone jack, and plug a mic/output device into the computer's port?
    I'm thinking about buying a "Sabrent USB External Stereo Sound Adapter". I have a preamp that is NOT an interface, and I want to be able to monitor what I'm doing so I can multitrack. But my MacBook only having one audio 1/8 inch jack makes it so I have to choose either input OR output...I'm hoping if I add an extra port via USB I'll be able to have one of each.
    Thank you!

    Roger Wilmut1 wrote:
    nategm wrote:
    On my MacBook Pro, if I get a USB-headphone connector (to add another audio port), will I be able to set one audio port as input and the other as output?
    Yes, either way round. In System Preferences>Sound you can set the input and output ports separately.
    Roger, the System setting have -Nothing- to do with the question being asked. Do you use Logic Pro audio software? If you did you would know Logic has it's own audio settings that run independently from the System audio. There's also the fact that Maverick has problems with "some" older USB 2.0 audio hardware. Basically, this is not a slam-dunk, that's why I suggested asking someone if they've used this combination before. Although... the USB audio device is cheap ($10) it might be worth it to try. Still.............**
    ** I question the wisdom of using cheap audio hardware on a computer that cost $1000+, software that costs $200 and then using the internal audio chip ($2) and an external monitoring device that costs $10. Defeats the whole purpose of using professional audio software.

  • Can I do a clean install of Lion, onto my Mac Book Pro4,1, that is currently running 10.5.8? I have seen U-tube videos on how to do a clean install to Snow Leopard, and another from SL to Lion, but can zero out my HD, and do a clean install to Lion?

    Can I do a clean install of Lion, onto my Mac Book Pro4,1, that is currently running 10.5.8? I have seen U-tube videos on how to do a clean install to Snow Leopard, and another from SL to Lion, but can zero out my HD, and do a clean install to Lion?

    See this article.

  • How to synchronize if one servlet read a file and anothe servlet update the

    How to synchronize if one servlet read a file and anothe servlet update the file at a time?

    Create a class that holds the reference to the file and do the whole file manipulation just in that class. than synchronize the read and write methodes. A reference to this file handler class can be stored to the servlet context in one servlet and read out from the servlet context in the other servlet.

  • Using NetBeans Matisse to build a form with an array of JButtons

    With Matisse I can build a form with a lot of buttons on it, but i want to use a 2-dim array of JButtons so that I can easily access the buttons. How should I do this?

    Code it by hand. It's not that hard.
    JButton [][]buttons = new JButton[NUM_ROWS][NUM_COLUMNS];
    for (int row = 0; row < NUM_ROWS; row++) {
       for (int row = 0; row < NUM_ROWS; row++) {
          buttons[row][col] = new JButton();
          // set other properties of buttons[row][col]
    }If there is a lot of stuff, you could even make a separate method for creating a single button:
    private JButton createButton()
       JButton button = new JButton();
       // whatever else
       return button;
    }Then, in the "for" loops:
    buttons[row][col] = createButton();

  • Hi!!how can I build a vi with every number of inputs?

    The vi I want to build is a little "strange" , I am going to try to explain the basic idea!!
    I need a vi with every number of inputs, so, maybe my vi has 2 inputs or 50 inputs.
    I know that a vi has a limited number of terminals (28), so , I thought that I had to use an array to avoid limit the number of inputs and outputs.
    But the problem is that I want to connect my inputs separately , no using an array.
    I suppose that my explanation is not very good!
    I want to build something similar to the vi "Build an array" . It is a vi that has every number of inputs, this example is to explain the idea. I dont know if it is possible doing something similar, because depending on the number of inputs the block diagram
    will change!
    Thanks in advanced!!
    Graci

    > I suppose that my explanation is not very good!
    > I want to build something similar to the vi "Build an array" . It is a
    > vi that has every number of inputs, this example is to explain the
    > idea. I dont know if it is possible doing something similar, because
    > depending on the number of inputs the block diagram will change!
    >
    VIs have fixed number of inputs, and as you mentioned, they allow for
    unlimited amounts of data through arrays. If you want a growable node
    like build array, there are a couple options. In LV7 and above, there
    is a subVI style that is bigger, with the blue border, and it allows for
    textual terminals at the bottom. These are much bigger, and it is more
    obvious what someone is wiring to, but they also take more space, and
    I'm not sure they are what you want, but probably worth looking at.
    Second option is to really use a build array. You can either teach your
    users to put a build array in front of the subVI and build an array, or
    you can build a merge VI.
    A merge VI is how the 3D graph and the polar plot drop with subVIs
    already wired to other objects. It is a regular VI whose item in the
    palettes has the Merge Option turned on. In this case, instead of the
    subVI being dropped, its contents are merged into the user's diagram.
    You could build your subVI using arrays, then build a merge subVI for
    the palettes. In the merge VI, place a build array with whatever you
    want as the default size. Then add the merge VI to the palettes and set
    the option. When dropped, you will get the build array's default size
    already wired to the other subVI.
    Greg McKaskle

  • How to load file with 500M into noncontiguous memory and visit them

    My data file consist of  a serial of 2d images. Each image is 174*130*2 butes and the total images in the file is up to 11000, which takes almost 500M bytes. I hope to load them into memory in one turn since I need to visit either image many times in random order during the data processing. When I load them into one big 3d array, the error of "out of memory" happended frequenctly.
    First I tried to use QUEUE to load big chunk of data into noncontiguous memory. Queue structure is a good way to load and unload data into noncontiguous memory. But it dosn't fit here since I may need to visit any of the all the images at anytime. And it is not pratical if I dequeue one image and enqueue it into the opposite end, since the image visited may be not in sequential order.
    Another choice is to put the whole file into multiple small arrays. In my case, I may load the data file into 11000 small 2d arrays and each array holds the data of one image. But I don't know how to visit these 2d array and I didn't get any cues in the posters here.
    Any suggestion?
    PC with 4G physical memory, Labview 7.1 and Win XP.
    Thanks.

    I'll try to get the ball rolling here -- hopefully there's some better ideas than mine out there.
    1. I've never used IMAQ, but I suspect that it offers more efficient methods than stuff I dream up in standard LabVIEW.  Of course, maybe you don't use it either -- just sayin'...
    2. Since you can't make a contiguous 11000-image 3D array, and don't know how to manage 11000 individual 2D arrays, how about a compromise?  Like, say, 11 3D arrays holding 1000 images each?   Then you just need ~50 MB chunks of contiguous memory.
    3.  I'm picturing a partially hardcoded solution in which there are a bunch of cloned "functional globals" which each hold 1000 images of data.  This kind of thing can be done using (A) Reentrant vi's or (B) Template vi's.  You may need to use VI Server to instantiate them at run-time.
    4. Then I'd build an "Action Engine" wrapper around that whole bunch of stuff.  It'd have an input for image #, for example, image # 6789.  From there it would do a quotient & remainder with 1000 to split 6789 into a quotient of 6 and remainder of 789.  Then the wrapper would access function global #6 and address image # 789 from it.
    5. Specific details and trade offs depend a lot on the nature of your data processing.  My assumption was that you'd primarily need random access to images 1 or 2 at a time. 
    I hope to learn some better ideas from other posters...
    -Kevin P.
    P.S.  Maybe I can be one of those "other posters" -- I just had another idea that should be much simpler.  Create a typedef custom control out of a cluster which contains a 2D image array.  Now make an 11000 element array of these clusters.  If I recall correctly, LabVIEW will allocate 11000 pointers.  The clusters that they point to will *not* need to be contiguous one after the other.  Now you can retrieve an image by indexing into the array of 11000 clusters and simply unbundling the 2D image data from the cluster element.

  • How do delete cookies with ios7 on I-phone and I-pad ?

    How do you delete cookies with ios7 on I-phone and I-pad  ?

    Cheers for that but what I really meant was when you double click your home button you used to be able to keep your finger on one of the apps for 2 seconds and they all would have a cross on them and you could delete them now you can't ? , not delete the app completely just close the app  properly to save your battery

  • How to attach file with an email in travel and expenses

    Hi Experts,
    I am new to sap cloud application studio.
    We have requirement that need to attach any type of files in the mail,
    I have gone through this : How to send an email with attachments in SAP Cloud Application Studio
    But compilation error at import AP.FO.ACTIVITY.GLOBAL., so not able to work with that lines of code.
    I am using these lines of code to send email.
    EMailUtilities.SendEMail(lang, bcc, cc, toAddress, htmlContent, from name, subject);
    So am not able to getting how to attach file with this code.
    Please help me regarding this.
    Thanks & Regards,
    Preethi Ande

    Hi Preethi,
         I am trying to send mail from custom BO in Travel on Demand System.I am getting  compilation error.please look into the attached screenshot for the code.
    Please assist me on this,                                Thanks in advance
    regards,
    Sendhilazhagan

  • How to play movies with different ext like wmv and...

    need to know how to play movies with various ext like wmv..mpeg..vlc on e7

    If the phone's built-in video player does not handle those formats, your option are:
    - find some other video player app that does, or
    - convert the videos to a supported format
    The E7 supported video formats are listed on, e.g., this page:
    https://www.developer.nokia.com/Devices/Device_specifications/E7-00/
    Hit "Expand all" and scroll down to "Video Playback Formats".

  • How to move tables with data from one client to another

    Hello friends
    I have 2 clients 001 and 002.
    I have created a table with lots of data on client 001.
    I have to get the same table on 002 also with the same data.
    Is there an easier way of transfering this data from one table to another?
    I would appreciate any feedback on this.
    I know that mappings etc., can be done using the export and import of tpz file. So I want to know if there is any similar thing to transfer a table with data.
    THanks
    Ram

    hi
    thanks for the response
    We are working on a sandbox system for demo purpose.
    Actually we have two different group of people using two different clients created on the same server.
    Our group is using client 001 and another group is using client 002.
    We don't want the changes that one group does to the table to affect the other.
    Our group has created a z-table and have entered considerable amount of data.
    However, the other group also need to create the same table with the same data.
    So to avoid double work, we were trying to see if there is a way to copy the table with data created on 001 to 002.
    Any suggestions / feedback will be greatly appreciated.
    Thanks
    Ram

  • How to use an .xsl file to transform input XML to re-formatted output XML?

    Hello,
    I have a .xml file from a report that I want to use a stylesheet to transform into a different .xml format.
    I am reading that I can create a .xsl file to read my input and then transform it to a new output .xml file.
    How do I load this into the Apps?
    I tried creating a template definition and loading the .xsl in as type 'XSL-TEXT' and also, I added
    <?xml-stylesheet type="text/xsl" href="Transform.xsl"?> to my xml data source. The output looked the same as the input.
    Has anyone done this before? Any suggestions would be great!
    Thanks
    -CC

    This is how I use e4x with HTTPService:
    import mx.collections.XMLListCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable] private var claimsXLC:XMLListCollection;
    private function claimsHandler(evt:ResultEvent):void{
        claimsXLC = new XMLListCollection(evt.result..claim as XMLList);
    XML data is being returned, but I use XMLList to create the XMLListCollection.
    If this post answers your question or helps, please mark it as such.

Maybe you are looking for

  • How to update to Safari 2.0.4??

    My update to Safari 2.0.4 failed (probably because I tend to rename my apps with their version number, so the old Safari was named "Safari 2.03", but this is never any problem with iTunes or QuickTime). There was a new app, called Safari (with versio

  • What kind of event is generate when start in cell?

    Hi! I set JTextField as a cell editor.Let's in cell we have some string, e.g: "test". When I double click in cell and start type, e.g. "12", the methods of KeyListener (keyPressed and so on) are calls and the result string is "test12". OK. But when I

  • Adding images to the header & footer in Pages for the iPad

    How do I add images i.e. logos into the header and footer in Pages for the iPad.

  • Dreaded "Not a Valid Widget" Error

    Hi Folks, I'm getting the dreaded "Not a Valid Widget" error when I try to import my Flash (Professional CS5) file as a widget into my Captivate 5 project. I've done my research on this problem, and found an earlier post from Vikranth regarding copyi

  • MIGO Posting Issue

    Hi Guru: When I use MIGO,I encountered below issue,Posting only possible in periods 1998/03 and 1998/02 in company code 0001,and the system gave me the hint as below: For the system, the first of the entered periods is the current period. At the begi