Variable number of "IN" members

I have an application with an SQL statement that simplifies to
SELECT * FROM X WHERE Y IN (?, ?, ?, ?, ?)
The problem is that the number of items in the IN portion of the query is variable and yet I want to prepare the statement once and execute it many times.
I'm about to implement a brute force approach which defines 10 parameters inside of the IN statement and on each call sets the parameters to a particular value or NULL if I don't need all ten.
The question is "Is there a better way?"
Thanks,
Andy.

Tom Kyte has an article on your options here http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:110612348061#2863533704231
If you know that there will only ever be 10 elements, the brute force approach may not be a bad one.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • How can I set a variable number of values in a SQL IN clause?

    Hi,
    How can I set a variable number of values in a SQL IN clause without having to change the text of the SQL statement each time?
    I read the link http://radio.weblogs.com/0118231/2003/06/18.html. as steve wrote.
    SELECT *
    FROM EMP
    WHERE ENAME IN (?)
    But we need the steps not to create type in the system and would there be any other solution if we would like to use variable number of values in a SQL IN clause ?
    We are using JDeveloper 10.1.3.2 with Oracle Database 10.1.3.2
    Thanks
    Raj

    Hi,
    can you please explain why the solution from steve is not the right solution for you.
    regards
    Peter

  • How to get the number of community members from outside the community

    Hi everyone.
    I need to know if there is any way to get the number of community members from outside the community, I mean, not using the "What's happening" webpart. I want to build up a page with a Webpart that summarize my three most visited communities indicating
    number of members, three last messages in the newsfeed, and number of posts in blog, wikis, document libraries, etc.
    Do I need statistics to get this kind of information? Should I use Sharepoint Object model instead?
    Here is an example of what I need:
    - Community name
    - Number of members
    - Community activity (messages, docs uploaded to library, etc)
    - Number of posts in calendar, blog, wiki that belongs to community
    Thank you all!

    Hi Thuan.
    Thanks for your answer but it does not help me because these communities are Sharepoint Communities not external sites so I need to get that information using SP object model and BCS in this case is useless.
    EDIT
    I found the solution using the search objects but I was only able to get members, discussions and replies
    using (ClientContext clientContext = new ClientContext("URL_OF_ENTERPRISE_SEARCH_CENTER"))
    KeywordQuery keywordQuery = new KeywordQuery(clientContext);
    keywordQuery.QueryText = "The_Name_of_the_Community WebTemplate:COMMUNITY";
    SearchExecutor searchExecutor = new SearchExecutor(clientContext);
    ClientResult<ResultTableCollection> results = searchExecutor.ExecuteQuery(keywordQuery);
    clientContext.ExecuteQuery();
    System.Collections.Generic.IDictionary<string, object> ret = null;
    foreach (System.Collections.Generic.Dictionary<string, object> resultRow in results.Value[0].ResultRows)
    Console.WriteLine("{0}: {1} ({2})", resultRow["CommunityMembersCount"], resultRow["CommunityTopicsCount"], resultRow["CommunitiyRepliesCount"]);
    This is a Console Application.
    I hope someone helps

  • Possible to do variable number of REPLACE in SQL?

    Hello. Using Oracle 10G, R2
    Wondering if it is possible to do a variable number of REPLACE() entirely in SQL in a view.
    input_table.text_column = This (b)is(/b) some (i)text(/i) with (u)formatting(/u) codes
    Note: Using ( and ) to represent < and >
    rows in format_codes_table:
    (b)
    (/b)
    (i)
    (/i)
    (u)
    (/u)
    (p)
    (/p)
    etc. (The number of format_codes is not fixed)
    Desired output: This is some text with formatting codes
    This could be done with a user-defined function and then use that function in a SQL:
    create or replace function remove_format_codes(input_p IN varchar2)
    return varchar2
       v_output   varchar2(2000);
    is
    begin
       v_output := input_p;
       for r1 in (select format_code from format_codes_table)
       loop
          v_output := replace(v_output, r1.format_code);
       end loop;
       return v_output;
    end;
    create or replace view unformatted_output_vw
    as
    select remove_format_codes(input_table.text_column) as unformatted_output
    from input_table
    /I tried this SQL:
    select replace(input_table.text_column, format_codes_table.format_code) as unformatted_output
    from input_table
        ,format_codes_table
    /But it only replaces one format code at a time, and it is not recursive so the output is like this:
    This is(/b) some (i)text(/i) with (u)formatting(/u) codes
    This (b)is some (i)text(/i) with (u)formatting(/u) codes
    This (b)is(/b) some text(/i) with (u)formatting(/u) codes
    This (b)is(/b) some (i)text with (u)formatting(/u) codes
    etc.
    I've google'd Oracle recursive sql, looked at CONNECT BY, LEAD, LAG, MODEL, and I've also looked at a
    Tom Kyte example for varying in lists (http://tkyte.blogspot.com/2006/06/varying-in-lists.html),
    but I can't seem to find a way to replicate the loop in my user-defined function in SQL.
    Anyone think this is possible in SQL? If yes, any hints?
    Thanks

    Hi,
    Regular expressions (introduced in Oracle 10) are great for this:
    SELECT     REGEXP_REPLACE ( text_column
                     , '&lt;'          || -- left angle-bracket
                       '/?'          || -- optional slash
                    '[bipu]'     || -- any one of these characters
                    '>'             -- right angle-bracket
                     )      AS no_tag_text
    FROM    input_table
    ;You had some good ideas: recursive subqueries (new in Oracle 11.2), CONNECT BY and MODEL could also do this job, but not nearly as easily.
    In case you're interested, the following thread uses MODEL to do nested REPLACEs:
    SQL Query
    Edited by: Frank Kulash on May 13, 2010 4:08 PM
    Edited by: Frank Kulash on May 17, 2010 1:02 PM
    Fixed link

  • Number of Child Members in a Parent

    Hi There,
    Is there a way in BPC in when building a report or input schedule in which I can return the number of child members that is below a parent?
    I want to select a member in my dimension and I want a formula to return how many members is below that parent.
    I can see when I look at the current view in brackets there is a number next to the member name on how many members lies in that parent. I want to return that number in my workbook.
    Any ideas?
    The idea that I had was to create another evdre with dynamic expansion to return the base members of that dimension, and to use an excel function to count the members and return the total amount to the sheet I want to use.
    Henry

    What version of BPC?  If you're using any version on the microsoft platform you could use something like this:
    =EVLST("finance","entity",EVSET("finance","wood","evall"),B3:B4,"hlevel")
    "Finance" is my application
    "entity" is my dimension
    my set expression is evaluating all descendents of the WOOD entity <- this is what be based on your CV
    B3:B4 is my expansion range
    "hlevel" is a numeric property value that is meaningless for this exercise, but lets me do the following:
    Using the above (easiest to do on a seperate worksheet that can then be hidden), enter excel formula COUNT(B3:B5) in cell B2 (right above the expansion range of your list).  The set list will expand giving you the hierarchy levels of all descendents of your selected member and your count will add them up.
    Other options would be to add a property where you would manually assign the count to each parent member in your dimension.  Could be very tedious and time consuming depending on how often it changed.  Could also go a seperate expansion as you noted and just have a counter running next to the expansion: 1, 2, 3, ...) and have a function that looks for the max number.
    Hope that helps...

  • Display table with variable number of columns

    Hello Forum,
    I'm trying to build an export view of User Management Engine data. I would like to output a table with one row for every user with yes / no fields indicating membership in each of the available groups. Because the number of available groups might change in the future, I can't hardcode the column names for the groups.
    That is, I call a webservice to compute a table, and I get back a table with a variable number of columns.
    When I try to insert the webservice into my VC model, it complains:
    "Port 'Response' was omitted because it includes nested tables, which are not presently supported by Visual Composer"
    You might be interested to know that the business method of my webservice (for testing purposes) looks as follows:
    public String[][] getVariableSizeArray() {
            String[][] ret = new String[10][];
            for (int i = 1; i <= 10; i++) {
                    ret<i> = new String[10];
                    for (int j = 1; j <= 10; j++) {
                            ret<i>[j] = Integer.toString(i * j);
            return ret;
    Any help is appreciated, and points will be awarded for helpful answers,
    Sincerely,
    Florian
    Message was edited by:
            Florian Something

    Hi Florian,
    dynamic data structures are not supported. You can do this with a workaround. If you know the maximum count of your columns then you can add them to the table and hide/unhide them dynamicly via a formula in the hidden condition. Of course in your WS you als need a fix structure of your columns.
    This is not the best solution, I know so far, but it works. This is just one limit of VC.
    Best Regards,
    Marcel

  • UiXML tables - variable number of columns?

    I'm trying to define a <table> in a UIX page which will be generated from a set of parameters. This set of parameters will result in a varying number of columns so I'm looking at providing a DataObjectList which has DataObjects with keys for each of the columns attributes (header text, name of control, value of control etc.). I want to do something similar to <contents data:childData=...> on the <table> contents but this doesn't seem to work. It seems that <table> needs you to know how many columns will be present - is that so or is there some way I can do this?
    Cheers
    Ian

    Ian,
    That is correct, the uiMXL <table> element cannot currently support
    a variable number of columns (using something akin to the
    childData support in other contexts). But there are two approaches
    to get what you want.
    If you know the range of possible columns, then you can add a <column>
    element for each possible column in the <table>'s contents and then
    databind the rendered flag of the column element to hide/show the
    column as necessary.
    However, the real solution to your scenario, where the number of columns
    is completely unknown when you're designing the page, is our canonical
    example of a time you should write Java code for a portion of your page.
    Specifically, you can use the XML <include> element to refer to a
    DataProvider that will programatically create a TableBean. This
    technique is discussed in the Dynamic Structure for UIX pages
    portion of the UIX Developer's Guide.

  • Procedure with variable number of columns

    Hi, I have a procedure that looks like this:
    PROCEDURE PROC(p_cursor OUT sys_refcursor)
    And in the procedure, I build up QUERY dynamically and the number of columns varies at runtime.
    At the end I do
    OPEN p_cursor for QUERY
    Then to call this, I'm doing
    call PROC(?)
    My question is, how would I go about running the query from this procedure, then adding rows or modifying the existing results, then returning the modified data?
    What I want to do is add a new row based on some condition, so I still need to return a variable number of columns, but I need to modify the results before I return them.
    Is there any way of doing this? I need to do some calculations on the columns (the variable columns), create a new row, insert into result set, and return this new result set.

    A sys_refcursor is ideally suited to pass back to a front end gui like .NET or Java which can then use that cursor to retrieve the data.
    In PL/SQL there is no point in using a sys_refcursor unless you know, at design/compile time what the returned columns are going to be.
    If the resultant columns are dynamic, then you have no choice but to use the DBMS_SQL package, where you can parse and execute any SQL statement you like and then use the DBMS_SQL package to describe what the resultant columns are and how many there are. From that you can reference the columns by position rather than by name.
    e.g.
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_rowcount  NUMBER := 0;
    BEGIN
      -- create a cursor
      c := DBMS_SQL.OPEN_CURSOR;
      -- parse the SQL statement into the cursor
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      -- execute the cursor
      d := DBMS_SQL.EXECUTE(c);
      -- Describe the columns returned by the SQL statement
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      -- Bind local return variables to the various columns based on their types
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);      -- Number
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);     -- Date
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);  -- Any other type return as varchar2
        END CASE;
      END LOOP;
      -- Display what columns are being returned...
      DBMS_OUTPUT.PUT_LINE('-- Columns --');
      FOR j in 1..col_cnt
      LOOP
        DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
                                                                                  when 2 then 'NUMBER'
                                                                                  when 12 then 'DATE'
                                                         else 'Other' end);
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('-------------');
      -- This part outputs the DATA
      LOOP
        -- Fetch a row of data through the cursor
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        -- Exit when no more rows
        EXIT WHEN v_ret = 0;
        v_rowcount := v_rowcount + 1;
        DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
        DBMS_OUTPUT.PUT_LINE('--------------');
        -- Fetch the value of each column from the row
        FOR j in 1..col_cnt
        LOOP
          -- Fetch each column into the correct data type based on the description of the column
          CASE rec_tab(j).col_type
            WHEN 1  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
            WHEN 2  THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                         DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
          ELSE
            DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
            DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
          END CASE;
        END LOOP;
        DBMS_OUTPUT.PUT_LINE('--------------');
      END LOOP;
      -- Close the cursor now we have finished with it
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    DEPTNO - NUMBER
    SAL - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    DEPTNO : 10
    SAL : 2450
    Row: 2
    EMPNO : 7839
    ENAME : KING
    DEPTNO : 10
    SAL : 5000
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    DEPTNO : 10
    SAL : 1300
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from emp where deptno = 10');
    -- Columns --
    EMPNO - NUMBER
    ENAME - VARCHAR2
    JOB - VARCHAR2
    MGR - NUMBER
    HIREDATE - DATE
    SAL - NUMBER
    COMM - NUMBER
    DEPTNO - NUMBER
    Row: 1
    EMPNO : 7782
    ENAME : CLARK
    JOB : MANAGER
    MGR : 7839
    HIREDATE : 09/06/1981 00:00:00
    SAL : 2450
    COMM :
    DEPTNO : 10
    Row: 2
    EMPNO : 7839
    ENAME : KING
    JOB : PRESIDENT
    MGR :
    HIREDATE : 17/11/1981 00:00:00
    SAL : 5000
    COMM :
    DEPTNO : 10
    Row: 3
    EMPNO : 7934
    ENAME : MILLER
    JOB : CLERK
    MGR : 7782
    HIREDATE : 23/01/1982 00:00:00
    SAL : 1300
    COMM :
    DEPTNO : 10
    PL/SQL procedure successfully completed.
    SQL> exec run_query('select * from dept where deptno = 10');
    -- Columns --
    DEPTNO - NUMBER
    DNAME - VARCHAR2
    LOC - VARCHAR2
    Row: 1
    DEPTNO : 10
    DNAME : ACCOUNTING
    LOC : NEW YORK
    PL/SQL procedure successfully completed.
    SQL>In 11g, you can create a sys_refcursor and then the DBMS_SQL package allows you to convert that refcursor into a DBMS_SQL cursor so that you can get the description of the results and do the same. This isn't available prior to 11g though.
    However_ before any of that, you should really ask yourself if there is a real need to dynamically be creating queries. There is rarely any real need to do that and if you're finding it's common in your application then this is often a sign of poor design or poorly defined business requirements (leaving the technical side to try and be "flexible" and hence leading to unmaintainable code etc.).

  • Labeling Variable Number of Plots on a Graph?

    I'm loading up an unknown number of files and graphing them. Since it can get a bit confusing, I'd like to be able to take a portion of the file name and label each plot on my graph. Since there is a variable number of graphs, I can't seem to work around how to wire the property node. There are several other things I'd like to do with the graph, but dont know if its possible or not such as having a label pop up if your cursor is over a plot.

    You are going to have to embed the reference node for the graph into a for-loop like the attached example. File names or portions thereof are built as strings and then added into the property node Plot>>Plot Name.
    I'm not sure about how to get a label to pop up if you are over the plot. You might be able to do it with some cursors and associated code.
    Attachments:
    Graph-Names.vi ‏20 KB

  • Variable number of document info record parameters

    Hi guys,
    I have a question about adding additional information to document info record.
    The situation is following:
    Our customer wants us to link original purchase order (PDF file) with it's document info record in SAP. The document itself is stored in another document management system and we have succeeded in linking this object with it's document info record in SAP.
    He also wants to have some description data stored in document info record (date, description, name, etc). One odd requirement is copying information about cost centers and costs per each cost center from fields in document management system to some fields in document info record.
    The problem is that each purchase order can have various number of cost centers and costs per each cost center!
    So, is there any possibility to define some fields in document info record to which I can store variable number of parameters (for example in one case 3 fields, and maybe in another case 1 field)?
    Any kind of information will be valuable for me!
    Thanks for help!

    Hi,
    But my next question is how can I know how much cost centers will be for some document? If I need to define number of cost centers in advance, then this solution is not very flexible. The best solution would be if I could add values to classification flexibly (for example: one time 3 values and the other time 1 value).
    :-Check box additional values in values tab of char. that will allow to enter flexible number of values any time
    The other question is about values of parameters. For each cost center I need to enter two values (cost center number, and costs for that cost center). So, for each cost center I need to add 2 values. Is that possible using classification?
    :-Create classification with chara. cost center, cost center value and check box additional values as above that will allow you to add values for cost center and cost center value.
    Anirudh.

  • Variable number of two dimensional arrays into one big array

    I have a variable number of two dimensional arrays.
    The first dimension is variable, the second dimension is always 7.
    i.e.:
    Object[][] array0 = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    Object[][] array1 = {
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Object[][] arrayi = ...I'm generating these arrays with a for-loop:
         for (int i = 0; i < filter.length; i++) {
              MyClass c = new MyClass(filter);
              //data = c.getData();
    Where "filter" is another array which is filled with information that tells "MyClass" how to fill the arrays.
    "getData()" gives back one of the i number of arrays.
    Now I just need to have everything in one big two dimensional array.
    i.e.:Object[][] arrayComplete = {
    {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"},
    {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"},
    {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"},
    {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"},
    Any idea on how to accomplish this? It's blowing my mind right now.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Just brainstorming here:
    Why not put your actual data in a class and store that in a LinkedList (so you know the total number of elements for your multi-dimensional array). Then initalize your multi-dimensional array and populate it? Haven't tested the following, but thinking something along the lines of
    public class MyData {
         //data here
         public Object[] toArray() {
              //something similar to this
              return new Object[] = {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"};
    LinkedList<MyData> data = new LinkedList<MyData>();
    data.add(mydata1);
    //however many times you need
    Object[][] arrayComplete = new Object[data.size()][7];
    for(int i = 0; i < data.size(); i++) {
         arrayComplete[i] = data.removeFirst().toArray();
    }Another option for knowing how many rows you would need might be using something like:
    int rows = 0;
    rows += array1.length;
    rows += array2.length;
    //etc...But is not entirely useful if you don't know how many variable arrays you have (although reflections might help if the name of the array variable is incremented systematically, someone told me earlier to avoid reflections since it could make debugging a LOT more difficult).
    Edited by: bogdana on Apr 1, 2010 10:38 AM

  • Variable number of parameters in a procedure

    Hello !
    I have a form in a procedure with dynamic inputs type "checkbox" (one checkbox by record of a table).
    The action of the form is another procedure. There is a variable number of parameters (depending on checked inputs).
    How can I do for retreiving these variable data within a single variable in my second procedure ?
    Thanks for help and sample
    null

    What u can do is use Javascript and pass all the selected checkbox Ids as a dilimited string..which u can read in second procedure and can perform appropriate action. for example if you have check box named as chk1,chk2,chk3,chk4 n so on..
    now if chk1,chk3,chk4 are checked then pass this string in the hidden field "1|3|4"which is a |(pipe) delimited string..

  • How to create line hart with variable number of data series

    Hello,
    I am student and I am completely new to Flex programming but
    I need to urgently create an app that should have a variable number
    of data series but of ame type of object.
    eg. Profits for X,Y and Z in in run while just corp X in the
    next instance.
    How can I accomodate for this in the app? can someone point
    me in the right direction I would really greatful as this project
    is really crucial for my coursework to get finished in timely
    manner.
    Thank you

    Hey,
    I'm not really sure what you want, but you should check out:
    http://demo.quietlyscheming.com/ChartSampler/app.html
    Which has a list of different types of charts in Flex and
    will hopefully help. Also check out charting from ILOG, which is
    quite good:
    http://www.ilog.com/products/elixir/

  • Possible to use process substitution a variable number of times?

    Hello Archers,
    I have a script like so:
    #! /bin/bash
    ( readlink /proc/$$/fd/0 | grep -q "^pipe:" ) || ( file $(readlink /proc/$$/fd/0) | grep -q "character special" )
    cat | tee >(awk 'NR % 2 == 0') >(awk '(NR+1) % 2 == 0')
    Well, it's pretty trivial at the moment, but the underlying goal is to split the input, so it can be processed in parallel on multiple cores. If I understand correctly, the above code will split the input across exactly two cores. Does there exist some way to put the process substitution (i.e. ">(awk ' ... ')")  in a loop?
    Before trying to increase the number of cores, I first tried to see whether I could loop just two times with,
    cat | tee $(for i in 1 2; do >(awk -vn="$i" '(NR + $n) % 2 == 0'); done)
    but that didn't work.
    It also occurred to me that maybe I'm presenting an X-Y problem. I did also consider using the split command, but as far as I can tell, it will only dump its output to files; it's no good for piping or process substitution. Any other ideas that would avoid needing to tee across a variable number of process substitutions?
    Naturally, I tried a little Googlemancy, but only came up with answers to newbie questions, or tutorials aimed at newbies.
    Thank you for your consideration.
    Last edited by /dev/zero (2012-03-26 07:16:25)

    Or if you want to avoid named pipes, since during development they tend to create lots of files, and the script has to clean them up afterwards, take a look at the 'coproc' feature bash has since version 4
    Though, remember that 'man bash' under BUGS says, there may only be one active coproc at a time.
    According to this it's not really such a big deal though.
    And it won't kill the started coprocesses or anything if you start another process...
    Here's a sample session: (the spaces are important btw. )
    wry:~/ $ bash [19:02:43]
    wry@blubmb:~$ coproc c1 ( cat )
    [1] 4129
    wry@blubmb:~$ coproc c2 ( cat )
    bash: warning: execute_coproc: coproc [4129:c1] still exists
    [2] 4130
    wry@blubmb:~$ echo $c1_PID $c2_PID -- ${c1[@]} ${c2[@]}
    4129 4130 -- 63 60 62 58
    wry@blubmb:~$ echo aaac1 >&${c1[1]}
    wry@blubmb:~$ echo bbbc2 >&${c2[1]}
    wry@blubmb:~$ read -u ${c1[0]} line1
    wry@blubmb:~$ read -u ${c2[0]} line2
    wry@blubmb:~$ echo $line1 and $line2
    aaac1 and bbbc2
    wry@blubmb:~$ kill $c1_PID $c2_PID
    wry@blubmb:~$
    [1]- Terminated coproc c1 ( cat )
    [2]+ Terminated coproc c2 ( cat )
    wry@blubmb:~$ exit
    exit
    Just keep in mind that the filedescriptors you get for a coproc won't be available in subshells you execute with &
    Eg. you cannot do
    coproc X
    ( use X ) &
    Links: http://wiki.bash-hackers.org/syntax/keywords/coproc

  • Most elegant way to accept a variable number of files?

    I am writing a program where I would like to accept a variable number of files to process. In my inexperience with LabVIEW I can think of several ways to do this, which aren't as user friendly as I'd like it to be.
    I tried an array of file path controls. This will be the easiest to implement, but what I don't like is that you can't really see all the files you've inputted at once and if you select a file and want to erase it, it will query you for a file.
    I tried a while loop with an empty file path to my Read Characters from File.vi, but I would like it so that the user can just specify which files they'd like to load without having to wait inbetween. Also, as I mentioned before, I would prefer it if the use
    r could see which files they've decided to load and have the option of taking a file out if they should so choose.
    I could try just fixing the number of files and have like 5 or so file path controls and do it like that. That seems like it would be clumsy and obviously has the problem of not being variable.
    I'm just wondering if there is something that I haven't thought of, or if I have and which avenue would be the best. I feel fine about using an array of file path indicators, but wonder how I can remove indicies that are empty.

    Dan, use the special path constant called "Temporary Directory".
    Another problem is the fact that you hardwire the path as a string ("c:\temp\...") instead of a path constant. This will make the code useless on any platform except windows.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Firefox window will not move across the desktop

    I am running F.F. version 34.0.5 on a iMac with Retina display (32 GB RAM) and Mac OS X 10.10.1 I can resize the Mozilla window but I cannot move it around the screen. I have tried resetting Firefox and also turned off hardware acceleration. I've tri

  • Avoiding empty-file creation

    Hi, Is there any way to avoid empty file creation on the receiver side? I am using variable-substituton for file naming. Thanks, Vishal

  • Hosting a SaaS PHP/MySQL web application

    Hi I am building a PHP web application ( to be used by about 5 customers ) with MySQL database using partitionning strategy for scalabilty purpose. Customers list can grow up to 100, so I pre allocated 100 partitions for the MySQL database. Can I hos

  • Safari 5... 4od wont load videos

    As the title suggests, i cannot get videos to load up on 4od with Safari, yet it works perfectly fine in Chrome. Has anyone else experienced this and can help me solve this problem? Thanks in advance! PS running Safari 5.0.3 but was the same with 5.0

  • Problems using one music library between two users

    I followed to a T the instructions listed under here: http://support.apple.com/kb/HT1203 . This was echoed by a Macworld help topic and after several attempts I was able to get the primary user account to recognise the new location of the music files