Multi-OU selection in PL/SQL

Hi
I get a requirement of providing View which contains records of Multi-OU transactions to other DB via DB-Link.
All the processes are in backend, and invoking several seeded DB functions of EBS 12.1.3. The functions using synonym for Multi-Org Access but not the base table, thus have to initialize the DB session for Multi-OU.
The steps I have made:
1. Setup a responsibility for Multi-Org Access
2. Initialize the DB session
    fnd_global.apps_initialize(user_id      => user_id1,
                               resp_id      => responsibility_id1,
                               resp_appl_id => application_id1
    mo_global.init('PO');
    MO_GLOBAL.SET_POLICY_CONTEXT(p_access_mode => 'M', p_org_id => null);
3. Write a customized function xx_function to invoke seeded functions, and then using in the view as a column. Since mo_global.init including DML actions, also use AUTONOMOUS_TRANSACTION in xx_function.
Here comes the problem:
SQL Statement1, return 0 record:
select xx_function(txn.id) from transaction_table txn;
SQL Statement2, return normal value;
select xx_function(1000) from dual; --1000 is a detail transaction ID.
Is there any restriction to use mo initialize directly in select sql?
Please help me.
Best Rgds
James

I'm not sure what you're trying to accomplish, but you could be talking about "DIY Parallelism" (as Tom Kite calls it).
This is where you process rows within mutually exclusive ranges of some primary key value. Like this:
UPDATE <some table>
SET  <some col> = <some value>
WHERE  unique_key BETWEEN min_val AND max_val;Put this into a package and fire off several copies of it at once, calling each one with different ranges.
Whether you'll get any performance benefit will depend on many factors, but in my case it worked like a champ. I created 8 threads and it brought the run time of my procedure from 2 hours down to 40 minutes. During the day, our server has lots of spare CPU cycles.
You have to be careful in the procedure, because if you go this route you need to change all the SQL statements to use it or you'll update the same rows 8 times.

Similar Messages

  • How to pass multi-value input parameter to SQL command

    I'm having trouble following the threads related to passing multi-value parameters to a SQL command.
    I need more details on the work-around that exists for using a dummy main report to GET the input parameters and pass them to a subreport parameter that uses the input parameters in its sql command WHERE clause.
    So far the main report prompts user to enter badge numbers into a multi-value string type parameter field called badgeNumber.
    The main report getRequesters command executes the following SQL:
    SELECT requester FROM lawprod.requester WHERE lawprod.requester.requester IN  '{?badgeNumber}'
    order by requester
    The main report also contains a formula called requesterList that concatenates the input parameters and separates the values with commas:  (Join ({?badgeNumber}, ", ")  
    So if user enters badge numbers 1 and 2 and 3 the value of requesterList is 1, 2, 3
    From the main report I've used the Insert Subreport command to choose an existing report, and used the link tab to link @requesterList to ?requester; where ?requester is a multi-value parameter that is used in the subreport's SQL query as shown below:
    WHERE (lawprod.ictrans.update_date <=  {?endDate} AND
           lawprod.ictrans.update_date >= {?startDate} AND
           lawprod.ictrans.doc_type = 'IS' AND
           lawprod.ictrans.system_cd = 'RQ' AND
           lawprod.mmdist.posting_type = 'O1')
          AND
          (lawprod.ictrans.company = lawprod.mmdist.company AND 
           lawprod.ictrans.system_cd = lawprod.mmdist.system_cd AND
           lawprod.ictrans.location = lawprod.mmdist.location AND
           lawprod.ictrans.doc_type = lawprod.mmdist.doc_type AND
           lawprod.ictrans.document = lawprod.mmdist.doc_number AND
           lawprod.ictrans.shipment_nbr = lawprod.mmdist.doc_nbr_num AND
           lawprod.ictrans.line_nbr = lawprod.mmdist.line_nbr AND
           lawprod.ictrans.component_seq = lawprod.mmdist.component_seq)
          AND
          (lawprod.ictrans.company = lawprod.reqline.company AND 
           lawprod.ictrans.document = lawprod.reqline.req_number_a AND
           lawprod.ictrans.line_nbr = lawprod.reqline.line_nbr AND
           lawprod.reqline.company = lawprod.reqheader.company AND
           lawprod.reqline.req_number = lawprod.reqheader.req_number)
           AND
           (lawprod.reqheader.requester in '{?requester}')
    Following execution of the main report, Crystal appears to prompt for three values as expected: badge numbers for the main report, and start and end dates needed by the subreport.   I can't figure out why Crystal XI returns no data. Can anyone explain what I'm missing?
    Edited by: Patricia Sims on Sep 21, 2009 9:30 PM

    The reason no data is returned is that the multiple values are not (properly?) passed to the main report's SQL.  The main report's SQL should be (MS SQL):
    select 1 as dummy
    This causes exactly one record to be returned, which will basically be ignored (except the fact that it will drive the subreport; any query that returns only 1 record will suffice...).
    Change the concatenation of the selected values to be (basic syntax):
    formula = "|" + join({?badgeNumber}, "|") + "|"
    The leading and trailing vertical bars are important (otherwise a database value of 1 might match a selection of 123).
    Pass the concatenated string as the parameter value to the subreport.  In your subreport, select records on (basic syntax):
    formula = (instr({?sr-badgeParam}, "|"+cstr({requester},"0") + "|") > 0)
    (assumes is numeric in the database, and is integer; modify or eliminate cstr() if otherwise...)
    Put your subreport on the detail format of the main report, and you're all set...
    HTH,
    Carl

  • Reporting: Multi-value select prompt

    Multi-value select prompt:  Need to verify if there is a limit to the number of items/size in a drop down list or if there are selected value limitations.

    Hi Rick,
    To clarify,  which type of parameters will you be using,  Dynamic or Static?   If you're using dynamic parameters (LOV's or Business Views) there is a limit on the display values,  but I am not aware of a limit on the input limit for multiple values.
    If you're using a dynamic parameter which will use an LOV or Business View the registry key value to increase can be found:
    HKLM > Software > Business Objects > Crystal Report > Database Options > LOV
    MaxRowSetRecords
    Regards,
    Wallie

  • How to send message to a multi-consumer queue using pl/sql

    How to send message to a multi-consumer queue using pl/sql ? Thanks.
    I tried following, but got an message: no receipient specified.
    DBMS_AQ.ENQUEUE(
    queue_name => 'aqadm.multi_queue',
    enqueue_options => queue_options,
    message_properties => message_properties,
    payload => my_message,
    msgid => message_id);
    COMMIT;
    END;
    /

    Here's two way to enqueue/publish new message into multi-consumer queue.
    (1) Use explicitly declared recipient list
    - Specify "Recipients" by setting recipient_list to messge_properties, before ENQUEUE().
    DECLARE
    recipients DBMS_AQ.aq$_recipient_list_t;
    BEGIN
    recipients(1) := sys.aq$_agent('RECIPIENTNAME',NULL,NULL);
    message_properties.recipient_list := recipients ;
    (2)Or, declare subscriber list permanently. Then you need not to specify recipient list each time you call ENQUEUE().
    begin
    dbms_aqadm.add_subscriber(
    queue_name=>'YOURQUEUE',
    subscriber=> sys.aq$_agent('RECIPIENTNAME', null, null)
    end;
    You can add 1024 local subscriber include maximum 32 remote-queue-consumer to one queue.

  • Multi-values selection control configuration

    The multi-values selection control give the user the option to select values from 'right to left'.
    Is there a way to reverse it to 'left to right', like users are regular from other GUI applications?
    Even in OBIEE other cases, like delivers subscribers, the selection is from 'left to right'.

    Hi nir,
    The behaviour is default in BI you cant change it.....As the default one would be right to left.Its not possible to change.
    UPDATED POST
    I dont know how we do with JS script....in BI 11g also the format is the same.Generally the tool is designed that way
    hope helps you.
    Cheers,
    KK
    Edited by: Kranthi.K on Apr 7, 2011 3:04 AM

  • Using select * in pl/sql

    Hi,
    Yesterday Karthick mentioned that using SELECT * in PL/SQL is not a good idea. But I tried by creating a table and different procedures with selecting all columns using * and specifying the columns individually. Later I altered the table and both procedures became invalid. Can some one give a simple example to demonstrate the behaviour.
    At present I dont have Oracle in my PC to post what I have tried yesterday.
    Cheers,
    Suri

    When I run the following script, the 2nd time the test1 procedure runs, it fails with "PLS-00905: object TEST1 is invalid", whereas test2 runs fine both times.
    Feel free to try it yourself!
    create table boneist_test (col1 number, col2 varchar2(10));
    insert into boneist_test values (1, 'a');
    commit;
    create procedure test1
    is
      v_num number;
      v_var varchar2(10);
    begin
      select *
      into v_num, v_var
      from boneist_test
      where rownum = 1;
    end test1;
    create procedure test2
    is
      v_num number;
      v_var varchar2(10);
    begin
      select col1, col2
      into v_num, v_var
      from boneist_test
      where rownum = 1;
    end test2;
    begin
      test1;
    end;
    begin
      test2;
    end;
    alter table boneist_test add (col3 number);
    begin
      test1;
    end;
    begin
      test2;
    end;
    drop table boneist_test;
    drop procedure test1;
    drop procedure test2;

  • Select Expert or SQL Expression Fields help

    I am trying to do something I would consider very simple but can figure it out.
    I have two tables.  FDC_Trips & Facility.  On the report I can get the FDC_Trips.DivertedbyFacility field to populate a number value because that field is an integer.  But we need the name to show up.  That field is the ID (foreign key) of a Facilty which matches with the field Facility.Code.  Instead of it displaying the DivertedbyFacility number/ID I would like it to be able to show the Facility.Name value.  If I place the filed Facility.Name field on my report it is blank. 
    How can I write a where clause to query the Name of the Facility where the Facility.Code = FDC_Trips.DivertedbyFacility?
    Do I use the Select Expert or SQL Expression Fields.
    Please advise.

    Actually you'll use the Links tab in the Database Expert. If CR did it's stupid auto linking thing... delete them. It usually get's it wrong.
    Now just link the fk field in FDC_Trips to the pk field in Facility. Once you have that done you'll be able to simply drop Facility.FacilityName directly onto the report.
    HTH,
    Jason

  • Select works with SQL Server but not with Oracle!

    Hello
    this select works on SQL Server correct, but it don't work on Oracle!
    Can someone help me?
    Select * from Tabelle, Tabelle as XXX Where Tabelle.ID=XXX.IDTabelle
    Thanks
    Thomas

    Hi,
    These are the things which I have noticed, which wont work in Oracle ..
    Table As XXX ?? Are you giving alias name for the table .. The syntax which you have givne doesnt work in Oracle
    Regards

  • How to do Multi Cell Selection in JTable

    Dear Friends,
    Any body know Multi cell selection in jtable......
    Thanks

    Try overriding the changeSelection(....) method of JTable.
    public void changeSelection(int row, int column, boolean toggle, boolean extend)
         if (d.after(currentDate)
              super.changeSelection(row, column, toggle, extend);
    }

  • Help implementing mouse multi record select deselect with shift/ctrl click

    Forms 10.1.2.3 on Solaris Sparc 64 bit
    We are trying to implement mouse multi record select/deselect using shift and ctrl click. I have read that you need the appcore library to do this but because we aren't using Oracle Applications (EBS) we can't have the appcore library.
    Has anyone implemented this function without the appcore library?
    Thanks

    Why not just use a CheckBox to indicate the selected records? The downfall to almost all methods is that you end up looping through the block to see which records are selected. An alternative to this is to use a record group to record which the selected records. I created a nice little wrapper package to work with Record Groups (RG). Take a look at Forms - Record Group Processing (Duplicate Value Checking). As the name suggests, this example demonstrates how to use an RG to perform duplicate checking, but you can easily adapt the process to keep track of selected records. I use RG's for this all the time. By using the RG, it eliminates the need to LOOP through the datablock - which can be very time consuming. Instead, you loop through the RG and only navigate to the specific records you need too in order to process that record. Looping through the RG is much faster than looping through the block - especially if you have a lot of records displayed in your block.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Multi track selection tool keabord shortcut

    I am aware that
    A = track selction tool
    holding down shift key make it multi track selection tool
    is there a shortkey for multi track selection tool without pressing all the time the shift key or how can i make a shortkey for that?
    thank you in advance
    (I make a mistake yesterday and i post that in cs5, 5,5 and 6 forum. I own a CS3 version)

    sorry if i miss something but cs3 doesn't have search in keaboard customization and i can't locate the Effect/Function until now... can you tell me in wich section is located? (Application, Panels, Tools and wich subcategory)
    thank you in advance

  • Video editing: multi-frame selections ?

    Hi All!
    A few weeks I saw a video online that showed how to select a shape in one video frame and then spread that selection to that same shape in consecutive videos frames and then apply an adjustment to that multi-frame selection. But for my life I can't find that video again, and I know I wasn't dreaming.
    And I'm almost as sure that it was about Photoshop video editing, but poking all around Ps I can't find how to do it, nor is googing finding any clues. At the least I'm sure it was in an Adobe program, if not Ps, as I believe I saw it on Adobe TV.
    The video showed editing of video footage of a woman in a flower shop, and the project was darkening a too-bright porcelin bowl in the foreground.
    Any help much appreciated!

    Do you have Photoshop Extended?  There are more video capabilities in the more expensive Extended edition.
    I don't do video so I can't speak to your specific questions.
    -Noel

  • Using Multi Select List in SQL Query

    Hi all,
    I am trying to using a Multi Select list for filtering of a report. I have :P2_RISK_SEVERITY which has has the possibility of values Very Low:Low:Medium:High:Very High. How do I use this Multi Select in the where section of a SQL query?
    I need to say something along the lines of:
    Select RISK_SEVERITY from TBL_RMD_RISKS where RISK_SEVERITY = (one of the options selected in the multi select)
    Thanks for the help.

    Hi there,
    The above suggestion will work perfectly as long as the table you're querying is relatively small, but keep in mind that applying the INSTR to the left side of the WHERE clause will always result in a full table scan. This means that if your table is large and RISK_SEVERITY is indexed, the index will never be used. Here is another approach (credit to AskTom) that converts your colon-delimited string of selected values to a list that can be used in an "IN(...)" clause, which will use an index on RISK_SEVERITY as long as the optimizer otherwise deems it appropriate:
    -- creates a type to hold a list of varchars
    CREATE OR REPLACE TYPE vc2_list_type as table of varchar2(4000);
    -- converts a colon-delimited string of values to a list of varchars
    CREATE OR REPLACE FUNCTION vc2_list(p_string in varchar2)
       return vc2_list_type is
       l_string       long default p_string || ':';
       l_data         vc2_list_type := vc2_list_type();
       n              pls_integer;
    begin
       loop
          exit when l_string is null;
          n := instr(l_string, ':');
          l_data.extend;
          l_data(l_data.count) := ltrim(rtrim(substr(l_string, 1, n - 1)));
          l_string := substr(l_string, n + 1);
       end loop;
       return l_data;
    end vc2_list;
    -- your WHERE clause
    where risk_severity in(
             select *
               from the(select cast(vc2_list(:P2_RISK_SEVERITY) as vc2_list_type)
                          from dual))
    ...Hope this helps,
    John

  • SQL Server Reporting Services Multi Color selection

    Hi to All.
    iam trying to use this swicth condition in SSRS for multi color view. But its not getting can u suggest me 
    =switch(Fields!AVGSALES.Value<2000 ,"red",Fields!AVGSALES.Value<5000, "blue", Fields!AVGSALES.Value>5000,"yellow"

    Hi pullela venu,
    Based on your description, your switch condition in SSRS don’t work ,right?
    I have tested on my local environment and it works fine, so your problem may due to the conditions of different colors, for example, you haven’t include the value of 2000 and 5000,If the AVGSALES value is 2000 or 5000, this expression will not work, and
    you can also check you have put the expression in the right place, Please check details below one by one to make sure you have done the right:
    1.  Did you want to specify three different colors for three different ranges of values like below?
    Fields!AVGSALES.Value<2000(red)
    Fields!AVGSALES.Value=<2000 and Fields!AVGSALES.Value<5000(blue)
    Fields!AVGSALES.Value>=5000(yellow)
    If the above ranges of value is correct you can modify the switch function in the expression as below:
    =switch(Fields!AVGSALES.Value=<2000 ,"red", Fields!AVGSALES.Value>2000 and Fields!AVGSALES.Value<5000,"blue",Fields!AVGSALES.Value>=5000,"yellow")
    2.  Select the textbox of “AVGSALES” in the properties window and select the expression of color to add the switch function above.
    If you still have any question, please feel free to ask.
    Regards
    Vicky Liu

  • How to pass multi value selection parameter to SAP Function Module?

    Hi ,
    Anyone know how to pass CR multi value parameter - array to SAP Function module ?
    eg  multi selection of customer in CR
    and then pass to Function module
    in SAP FM,  the SQL select these customer only
    How should the import parameter / table of SAP Function module designed?
    and how should CR pass the data to SAP FM
    thx
    John

    Moved to Integration Kit forum

Maybe you are looking for