Returning a numeric list

We have an application that expects certain columns within our tables store a comma seperated list of numeric values. Our database however stores that information within lookup tables. To return that list I have opted for the below function within Oracle. My only issue though is I am hardcoding the table name(LKP_PROP_PRODSEG) and column names(PROPERTIESID and PRODSEGMENTID) for the cursor and there is more than one table so this solution of mine would mean a different function for each instance. How could I instead use function arguments for those values? Or is this the best avenue to be taking for the end goal?
CREATE TABLE LKP_PROP_PRODSEG
PROPERTIESID NUMBER DEFAULT 0 NOT NULL,
PRODSEGMENTID NUMBER DEFAULT 0 NOT NULL
INSERT INTO LKP_PROP_PRODSEG (PROPERTIESID, PRODSEGMENTID) VALUES (4, 1);
INSERT INTO LKP_PROP_PRODSEG (PROPERTIESID, PRODSEGMENTID) VALUES (4, 2);
INSERT INTO LKP_PROP_PRODSEG (PROPERTIESID, PRODSEGMENTID) VALUES (4, 3);
INSERT INTO LKP_PROP_PRODSEG (PROPERTIESID, PRODSEGMENTID) VALUES (4, 4);
CREATE OR REPLACE FUNCTION GETLKPPRODSEGLIST ( arg_propID IN NUMBER )
RETURN VARCHAR2
IS
idList VARCHAR2(4000);
CURSOR GETID IS SELECT PRODSEGMENTID FROM LKP_PROP_PRODSEG WHERE PROPERTIESID = arg_propID;
BEGIN
idList := null;
FOR i IN GETID LOOP
     IF idList IS null THEN
          idList := i.PRODSEGMENTID;
     ELSE
     idList := idList || ',' || i.PRODSEGMENTID;
     END IF;
END LOOP;
RETURN idList;
END;
SELECT GETLKPPRODSEGLIST(4) FROM dual;

Check out stragg at asktom.oracle.com.
SELECT stragg(prodsegmentid)
  FROM lkp_prop_prodseg
WHERE propertiesid = 4;However, it doesn't take care of the fact that you have to know what table your data is in.
Apparently Jens and Kamal posted a bit more promptly than I did...
Message was edited by:
scott.swank

