Thought Experiment: Variable Number of Parallel Time Dependent Systems

Hi all, 
I'm just going through a thought experiment before beginning a new major project and am trying to figure out the best way this code could work. We have a new project coming up that is going to be based out a single computer, this computer is then going to control a number of identical iterations of measurement devices, at present the number is 20 but this could change depending on mechanical failure etc during trials. All of these devices need to be running at the same time and are relatively time dependent, each device has to:
Record measurement data at 1Hz (0.05s Active Time)
Respond to inputs and undertake longer tasks (0.5s Active Time). Inputs occur at random intervals greater then ~10s
As all of these systems must run in parrallel I am looking at the number of different ways LV handles the parallel instances to try and determine a reasonable design pattern before beginning anything. The current ways that I am looking at it are:
Standard Multiple VI parallelization
Build a SubVI, place multiple instance in block-diagram, run.
Pros:
Simple, Build a Sub-VI that can run the device plop X instances.
Cons:
Scalability, Not able to easily change number of instances without re-editing code, rebuilding moving etc.
State Machine parrallelization
Build a state machine for the Device, run X instances in a parrallelized For Loop, for all longer tasks run start them and then check progress each time you come back into the state machine.
Pros:
Programmatically scalable
Standard State Machine Architecture.
Cons:
Less control over long tasks
More complex programming and control.
I am looking forward to what the community has to say, I have a feeling I should probably be looking at OOP for this but I have never done any in LV before and I am a little worried how long the learning curve on that would add to the project without resulting in a much improved outcome.
Let me know your thoughts on the best way to continue.

As Mike said, you can launch multiple instances of a reentrant VI similar to launching a single instance of a VI - it's all in how you get your reference / what your reference actually is.
If you use the Open VI Reference function with a parameter of 0x80 or 0x100 on a preallocated clone reentrant VI, a clone is allocated and the reference is a reference to that clone of the VI (you can check this in testing using a property node and checking the name, which will have the clone number after a colon, and/or Is Clone VI).  At that point, anything that you do with that reference is being done to that clone.
What I did recently for a similar design was defined my class (or just a cluster if not using OOP) to have all of the information to define a single identity - TCP connection ID, queue refs, etc., and the reference to a clone.  A constructor would be called like a "regular" SubVI to create everything it needed, including allocating a clone for itself to run in, and return a Data Value Reference to the resulting object (cluster).  A launcher could then be used that would take the clone reference and Start Asynchronous Call on it, passing into one of its controls the DVR to the object.  Now the clone is running and has everything that it needs to identify itself and operate, including responding to connections like you might have for displaying detailed information about one process all on its own, and my main application still holds onto the reference to the object so that it can do things like be a common server to give new clients the list of TCP ports that each clone is available at.
As for some items in the original post:
  An object oriented approach is usually great for managing these kinds of designs.  If you have knowledge of object oriented design and just aren't familiar with LabVIEW's OOP support, then the learning curve should be very shallow, but it is a good idea to start with a small project or a single module first.  You don't want to be in the, "It's supposed to work this way, but I've never actually done it, and that coercian dot on a child being passed into a parent terminal is making me nervous..." boat for a critical project, even when it does work how you think its supposed to.
  I believe that the Actor Framework (which requires LabVIEW OOP to work with) is made for this type of stuff.
  I must say, I hadn't ever considered or seen using a parallel-enabled for loop with a SubVI in it to do this kind of thing, and I thought it was a cool idea.