Similar Messages

  • How-To Display the Number of Records Returned from a List to the User?

    We currently are using lists to identify accounts that meet various criteria. Because the territories vary from 4k to 60k customers the users have stated that they don't know the size of the list and therefore don't know if they need to refine the list. Currently they are exporting to Excel to look at the row count to see if they need to further refine their searches. This takes quite a while and while shuffling through many lists is a bit painful. Isn't there a way to just show the total records returned from the list down at the bottom of the screen where it allows you to see 25/50/75/100 records at a time?
    There is probably a simple way to do this but it is a large user dissatisfier at the time because we simply don't know how to make this show up. Again we are using lists and not analytics for simple lists at this time.
    - john
    Edited by: user11286597 on Jun 19, 2009 11:02 AM

    Thanks Bobb. I can't believe that one wasn't in R1 :)
    Is there a link to the items being worked in the next release by any chance?
    - john

  • Error :cannot show the value of the filter.The Field may not be filterable or the number of items returned exceeds the list view threshold enforced by administrator

    Issue : In sharepoint 2013, I am experiening below error while using filter in the list view due to the number of items in this list exceeds the list view threshold, which is 10000 items. Tasks that cause excessive server load (such as those
    involving all list items) are currently prohibited.
    Error :cannot show the value of the filter.The Field may not be filterable or the number of items returned exceeds the list view threshold enforced by administrator
    Could you please suggest a way to avoid this issue apart from incrementing the list view threshold limit .
    Prashanth

    Reorganizing content, or creating more specific views. sharepoint is warning you that the content is structured in such a way that it can cause performance issues, which should be addressed in some way.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • Returning a Tcl list to TestStand

    Hi,
      I wonder if anyone can help me.  I would like to return the contents of a Tcl list to TestStand.  I am not sure how to go about it.  Are Tcl lists equivalent to an array in TestStand?  Can I return the entire list or must I return each individual element?  I also noticed that the custom TclParameter type can be modified.  Should I create an array of strings to catch the list being returned from Tcl.
    Any help would be appreciated.
    Thanks

    A Tcl list is very similar to an array in TestStand.  There are some minor differences when dealing with multi-dimensional lists (lists of lists), but the concept is pretty similar.  The Tcl Example currently on the web does not support lists and all parameters must be strings.  You would then have to parse the string returned as the list in order to make an array.
    For example, if you have a Tcl list x created with": set x [1 2 3 4]".  If you set an output parameter on the step to map to the variable x to Locals.ListAsString in TestStand, it would be populated with "1 2 3 4".  You would have to then split the string based on spaces, and you could convert it into an Array in TestStand.
    Do not modify the TclParameter type (unless you also want to change the source code of the rest of the step).  Changing the source code for the step type would be an advanced topic, so unless you are experienced in TestStand and the Tcl C API, I wouldn't recommend it.
    Allen P.
    NI

  • How to pass numeric list to QAAWS

    My question was how do you use excel to pass a numeric list to qaaws?  Ex. Passing multiple month ids which are intergers in the db.  Currently if I pass 456,447 it is passed as a string and not numeric.
    Thanks
    AP
    Edited by: Patil Abhijit on Feb 13, 2009 7:38 PM

    On the Data Manager definition of the QaaWS web service, select the object name for the prompt, and click on the + button below. If there is a maximum of ten values in the list, then click on the + button nine times to get a total of ten occurences of the same object name. Then associate each object occurence with a separate excel cell. You are just binding the max number of possible list values - not all values have to be populated.
    Hope this helps.
    Bobby

  • Firefox shows the list of my e-mails, but won't open them - returning to the listing. Other browsers fine.

    Neither 'View your entire mail list' nor clicking on any email item works - the Firefox browser returns to the list of e-mails.

    Not sure which site you're using, so this is necessarily a bit generic...
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    Alternately, you also can clear Firefox's cache completely using:
    orange Firefox button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    This will open a dialog where you can remove the cookies individually.
    Then try reloading the page. Does that help?

  • Where do we find open return sales order list

    HI gurus
    where do we find open return sales order list whihc have not yet been issued to credit note. and where do we find

    hello, friend.
    use VA05.  you can specify the document type by clicking on 'further selection criteria' on the initial screen.  you can further click 'open orders'.
    when the sales returns is displayed in the following screen, look for the status column.  if the entry is 'A', then no inbound delivery has been done yet (but you could not say if credit memo has been issued or not).  if the entry is 'B', inbound delivery has been done but not the credit memo.  if the entry is 'C', both inbound delivery and credit note have been done.
    regards.

  • Updating numeral list in a column after changes

    Hi there,
    I have created a simple table (with two columns) for a list of movies. The first column is a 3 digit numeral number and the second column is the title of the movie as per example:
    004 Star Wars A New Hope
    005 Star Wars Return Of The Jedi
    followed by a 300 plus list.
    My question is how do I update the film count once I have inserted Star Wars The Empire Strikes Back in its correct position, please? (ie all the following films will have to have their numbers incremented by 1, Star Wars Return Of The Jedi would become 006 and so on)
    Thanking the community in advance

    It can be done:
    Add a row above or below and insert Star Wars The Empire Strikes Back in the second cell. Leave the first cell blank.
    In the first column select 001 and 002 cells, move the pointer to the bottom of 002 until a yellow autofill handle appears, and drag it down.
    It's better explained here:
    http://help.apple.com/pages/mac/5.2.2/#/tan3af7438f2
    Autofill sequential content or patterns into adjacent cells: Type the first two items in the series in the first two body cells of the row or column you want to fill; for example, type A and B. Select the cells, move the pointer over a border of the selection until a yellow autofill handle appears, then drag the handle over the cells you want to fill.

  • Need help returning processor task list.

    I'm new to KEXT/Kernel programming and Xcode, so I'm sure these are fairly beginner questions, but I'm having some trouble.  I'm trying to return a list of processor tasks, so I can test different things such as process id's, file descriptors, etc.
    I'm not sure what functions would be useful for me.  Is there some way that I would be able to return a list of all running processor tasks and/or their information?  Would someone be able to point me in the right direction?

    Yeah, usually it helps me out quite a bit, but I've been googling for over a week, and I get a whole lot of nothing.  Everything that I've actually been able to find uses outdated headers and functions that don't exist anymore.  Maybe my google skills just aren't very good for this area, since I *am* new to this after all...
    I figured it would be much more time-efficient to just ask the dev community.  Any insight would be appreciated.

  • What is the data type of the value returned by the List box prompt in crystal

    Post Author: Mudit Kothiyal
    CA Forum: Formula
    Hi all,
    I am creating a report which has a list box prompt. When I am selecting a single value from the list box the report is working fine, but when I am selecting multiple values its not returning any data( although data is there). Does anyone know how the prompt values are passed to the report query by the crystal. I kno it passes the value to the report as an array. But how does it pass the value to the report query.
    I am using command query to fetch data from the DB.
    Crystal Report Version: Crystal Report XI R2.
    DB: Oracle 10g
    Also does anyone know how to pass the values of the list box prompt to the report query in comma seperated format.
    Thanks & regards,
    Mudit

    Post Author: rcoleman
    CA Forum: Formula
    In regards to the latter part of your question
    The following examples are applicable to Basic and Crystal syntax.
    The examples assume that list is a String array consisting of the 3 elements: "Chocolate", "Vanilla" and "Strawberry".
    Join (list)
    Returns the String "Chocolate Vanilla Strawberry".
    Join (list, "***")
    Returns the String "Chocolate**Vanilla**Strawberry".
    Not sure about the first part of your question,sorry.

  • Cannot return to message list while in a message without clicking on "compose new message icon" and then cancelling it.

    After updating to 8.1 from 8 i cannot return to my message list from inside a message without clicking on the "compose new message" icon and then canceling out of that.
    Also, where it used to say return, it now says "Edit" and the word "Message" on the top of the screens is scruched together.
    Here is a link to a screenshot of my phone from the main messages listing.
    And here is a link to a screen shot of my phone from within a message.

    Hi Sir,
    Code snippet for reference:
    Private Sub Application_ItemSend(ByVal Item As Object, ByRef Cancel As Boolean)Handles OutlookApplication.ItemSend
    Try
       Dim SentMailItemObject As Outlook.MailItem
    SentMailItemObject = CType(Item,
    Outlook.MailItem)
    ‘Can
    we add here User property in Mail Object Reference?
     Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Information)
     End Try
    End
    Sub

  • Can not user Raw value as NULL return in Select List

    Help me!
    I recently converted my application to take advantage of the sys_guid() function that oracle offers over the sequence/trigger option.
    However, I user a hierarchical set up and I need to be able to insert a RAW value of '00' if the user does not select something in a select list. When I try to do this, I get an "ORA-01465: invalid hex number" error.
    I've also tried to return 00 and HEXTORAW(0) but that didn't work either. Infact 00 return a can not insert null value. Please help as I believe the sys_guid function is the best choice if I can make it work.

    Hey Scott, my first name is Daniel.
    Here is in detail the reason for which I want to be able to work with RAW. As everyone knows, most of your tables your going to have a UID. In general this is going to be a NUMBER column into which you will insert values that populate from a trigger getting the nextval of a sequence and returning the result into the NUMBER column of the row being inserted.
    This, however, requires a trigger and a sequence. Not that that's really a bad thing, I just think it can be done better. All we are really after here is a UUID or GUID. The thing is if you used a sequence to generate this value, you don't have a good way of knowing that the number is truly unique. You'll learn this as soon as you try to merge with a table from another database or do something else of the like.
    What I prefer to do is to use Oracle's SYS_GUID function when I create a table. To use this function you create a RAW(16) DEFAULT SYS_GUID(). From that point you don't even need to reference the column on insert, unless you're inserting into * and in that case you just specify DEFAULT. The use of sys_guid means I don't need a trigger and I don't need a sequence, and the result will always be unique, regardless of the DB.
    In APEX, and elsewhere, the way you use a select list is with a display value and a return value. An example would be, emp_name as the display value and emp_id as the return value. In my case, the emp_id would be the RAW values returned by the SYS_GUID() function when the employee was created. But it's not working because of the RAW value.
    I know that APEX can enter the value in session state that is returned from a RAW column because I did a test earlier and it worked. I would have to see it in session state for debugging. *** The problem is in creating a new record. ***
    APEX really does not have to work with the RAW column because the default value has been specified. But for some reason, it does not like it anyway. I found this problem when working with parent/child relationships in my tables.
    Lets say there are three columns GUID, TITLE, and PARENT. When creating a new record, I allow the user to select its parent. If the new record IS a parent then they would leave it as the default '- Is Parent -' and the PARENT column would be left as NULL. But because the GUID is RAW to make the relationship work with the parent, the PARENT column would be RAW too and APEX gives me the errors I was telling you about before.
    Sorry for going on so long. I don't know if I even got my point across. ;) Please let me know if you need me to do something on my part to further demonstrate my point. I would be happy to set up a demo if requested.

  • Converting Year in YYYY format for return in select list

    Using Apex 4.1.1 on Linux (Apex Listener on glassfish)
    I have a table with week ending dates and use this table for as my LOV.
    The select list comes up like 12-SEP-12 when I check the value attribute in Firebug. Problem is that this comes up as year 0012 instead of 2012 when I try to use it in my PL SQL code to save it to a table.
    Is there a way I can get the return value for the year in YYYY format for return value in select list? Have tried to_date(dt, 'DD-MON-YYYY') with no luck.
    Cheers.

    All APEX session state values are held as VARCHAR2s. Explicit conversion to and from DATE values using specified formats is recommended. Convert to VARCHAR2 in the LOV query:
    select to_char(week_ending, 'DD-MON-YYYY') l, to_char(week_ending, 'YYYY-MM-DD') v from ...and to DATE in the PL/SQL process code:
    ...to_date(:p1_week_ending, 'YYYY-MM-DD')...I'm trying to standardise on using ISO 8601 representations for non-displayed date values. These are unambiguous, sort properly using character semantics, and are compatible with other systems and technologies.

  • How to convert a list of string of time (HH:MM:SS)to a numeric list for plotting

    my question is: How to transform a list of characters of values of time that have format HH:MMS to a list or adjustment of numerical values, to be able to use them in a code of LabVIEW?
    The numeric data are going to be used to plot them in a graph XY and to manipulate them.

    If it's 24-hour format than a Scan From String function with %d:%d:%d as the format string will give you hours, minutes, seconds as numerics. You could then convert to seconds as shown in the attachment.
    Attachments:
    time_string_to_seconds.jpg ‏9 KB

  • Need help getting totals.  does nvl(' ',0)  return a numeric 0 ?

    I am having problems trying to total some columns and I think it has to do with the sql not seeing the information as numeric.
    I created this to test. With this nvl it displays ORA-01722: invalid number
    select bcount.b1,bcount.b2,bcount.b3,acount.a1,acount.a2,acount.a3,bcount.b1 + bcount.b2 + bcount.b3 + acount.a1 + acount.a2 + acount.a3 mytot
    from
    (select 10 item,nvl(' ',0) b1,2 b2, 3 b3 from dual) bcount,
    (select 10 item,1 a1,2 a2, 3 a3 from dual) acount
    where bcount.item = acount.item
    Actual sql
    select emp.file_no,nvl(reg.regcount,0) regcount,nvl(ded.dedcount,0) dedcount,rehrg.rehrgcount,rop.ropcount,vs.vscount,
    wtc.wtccount,timeline.tlcount,hl.hlcount,addl.addcount,op.opcount,oi.oicount,opoi.opoicount,
    regcount + dedcount mtotal
    if regcount = 8 and dedcount = 0 I get blank for my mtotal.
    I think its because the nvl returns a 0 but the sql does not know this to be a number.
    What do I do?
    Howard

    I hope this helps and thanks
    results
    FILE_NO REGCOUNT DEDCOUNT REHRGCOUNT ROPCOUNT VSCOUNT WTCCOUNT TLCOUNT HLCOUNT ADDCOUNT OPCOUNT OICOUNT OPOICOUNT MTOTAL
    898989 8 - - - 8 - 8 - 4 - - - -
    sql
    select emp.file_no,reg.regcount,ded.dedcount,rehrg.rehrgcount,rop.ropcount,vs.vscount,
    wtc.wtccount,timeline.tlcount,homeless.hlcount,addl.addcount,op.opcount,oi.oicount,opoi.opoicount,
    reg.regcount + ded.dedcount mTotal
    from
    (select file_no,OU_NAME,employee_level_id from tbl_employee where file_no is not null and employee_level_id = 4) emp,
    (select tca.assign_to_ahs,case.reh_reop_id,count(*) regcount from tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and case.reh_reop_id is null
    group by tca.assign_to_ahs,case.reh_reop_id) reg, -- regular
    (select tca.assign_to_ahs,case.reh_reop_id,count(*) ropcount from tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and case.reh_reop_id = 1
    group by tca.assign_to_ahs,case.reh_reop_id) rop, -- rop
    (select tca.assign_to_ahs,case.reh_reop_id,count(*) rehrgcount from tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and case.reh_reop_id = 2
    group by tca.assign_to_ahs,case.reh_reop_id) rehrg, --
    (select tca.assign_to_ahs,tait.issue_type_id,count(*) dedcount from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and issue_type_id in (46,47)
    group by tca.assign_to_ahs,tait.issue_type_id) ded,
    (select tca.assign_to_ahs,count(*) as VSCOUNT
    from tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and case.VS_OTHER_CNTY_AT_LA is not null
    group by tca.assign_to_ahs) vs,
    (select tca.assign_to_ahs,count(*) wtccount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.issue_type_id = 13 -- need to change to 49
    group by tca.assign_to_ahs, tait.issue_type_id) wtc,
    (select tca.assign_to_ahs,tait.aid_type_id,count(*) tlcount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.aid_type_id = 1 -- calworks
    group by tca.assign_to_ahs,tait.aid_type_id) timeline,
    (select tca.assign_to_ahs,tait.issue_type_id,count(*) hlcount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.issue_type_id = 38 -- homeless
    group by tca.assign_to_ahs,tait.issue_type_id) homeless,
    (select tca.assign_to_ahs,count(*) addcount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.ADDTL_FILING_DATE is not null
    group by tca.assign_to_ahs) addl,
    (select tca.assign_to_ahs,tait.aid_type_id,tait.issue_type_id,count(*) opcount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.aid_type_id not in (2,3,4,5,6,7,8,9,10) -- get only 1 calworks
    and tait.issue_type_id in (53,60,70)
    group by tca.assign_to_ahs,tait.aid_type_id,tait.issue_type_id) op,
    (select tca.assign_to_ahs,tait.aid_type_id,tait.issue_type_id,count(*) oicount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.aid_type_id not in (1,3,4,5,6,7,8,9,10) -- get only 2 foodstamps
    and tait.issue_type_id in (53,60,70)
    group by tca.assign_to_ahs,tait.aid_type_id,tait.issue_type_id) oi,
    (select tca.assign_to_ahs,tait.issue_type_id,count(*) opoicount
    from tbl_aid_issue_types tait,
    tbl_cases case,tbl_case_assigned tca
    where case.createdate between TO_DATE(:P_from,'mm/dd/yyyy') and to_date(:P_to,'mm/dd/yyyy')
    and tca.ats_no = case.ats_no
    and tca.ats_no = tait.ats_no
    and tait.aid_type_id not in (3,4,5,6,7,8,9,10) -- get only 1 and 2 foodstamps and calworks
    and tait.issue_type_id in (53,60,70)
    group by tca.assign_to_ahs,tait.issue_type_id) opoi
    where emp.OU_NAME = reg.assign_to_ahs(+)
    and reg.assign_to_ahs = rop.assign_to_ahs(+)
    and reg.assign_to_ahs = rehrg.assign_to_ahs(+)
    and reg.assign_to_ahs = ded.assign_to_ahs(+)
    and reg.assign_to_ahs = vs.assign_to_ahs(+)
    and reg.assign_to_ahs = wtc.assign_to_ahs(+)
    and reg.assign_to_ahs = timeline.assign_to_ahs(+)
    and reg.assign_to_ahs = homeless.assign_to_ahs(+)
    and reg.assign_to_ahs = addl.assign_to_ahs(+)
    and reg.assign_to_ahs = op.assign_to_ahs(+)
    and reg.assign_to_ahs = oi.assign_to_ahs(+)
    and reg.assign_to_ahs = opoi.assign_to_ahs(+)
    and emp.file_no = '898989'
    order by emp.file_no
    Edited by: csphard on May 9, 2009 8:36 PM

Maybe you are looking for