Similar Messages

  • Time-dependent hierarchy in query selection screen

    Hello all
    I am running query where input selection has following fields -
    Fiscal year variable ( e.g. i can enter 2008)
    Period variable ( e.g. i can enter 12)
    Hierarchy Node variable
    The hierarchy is time-dependent. I want that if I enter year and period as 2008 , 12 then
    my hierachy node selction pop-up should show me only that hierarchy structure which was valid in 12.2008.
    But my hierarchy selection always shows me hierachy structure that is valid on current date.
    Can anyone help me on how to achieve this?
    I have already coded keydate variable based on fisc year and period. But then how to make use of this key date variable so as to get correct selection of hier?
    Regards,
    Sanjyot

    Hi Marcio
    RSRHIERARCHYVIRT is for maintaining time-characteristics hierarchy.
    My hierarchy is based on Consolidation Groups and Units.
    But the hier is time-dependent.
    So I want that when selection pop-up opens for a hier node , it should show me correct hier depending on year and period i have enetered.
    Regards,
    Sanjyot

  • 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

  • Selection of time-dependent hierarchy variables after selection of time

    Hi guys,
    I'm having the following question regarding the selections of variables in a BEx Query:
    I need to select e.g. a position out of a hierarchy which is time-dependent. In the selection screen I'm only able to select a certain date but not the key date that I need for the hierarchy. Now I would like to replace the needed key date for the hierarchy out of the date value. Having the parameters for the hierarchy selected I would like to select a position of the right hierarchy.
    My idea is to select the date first:
    Date: 05.2009
    In the next pop up window the hierarchy key date is replaced by the date:
    Date: 05.2009 --> key date: 05.2009
    Now I can select a position for the right hierarchy.
    Is a two-stage selection possible? How can a variable be replaced and simultaneously serve in the selection of object with a hierarchy?
    Thanks in advance!

    Hi Partho,
    Please check this link. Might be helpfull.
    http://www.ibm.com/developerworks/data/library/cognos/infrastructure/cognos_specific/page551.html
    Regards,
    Rahul

  • APD query key date with variable for time dependent MD display attributes

    Hello,
    In a APD I use a query as a source with a query key date that is filled with a customer exit variable.
    When I run the query as a user, the time dependent MD display attributes look fine. However, when I use the query in an APD, I get no values for the time dependent display attributes.
    Any suggestions?
    Thanks

    Hi,
    Try to run query using RSCRM_BAPI Tcode, this you can also schedule in background
    Thanks
    Reddy

  • Time-dependent Vendor Master & Handling Special Characters

    Hi,
    I need to extract time-dependent Vendor Master.
    1. The data source for <b>0VENDOR</b> does not have fields to hold the valid date range.
    2. Does the Master data in R/3 for Vendors will hold the valid date range?
    3. The text for <b>0VENDOR</b> provides time-dependent, but how to map the <b>valid from</b> and <b>valid to</b> fields?
    Handling Special Characters:
    We are trying to extract data from Legacy system via DB Connect. The item text field consists of special characters. Of course in BW customization we can specify all the special characters to consider. But the special character we observed is 'square' symbol i.e. 'new line character' in Oracle. We are updating this to an ODS object. When looked at error log, observed that green light for the number of records transferred and updated, but finally when it load into ODS object and activates popping up the error message saying 'could not recognize special character'.
    Please help me getting the 2 issues resolved.
    Thanks in advance.
    Regards,
    Sudhakar.

    Hi Everyone,
    Thanks for inputs on Special characters issue...
    Finally resolved with below piece of code in the start routine:
    DATA: FLAG,
          OFF TYPE I,
          LEN TYPE I VALUE 1,
          ALLOWED_CHAR(95) VALUE
    '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_=+ ' &
    'abcdefghijklmnopqrstuvwxyz:;<>,.?/|\{}[]"'''.
    CONSTANTS: C_CHAR VALUE '-'.
      LOOP AT DATA_PACKAGE WHERE NOT /BIC/ZI_DESC IS INITIAL .
        DO.
          IF DATA_PACKAGE-/BIC/ZI_DESC CN  ALLOWED_CHAR.
            REPLACE SECTION OFFSET SY-FDPOS LENGTH LEN OF
                    DATA_PACKAGE-/BIC/ZI_DESC WITH C_CHAR.
            FLAG = SPACE.
          ELSE.
            FLAG = 'X'.
          ENDIF.
          IF FLAG = 'X'.
            EXIT.
          ENDIF.
        ENDDO.
        MODIFY DATA_PACKAGE.
      ENDLOOP.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    I have seen the link sent by 'Eugene Khusainov' today. Thought putting my piece of code that may help others...
    Regards,
    Sudhakar.

  • 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 .

  • How to Select in a query considering key date of time-dependent characteris

    Hi, Everybody
    I have a Infoobject called CONTROL. It can be tested during the year once, twice, three times,six times  or can be not Tested.
    The Characteristic that contain the number of  test that the Control will be tested is time dependent.
    For example, one control can have the charcteristic to test twice in a year. Then 31/10/2007 it can turn "not test".
    I can have these records:
    CONTROL   VALID INIT       VALID END     TEST  
       XYZ         01/01/2007       31/01/2007       TWICE
       XYZ         01/02/2007       28/02/2007       TWICE
       XYZ         01/03/2007       31/03/2007       TWICE
       XYZ         01/04/2007       31/10/2007       TWICE
       XYZ         01/11/2007       31/12/9999       NO TEST
    I have a query that I should select the number of controls different of  "NO TEST" During the time selected.
    For example, if I select Interval Time = 01/01/2007 to 31/10/2007, This record should be Counted, because it was to be tested during this period.
    If I have selected Interval time = 01/11/2007 to 31/12/2007, it should not be selected because in this period, this control doesn´t able to be tested.
    If I put filter restricting NO TEST, the query should check the time of validity, but when I do that, BW doesn´t accept that because I can´t restrict by Validate Date.
    Anybody already had a problem like that?
    I´d like suggestions to solve that or comments that could explain that.
    Thanks a lot,
    Elisabeth
    Edited by: Elisabeth Umebara on Feb 2, 2008 12:21 AM

    Hi, everybody.
    I already solved this problem. Thanks a lot.
    For this I selected the controls in a exit variable that should be selected in from table time-dependent  from infoobject. This solution ran just for BWD and BWQ, because there was a lot of data in BWP.
    Then I made a first query that has selected the controls. After that, in the original query I defined the substitution path relating with the first query.
    Thanks again,
    Elisabeth

  • Reporting on Time Dependent Master data

    Dear All,
    We are using 0employee time dependent master infoobject for reporting Active employees as on any specific date.
    Report runs absolutely fine depending upon user input date (Variable created for Key date properties).
    Now user has another requirement here.
    For example:-
    if the user input date is 31.12.2010 . So basically user wants to know the number of active people as on 31.12.2010 and also number of active people for month of november i.e. as on 30.11.2010 , 30.10.2010 for october and so on for back 6 months.
    So that he can track how people are growing over a period of several months in an year.
    How do i get this break up?
    Problem scenario
    If i run my report based on input key date i.e. 31.12.2010 then people who are quitting on before 31.12.2010 will not not appear in report at all which is correct but when i want to see novemember data then he should be included in the total count of employee for the month of november.
    Kindly suggest how do i achieve this.
    Thanks & Regards,
    Anup

    Hi Anup,
    You can do it by creating variable on input key date. By using offset concept you should create other variables for last date of past six months and you should write the code in customer exit for that to happen.
    Then you create formulas using your variables. But you should have the fields to display data in such manner.
    regards..

  • How to: from time independent hierarchy to time dependent hierarchy in BW

    Hello goeroes outthere,
    I am facing the following problem and was wondering if some of you have faced the same issue.
    In ECC we have a time independent hierarchy on Profit Center. Our customer wants to perform time DEPENDENT reporting in BW.
    As the standard datasource does not support to be loaded via PSA in the datasource definition (only IDOC) we cannot enhance the datasource with fields such as DATEFROM and DATETO. I've tried doing so but this results in the following error message when loading : Selected number does not agree with transferred number of records.
    So I have cancelled out this as being an option.
    I am analyzing the following two options :
    1. Making the hierarchy time dependent. (globally). The idea would be to create a custom ABAP program that would copy the loaded hierarchy to a hierarchy in which we define the datefrom as the actual system date and the dateto as 31.12.9999.
    Prior to doing so the abap program should change the already loaded hierarchy by modifying the dateTO as actual system date -1 in the header of the hierarchy.
    In theory this seems to be a good option, but I am afraid of the complexity of the ABAP program to be created by looking in debug how the copying process is handled in SAP. 
    2. Making the hierarchy structure TIme dependant. THis has as a consequence that the table  /BI0/HPROFIT_CTR is adjusted to include DATETO and DATEFROM fields. A custom program could read the entries and perform the same activities as described above. So meaning finding and modifying the existing entries with DATETO fields with as an entry 31.12.9999 to adjust to sysdatum -1 and modfying all entries that don't have dateto and datefrom entries by putting datefrom (=sysdate) and the dateto (=31.12.9999).
    The issue here is that first we need to find the link between the hierarchy ID and the Hierarchy loaded and that I am not sure how SAP will deal with this SID wise.
    Option 1 seems feasable as the hierarchy does'nt change every single day and doesn't require to be loaded every single day. But before going in this direction, I would appreciate some confirmation of my approach.
    Thanks in advance for sharing your lights on this topic.
    Rgds,
    Bvpe

    Hi Bart,
    I just solved this very problem today in a two step process:
    In our implementation, we only want to control when a new version of the hierarchy is created.  If nothing changes, whatever is brought in from the source system will just replace the current version.  We imagine we'll only create versions at month end or major re-organization.
    1) I created a Select Options variable in tcode: stvarv called ZPROFCTR_FROMDATE.  I added a value to the low position and set the option to equals.
    2) Open the infoPackage that is used to load the hierachy from the source system.  Go to the Hierarchy Selection Tab and click on the button at the bottom of the tabbed frame "Dynamic Hierarchy Selections".
    You should see two check boxes, place a check in the second box: "Determine Using Routine"  Click on the create icon and put this in the routine
      p_s_sel_hier = l_s_presel_hier.
      data: tempfrom type tvarv_val.
      select single low
      from tvarvc
      into tempfrom
      where name = 'ZPROFCTR_FROMDATE'.
      move tempfrom to p_s_sel_hier-datefrom.
      p_s_sel_hier-dateto = '99991231'.
      clear p_subrc.
    I've include the entire subroutine for context, and so you can see the SAP generated coments in the form that attempt to explain what the form is going to do.
    Long story short, the hierarchy you have selected with the radio button on the Hierarchy Selection tab will be the one that is affected by this logic.
    form compute_hier
      tables l_t_all_hier structure rshiertrsf
      using l_s_presel_hier like rshiertrsf
            l_infopackage   type rslogdpid
      changing p_s_sel_hier like rshiertrsf
               p_subrc like sy-subrc.
    *Insert Source Code to decide which Hierarchy shall be loaded.
    *The Hierarchy you select from table l_t_all_hier and fill
    *into p_s_sel_hier will be loaded.
    *The Structure l_s_presel_hier contains the pre-selection of the
    *BW-Scheduler - just to inform you what the BW wll load
    *if you change nothing.
    *$*$ begin of routine - insert your code only below this line        *-*
      p_s_sel_hier = l_s_presel_hier.
      data: tempfrom type tvarv_val.
      select single low
      from tvarvc
      into tempfrom
      where name = 'ZPROFCTR_FROMDATE'.
      move tempfrom to p_s_sel_hier-datefrom.
      p_s_sel_hier-dateto = '99991231'.
      clear p_subrc.
    *$*$ end of routine - insert your code only before this line         *-*
    endform.                    "compute_hier
    Hope this helps,
    Quack

  • Combining records for time dependent master data

    Good Day,
    We have a characteristic with turned on time dependency for master data.
    Bringing in data from the source generated a number of entries for the master data.
    Here is an example:
    Line 1: [Date 1] - [Date 2]
    Line 2: [Date 2] - [Date 3]
    Line n: [Date x] - [Date y]
    Any thoughts on how we can converge/aggregate Line 1 through Line n for the history, so that we have
    Line 1: [Date 1] - [Date y]...
    and then, going forward we can, use time dependency for any changes to master data that might come up.
    Thank You for your input,
    Dmitriy

    Hi Dmitriy,
    As far as I know, it is not possible, unless you delete the master data and reload.
    I don't think you will be able to delete the master data at this stage, because it will not possible to delete the master data without deleting the transaction data.
    Thanks,
    Krishnan

  • Which tables are hit when a query runs - time dependent objects performance

    Hello all,
    We are trying to see what are the effects of time dependent master data objects in query. We will have a key date as variable so user can see the data as a particular point.
    I am trying to see what are all the tables hit when a query is executed and how the time dependent info objects affect performance. Basically we are trying to see is - does the query hit the P or Q or Y tables of the infoobject. Is there any tcode or program that I can use to see which tables were hit and how much time the query took to execute.
    Also if the time dependent attribute is in free characteristic does it directly effect the query.
    If you can share some more experience with time dependent master data objects in query and its effects on performance that will be great.
    Thanks all in advance

    Hello Siggi, Thanks for inputs
    That is what I actually did before posting message here, the tables that are hit are /BI0/S...or /BI0/R and /BI0/T....    I never see the tables /BI0/P or /BI0/Q ... tables hit. I have a key date on variable screen at so when i put future or past date the /BI0/SDATE table is hit does it sound about right to you ?
    Is the /S table hit the most because the data is being seen from the SID's that are generated.
    Can you share your thoughts.
    Thanks again,
    Have assigned you points.

  • Time-dependent BW hierarchies in Analysis for OLAP

    Hi all,
    We are using time-dependent hierarchies in combination with a key date variable.
    Tools used: Query designer based on SAP BW 7.4 and BO 4.0.
    The following steps are executed:
    Report is executed and key date is prompted
    According to the key date, the correct time-dependent organisation hierarchy will be used in drill-down
    Bring up variable screen again and select different key date
    The drill-down changes according to the now correct time-dependent organisation hierarchy
    The above scenario works for BEx Analyzer, BEx Web, Analysis for Office - but not for Analysis for OLAP.
    Whenever I run through this scenario and confirm the updated key date, the following error is displayed:
    cube.get.dimension.info.runtime.error : java.lang.IllegalStateException: There is no default hierarchy for dimension [ORG].
    In the user guide I don't find any specifics about the hierarchies and since it works in all the other applications, I wonder where the error is coming from. I also could not find it anywhere else in the forum.
    Has anyone experienced the same error or any suggestions?

    Hi Peter,
    This issue is captured in SAP Note 1941865. Resolved in 4.0 (8.5, 9.2 or SP10) and 4.1 (1.6 or SP03).
    Symptom
    In BI 4.1, Analysis for OLAP returns errors similar to:"An error occurred in the MDAS service while processing a request from Analysis, edition for OLAP. Try the operation again. If the problem persists, please contact your administrator. (AOC00041)" and/or "cube.get.dimension.info.runtime.error: java.lang.IllegalStateException: There is no default hierarchy for dimension [DIMENSIONNAME]"
    The BW Query the AOLAP workspace is created against has 2 different hierarchies that have the same text description
    Environment
    SAP BusinessObjects Business Intelligence platform 4.0
    SAP BusinessObjects Business Intelligence platform 4.1
    Analysis, edition for OLAP
    Reproducing the Issue
    In CMC, create an OLAP BICS connection to a multi provider
    Connect to BI launchpad and launch Analysis, edition for OLAP.
    Use the connection to create a new workspace.
    The error is observed
    Cause
    This issue has been logged as a defect under ADAPT01720287 for BI4.0 and ADAPT01713663 for BI4.1
    Resolution
    A fix for this issue is included in the following maintenance releases:
    BI4.0:
    Patch 8.5
    Patch 9.2
    Support Pack 10
    BI4.1:
    Patch 1.6
    Support Pack 03

  • 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

  • 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

Maybe you are looking for