Pipeline function raised ORA-06519: active autonomous transaction detected

Hi All,
My name is John and I've got a problem which I need to share with all of you guru and experts. I've created the following pipeline function under the Oracle user ABC:
CREATE OR replace FUNCTION SomeFunction(p_from_date DATE, p_to_date DATE) RETURN T_TAB_A pipelined
IS
PRAGMA autonomous_transaction;
BEGIN
DELETE FROM temp_rcm;
INSERT INTO temp_rcm
SELECT * FROM int.facility fd,
int.capacity co
WHERE co.resource_name = fd.resource_name
AND co.trade_date = fd.trade_date
AND co.trade_date BETWEEN p_from_date AND p_to_date;
COMMIT;
FOR rec IN (SELECT co.*
FROM temp_rcm co
left join int.outage o
ON ( o.flag = 'Y'
AND o.reason_flag = 'F'
AND o.INTERVAL = co.INTERVAL
AND co.resource_name = o.resource_name )
ORDER BY co.INTERVAL,
co.name) LOOP
pipe ROW (T_A( rec.INTERVAL, rec.trade_date,
rec.resource_name,rec.day_of_week_long, rec.working_day, rec.peak));
END LOOP;
RETURN;
END SomeFunction;
I was able to compile and create the SomeFunction function successfully but when I executed it using the following command:
select * from table(SomeFunction(to_date('01/01/2010',to_date('01/01/2010')));
I was returned with the Oracle error - ORA-06519: active autonomous transaction detected and rolled back
I have searched through the web, such Oracle error occurs whenever the function has a missing 'COMMIT' or 'ROLLBACK' command inside an autonomous_transaction. But the fact is I have already included the 'COMMIT;' in the function. I suspected that the error was caused by the tables which I queried against (like int.facility and int.capacity) were all views that belonged to another schema called int. Or is that something that I miss in the function? Thank you for your time and assistance.
Regards,
John

johnwanng wrote:
Hi Guys,
Thank you for all your feedback. In addition to your reply, Bill, can you spare some time and provide us a simple example of the steps involved to implement the 'correct' implementation based on the queries that I've used. As I do not understand your vanilla approach. Much appreciated and thank you for the time again.
Regards,
JohnIf I had to guess, Billy may have meant something like this (untested):
CREATE OR REPLACE FUNCTION SomeFunction
( p_from_date IN int.facility.trade_date%TYPE
, p_to_date   IN int.facility.trade_date%TYPE
RETURN SYS_REFCURSOR
AS
     rcur     SYS_REFCURSOR;
BEGIN
     OPEN rcur FOR
          SELECT co.interval
               , co.trade_date
               , co.resource_name
               , co.day_of_week_long
               , co.working_day
               , co.peak
          FROM   int.capacity co
          JOIN   int.facility fd        ON fd.resource_name = co.resource_name
                                       AND fd.trade_date    = co.trade_date
          LEFT OUTER JOIN int.outage o  ON o.interval       = co.interval
                                       AND o.resource_name  = co.resource_name
          WHERE  co.trade_date BETWEEN p_from_date AND p_to_date
          AND    o.reason_flag = 'F'
          AND    o.flag        = 'Y'
          ORDER BY co.interval
                 , co.name
     RETURN rcur;
END;
/I made the following modifications:
1. I set the input parameter data types to match that of the table column you are checking against. A good practice to get into.
2. Removed the autonomous transaction and inserting into a temp table. In Oracle it's a good practice to perform everything in a single SQL statement if possible.
3. Changed the return data type to a SYS_REFCURSOR
Hope this helps and provides a good example.

Similar Messages

  • ORA-06519: active autonomous transaction detected and rolled back

    I am getting this error. when i am doing insert from my package Any solution to reslove this issue
    ORA-06519: active autonomous transaction detected and rolled back . thanks
    I am doing select - insert...

    Also, if you have any exception handler sections in the code,
    then you have to add a commit or rollback statement for
    every exception that is handled.

  • DBMS Job failing with "active autonomous transaction detected"

    Hi,
    I am posting this for a customer issue. I posted this in the PL/SQL forum and was suggested to post it in this forum as this is a portal provided code.
    DBMS Job WWV_context is failing after install of 10.1.2.0.2 MR Repo install
    ORA-12012: error on auto execute of job 357~ORA-06510: PL/SQL: unhandled user-defined exception~ORA-06512: at "PORTAL.WWERR_API_EXCEPTION", line 71~ORA-06512: at "PORTAL.WWV_CONTEXT", line 1757~ORA-06510: PL/SQL: unhandled user-defined exception~ORA-06512: at "PORTAL.WWERR_API_EXCEPTION", line 71~ORA-06512: at "PORTAL.WWV_CONTEXT", line 1837~ORA-06519: active autonomous transaction detected and rolled back~ORA-06512: at line 1
    Thanks
    Sathya

    Hi,
    I am posting this for a customer issue. I posted this in the PL/SQL forum and was suggested to post it in this forum as this is a portal provided code.
    DBMS Job WWV_context is failing after install of 10.1.2.0.2 MR Repo install
    ORA-12012: error on auto execute of job 357~ORA-06510: PL/SQL: unhandled user-defined exception~ORA-06512: at "PORTAL.WWERR_API_EXCEPTION", line 71~ORA-06512: at "PORTAL.WWV_CONTEXT", line 1757~ORA-06510: PL/SQL: unhandled user-defined exception~ORA-06512: at "PORTAL.WWERR_API_EXCEPTION", line 71~ORA-06512: at "PORTAL.WWV_CONTEXT", line 1837~ORA-06519: active autonomous transaction detected and rolled back~ORA-06512: at line 1
    Thanks
    Sathya

  • Adding #FROM_ROLE TO wf_notifications.send is giving error :active autonomous transaction detected and rolled back

    Hello all,
    I'm using the below code to send the notication using plsql package. It works fine and sends notification if i don't use '#FROM_ROLE' and 'SENDER' attributetext in the code. If i use them, i get the error message. Please advice
        L_MESSAGE_TYPE := 'WFMAIL';
        L_MESSAGE_NAME := 'OPEN_MAIL_FYI';
        L_NID          := WF_NOTIFICATION.SEND(UPPER(P_USER_NAME),
                                               L_MESSAGE_TYPE,
                                               L_MESSAGE_NAME);
        WF_NOTIFICATION.SETATTRTEXT(L_NID, 'SUBJECT', P_SUBJECT);
        WF_NOTIFICATION.SETATTRTEXT(L_NID, 'BODY', P_TEXT_BODY);
        WF_NOTIFICATION.SETATTRTEXT(L_NID, '#FROM_ROLE', 'USERNAME1'); 
        WF_NOTIFICATION.SETATTRTEXT(L_NID, 'SENDER', 'USERNAME1');
        WF_NOTIFICATION.DENORMALIZE_NOTIFICATION(L_NID);
    Thanks
    KK

    Hi KK,
    What error you are getting when you set the attributes '#FROM_ROLE' and 'SENDER'?
    when you set '#FROM_ROLE' then  Wf_Notification.Denormalize_Notification(nid) API will be called.  If the attribute is 'sender' then event 'oracle.apps.wf.notification.setattrtext wll be rasied.

  • ORA-06519 while doing transactions

    Hi,
    I have created a trigger on my transaction table. When a service is booked it is being inserted into two seperate tables. It is working fine, but at some times I am getting following error while recording the transactions.
    ORA-06519 Active autonomous transactions detected and rolled back.
    Following is the trigger code:
    create or replace trigger glstrip_audit
    after INSERT or update ON jeevadb.ipservice
    for each row
    declare
    pragma autonomous_transaction;
    nurstcode pbswardmast.nurstcode%type;
    roomno pbsipregist.currroomno%type;
    BEGIN
    select b.nurstcode,a.currroomno into nurstcode,roomno from pbsipregist a,pbswardmast b where a.currroomno=b.wardno and a.regno=:new.ipno;
    if :new.servcode='006013' then
    if inserting then
    insert into phindenthd(indentno,indentdate,indenttime,regno,storecd,nurstcode,doctcode,userid,edituser,editdate,status)
    values (:new.servslno,:new.servdate,:new.servtime,:new.ipno,'94',nurstcode,:new.orderedby,:new.createdby,:new.editedby,:new.editedon,'P');
    insert into phindentdt(indentno,itecode,indentqty)
    values (:new.servslno,'OPTGS01',:new.servqty);
    elsif updating then
    update phindenthd set indentno=:old.servslno,indentdate=:old.servdate,indenttime=:old.servtime,regno=:old.ipno,
    storecd='94',nurstcode=nurstcode,doctcode=:old.orderedby,userid=:old.createdby,edituser=:new.editedby,editdate=:new.editedon,status='P'
    where regno=:old.ipno and indentno=:old.servslno;
    update phindentdt set indentno=:old.servslno,itecode='OPTGS01',indentqty=:new.servqty where indentno=:old.servslno;
    end if;
    end if;
    end;
    can you help me in finding the problem?
    thanks
    satya

    Hi and welcome to the forum.
    "ORA-06519: active autonomous transaction detected and rolled back
    Cause: Before returning from an autonomous PL/SQL block, all autonomous transactions started within the block must be completed (either committed or rolled back). If not, the active autonomous transaction is implicitly rolled back and this error is raised.
    Action: Ensure that before returning from an autonomous PL/SQL block, any active autonomous transactions are explicitly committed or rolled back"
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10880/e4100.htm#sthref2110
    As mentioned by Bartek, Justin and Adrian you've probably forgotten to commit your autonomous transaction and you're abusing the automomous transaction here, don't use 'autonomous triggers', they're nothing but bugs in your code.
    My $0.02: you're trying to avoid a mutating table error.
    If so, then see: http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551198119097816936
    (Here you can read more FAQ's: http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyte.html )
    and:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2212445691154

  • Why ORA-06519 ?

    I have shown my proc at high level below. While executing this proc for some reason i get Primary key violation on table my_tab_mf during insert, so the procedure as expected jumps to EXCEPTION block. When it comes to proc My_PKG_MF.LOG_ERROR in the exception block i get the error: ORA-06519: active autonomous transaction detected and rolled back. The proc My_PKG_MF.LOG_ERROR is an autonomous proc which has COMMIT inside it. Can somebody help me understand why i get this error though i have a COMMIT in the autonomous proc? The proc My_PKG_MF.LOG_ERROR calls another proc: MASTER.my_pkg_master.log_db_err in another schema called MASTER.
    Im in 10gR2 version.
    procedure proc_mf
    as
    v_proc_name varchar2(50) := 'proc_mf';
    Err_Code varchar2(50);
    Err_Desc varchar2(500)
    begin
    delete from table my_tab_mf;
    insert into my_tab_mf (col1,col2)
    select col1, col2 from a,b;
    EXCEPTION
    WHEN OTHERS
    THEN
           ROLLBACK;
           Err_Code := SQLCODE;
           Err_Desc := SUBSTR(SQLERRM, 1, 256);
           My_PKG_MF.LOG_ERROR(v_proc_name
                                             ,To_Char(Err_Code)
                                             ,Err_Desc
    end proc_mf;
    -- Contents of AUTONOMOUS proc My_PKG_MF.LOG_ERROR
    procedure LOG_ERROR(proc_name in varchar2 ,err_code in varchar2 ,err_desc in varchar2)
    is
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
    --logging the error into the log table
    insert into my_log_mf
    values(proc_name ,err_code,err_desc);
    --calling another Error logging proc which is in another schema called Master
    MASTER.my_pkg_master.log_db_err(proc_name ,err_code,err_desc);
    COMMIT;
    end LOG_ERROR;Edited by: michaelrozar17 on Mar 20, 2013 2:31 AM

    MASTER.my_pkg_master.log_db_err is not an autonomous proc and it does not have a commit in it. The calling autonomous procedure My_PKG_MF.LOG_ERROR has commit in it, which commits the transaction happened in MASTER.my_pkg_master.log_db_err.
    -- Contents of MASTER.my_pkg_master.log_db_er
    procedure log_db_er(proc_name in varchar2 ,err_code in varchar2 ,err_desc in varchar2)
    as
    begin
    insert into master_err_log(col1, col2,col3)
    values(proc_name,err_code ,err_desc );
    end log_db_er;

  • Is commit necessary to end autonomous transaction?

    CREATE OR REPLACE TRIGGER TRIG_EMP
    AFTER UPDATE
    ON EMP
    FOR EACH ROW
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    CNT NUMBER := 0 ;
    BEGIN
    --PROCE_TRIG_TEST_EMP;
    SELECT COUNT(*)
    INTO CNT
    FROM EMP;
    UPDATE EMP_bkp
    SET COMM=999
    WHERE ENAME ='SMITH';
    -- COMMIT;
    DBMS_OUTPUT.put_line('TRIG_EMP CALLED.. DONE: '||CNT);
    END;
    Error: "autonomous transaction detected "
    if i open update n block commit code then error.
    if i block both update n commit code then without commit code is running fine.
    My Ques: If commit is necessary to end autonomous transaction then when i m blocking update n commit lines then too running without above error?
    plz clear my concept..
    pc

    PC wrote:
    thanks ..I will take care of it i.e. "IM".
    In above code when I am blocking both "update & commit code lines" then there is no error raised by program.
    I am using commit when I need that my "update transaction must be commit",if I am only taking "count of table emp" then no need of commit...
    Like this I am not getting any exception..!Doing anything on the same table that caused the trigger to fire can lead to you getting a mutating table error, so care should be taken in that respect.
    I got your point that I must commit and I will use it but here if I am using autonomous transaction without commit then I must get error but I am not facing ..plz guide me againThe point of an autonomous transaction is to effectively make Oracle spawn off a seperate transaction. Usually we consider that we have just a single transaction per session at any one time, but there are times, like when we need to log errors or audit something, that we want to ensure something get's written to a table, even if the transaction we are in needs to be rolled back or is about to raise an exception. In such cases we use an autonomous transaction to spawn the seperate transaction to perform that task. Good design would have that autonmous transaction as a seperate procedure to be called (rather than in the trigger itself) to keep it completely seperate from the current transaction, and thus when that seperate procedure finishes, any changes it has made must be committed or rolled back because the autonomous transaction that has been spawned is about to finish. Of course, if that procedure doesn't actually do any work on the database that requires committing or rolling back, then it's not necessary to issue one, but then there would be no need for an autonomous transaction in the first place.
    So, with your trigger (let's ignore that fact that making the trigger autonomous is p!ss poor design), if you only do the count and don't do the update statement, then there is nothing to be committed, so there's no need for a commit statement, even if the trigger is defined as an autonomous transaction. But, if you include the update statement, then that spawned transaction must be committed before the trigger ends, so that the transaction is completed and control can return to the calling transaction. So, making your trigger autonomous doesn't mean that it must commit by itself... but making it autonomous and including something that needs committing, does mean it must commit.

  • Ora 02290 when using qms_transaction_mgt and autonomous transactions

    Hi all,
    I'm using the qms procedures:
    qms_transaction_mgt for openeing and closing transactions.
    Somewhere in my procedure when the transaction is opened i call another procedure which contains a autonomous transaction.
    The next time qms_transaction_mgt.close_transaction is called i get an ORA-02290: check constraint (HST65.QMS_NEED_TO_CLOSE_TRANSACTION) violated
    When i debug the qms_transaction_mgt.close transaction the g_current_trans_id variable is empty, which indicates the transaction is allready closed.
    When i remove the pragma autonomous_transaction statement and the commit statement from the procedure i call, the problem is resolved.
    Version information:
    Designer 9.0.2 with a with a Oracle 9i 9.2 database and Headstart 9i.
    Does anybody know how i can resolve this or if this is a bug and how to fix it?
    Thanks,
    Yvon

    Ian, Yvon,
    It is unfortunately a know restriction that the CDM RuleFrame component of both Headstart for Designer 6i and Headstart for Designer 9i doesn't work in combination with autonomous transactions.
    The reason is that the RuleFrame administration relies on information stored in 1. pl/sql package variables and 2. database tables. Using autonomous transactions (that involve CDM RuleFramed DML) causes this information to dissynchronize.
    A year ago I investigated the possibilities to make autonomous transactions possible with RuleFrame but unfortunately this is fundamental problem: RuleFrame wants to combine multiple DML-actions into one logical transaction (gards this with the "need_to_close_transaction" constraint), while autonomous transactions intend to to the opposite: commit a part of a transaction while the rest of the transaction still is posted/not committed.
    There is one exception: if you call an atonomous procedure that does DML on a non-ruleframe-enabled table (no TAPI triggers that intend to open/close the transaction, no CAPI etc), everything functions.
    Problem explanation:
    ====================
    1. Outer transaction is opened (by front end or TAPI triggers of first DML)
    2. DML takes place
    3. Autonomous transaction-procedure is called
    4. Auto-transaction again tries (and succeeds!) to open the transaction, it doesn't see that the transaction is opened (db table qms_transactions is empty for the autonomous transaction on query)
    5. DML within auto-transaction is posted
    6. Auto-transaction closes transaction
    7. Auto-transaction is committed
    8. Outer transaction thinks the transaction is already closed, because the auto-transaction cleaned out the package variables when it closed the transaction.
    9. Commit of the outer transaction fails as the deferred check constraint need_to_close_transaction avoids this to happen (rollback takes place because of this violation).
    Hope this helps
    Kind Regards
    Marc Vahsen
    Headstart Team Oracle NL

  • List View Report with pipelined function in Mobile application and ORA-01007: variable not in select list

    Hi!
    I have a problem with List View Report in mobile application (theme 50 in apex) after updating to apex 4.2.2. I created Report -> List View. I used select from pipelined function in Region Source. Then when page is running and submited three times (or refreshed three times) I get an error:
    Error during rendering of region "LIST VIEW".
    ORA-01007: variable not in select list
    Technical Info (only visible for developers)
    is_internal_error: true
    apex_error_code: APEX.REGION.UNHANDLED_ERROR
    ora_sqlcode: -1007
    ora_sqlerrm: ORA-01007: variable not in select list
    component.type: APEX_APPLICATION_PAGE_REGIONS
    component.id: 21230833903737364557
    component.name: LIST VIEW
    error_backtrace:
         ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613
         ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
    I get this error only when I use select from pipelined function in Region Source (for example: "select value1, value2 from table(some_pipelined_function(param1, param2)) ").
    You can check it on http://apex.oracle.com/pls/apex/f?p=50591 (login - demo, password - demo).
    In this application:
    - I created package TAB_TYPES_PKG:
    create or replace PACKAGE TAB_TYPES_PKG IS
    TYPE cur_rest_r IS RECORD (
        STR_NAME          VARCHAR2(128),
        INFO              VARCHAR2(128)
    TYPE cur_rest_t IS TABLE OF cur_rest_r;
    END TAB_TYPES_PKG;
    - I created pipelined function TEST_FUNC:
    create or replace
    FUNCTION TEST_FUNC
    RETURN TAB_TYPES_PKG.cur_rest_t  PIPELINED IS
    r_cur_rest TAB_TYPES_PKG.cur_rest_r;
    BEGIN
    r_cur_rest.STR_NAME := 'ROW 1';
    r_cur_rest.INFO := '10';
    PIPE ROW (r_cur_rest);
    r_cur_rest.STR_NAME := 'ROW 2';
    r_cur_rest.INFO := '20';
    PIPE ROW (r_cur_rest);
    r_cur_rest.STR_NAME := 'ROW 3';
    r_cur_rest.INFO := '30';
    PIPE ROW (r_cur_rest);
    r_cur_rest.STR_NAME := 'ROW 4';
    r_cur_rest.INFO := '40';
    PIPE ROW (r_cur_rest);
    r_cur_rest.STR_NAME := 'ROW 5';
    r_cur_rest.INFO := '50';
    PIPE ROW (r_cur_rest);
    RETURN;
    END TEST_FUNC;
    - I created List View Report on Page 1:
    Region Source:
    SELECT str_name,
           info
    FROM TABLE (TEST_FUNC)
    We can see error ORA-01007 after refresing (or submiting) Page 1 three times or more.
    How to fix it?

    Hi all
    I'm experiencing the same issue.  Predictably on every third refresh I receive:
    Error
    Error during rendering of region "Results".
    ORA-01007: variable not in select list
    Technical Info (only visible for developers)
    is_internal_error: true
    apex_error_code: APEX.REGION.UNHANDLED_ERROR
    ora_sqlcode: -1007
    ora_sqlerrm: ORA-01007: variable not in select list
    component.type: APEX_APPLICATION_PAGE_REGIONS
    component.id: 6910805644140264
    component.name: Results
    error_backtrace: ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613 ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
    OK
    I am running Application Express 4.2.2.00.11 on GlassFish 4 using Apex Listener 2.0.3.221.10.13.
    Please note: this works perfectly using a classic report in my desktop application; however, no joy on the mobile side with a list view.  I will use a classic report in the interim.
    My region source is as follows:
    SELECT description AS "DESCRIPTION", reference AS "REFERENCE" FROM TABLE(AUTOCOMPLETE_LIST_VIEW_FNC('RESULTS'))
    The procedure:
      FUNCTION AUTOCOMPLETE_LIST_VIEW_FNC(
          p_collection_name IN VARCHAR2)
        RETURN list_row_table_type
      AS
        v_tab list_row_table_type := list_row_table_type();
      BEGIN
        DECLARE
          jsonarray json_list;
          jsonobj json;
          json_clob CLOB;
        BEGIN
          SELECT clob001
          INTO json_clob
          FROM apex_collections
          WHERE collection_name = p_collection_name;
          jsonobj              := json(json_clob);
          jsonarray            := json_ext.get_json_list(jsonobj, 'predictions');
          FOR i IN 1..jsonArray.count
          LOOP
            jsonobj := json(jsonArray.get(i));
            v_tab.extend;
            v_tab(v_tab.LAST) := list_row_type(json_ext.get_string(jsonobj, 'description'), json_ext.get_string(jsonobj, 'reference'));
          END LOOP;
          RETURN(v_tab);
        END;  
      END AUTOCOMPLETE_LIST_VIEW_FNC;
    Thanks!
    Tim

  • ORA-22905 with pipelined function

    Hi,
    I have a strange behaviour that I do not understand.
    The code below does not work. It gives me the following errors:
    ORA-22905: cannot access rows from a non-nested table item
    ORA-06512: at line 10
    ORA-06512: at line 19
    The problem comes from the line 14 in that function
    adm_usergroup.GET_GROUPIDS (userid_in)
    If I replace the variable userid_in by its values then it perfectly works.
    Can someone give me an explanation ?
    The adm_usergroup.GET_GROUPIDS (userid_in) is a pipelined function that querry a group of tables and return IDs which are number.
    A call to the function works fine as using it directly in a select statement.
    Cheers,
    Sebastien
    1 DECLARE
    2 l_groups AUTH_TYPE.GROUP_RT;
    3 l_groups_rec authgroup%ROWTYPE;
    4
    5 FUNCTION GET_GROUPS (userid_in IN AUTHUSER.USERID%TYPE)
    6 RETURN AUTH_TYPE.GROUP_RT
    7 IS
    8 l_groups_rt AUTH_TYPE.GROUP_RT;
    9 BEGIN
    10 OPEN l_groups_rt FOR
    11 SELECT ag.*
    12 FROM authgroup ag
    13 WHERE AG.GROUPID IN
    14 (SELECT * FROM table (adm_usergroup.GET_GROUPIDS (userid_in)));
    15
    16 RETURN l_groups_rt;
    17 END GET_GROUPS;
    18 BEGIN
    19 l_groups := GET_GROUPS (1);
    20
    21 LOOP
    22 FETCH l_groups INTO l_groups_rec;
    23
    24 EXIT WHEN l_groups%NOTFOUND;
    25 DBMS_OUTPUT.put_line ('ID: ' || l_groups_rec.groupid);
    26 END LOOP;
    27
    28 CLOSE l_groups;
    29 END;

    by the way here is the full code
    CREATE OR REPLACE PACKAGE AUTHDB.ADM_USERGROUP
    IS
       -- get the group and sub-group ids of a given user id
       FUNCTION get_groupids (userid_in IN AUTHUSER.USERID%TYPE)
          RETURN authgroup_set
          PIPELINED;
    END;
    CREATE OR REPLACE PACKAGE BODY AUTHDB.ADM_USERGROUP
    IS
    FUNCTION get_groupids (userid_in IN AUTHUSER.USERID%TYPE)
          RETURN authgroup_set
          PIPELINED
       IS
          CURSOR group_cur
          IS
             SELECT   mo.groupid
               FROM   memberof mo
              WHERE   MO.USERID = userid_in
             UNION
                 SELECT   gh.groupid
                   FROM   GROUPHIERARCHY gh
             CONNECT BY   PRIOR GH.GROUPID = GH.PARENTGROUP_ID
             START WITH   GH.PARENTGROUP_ID IN (SELECT   mo.groupid
                                                  FROM   memberof mo
                                                 WHERE   MO.USERID = userid_in);
       BEGIN
          FOR rec IN group_cur
          LOOP
             PIPE ROW (authgroup_type (REC.GROUPID));
          END LOOP;
       END;
    END;
    CREATE OR REPLACE
    TYPE        AUTHDB.AUTHGROUP_TYPE AS OBJECT (GROUPID NUMBER (10));
    CREATE OR REPLACE
    TYPE        AUTHGROUP_SET AS TABLE OF authgroup_type;
    DECLARE
       l_groups       AUTH_TYPE.GROUP_RT;
       l_groups_rec   authgroup%ROWTYPE;
       FUNCTION GET_GROUPS (userid_in IN AUTHUSER.USERID%TYPE)
          RETURN AUTH_TYPE.GROUP_RT
       IS
          l_groups_rt   AUTH_TYPE.GROUP_RT;
       BEGIN
          OPEN l_groups_rt FOR
             SELECT   ag.*
               FROM   authgroup ag
              WHERE   AG.GROUPID IN
                            (SELECT   * FROM table (cast(adm_usergroup.GET_GROUPIDS (userid_in) as authgroup_set)));
          RETURN l_groups_rt;
       END GET_GROUPS;
    BEGIN
       l_groups := GET_GROUPS (1);
       LOOP
          FETCH l_groups INTO   l_groups_rec;
          EXIT WHEN l_groups%NOTFOUND;
          DBMS_OUTPUT.put_line ('ID: ' || l_groups_rec.groupid);
       END LOOP;
       CLOSE l_groups;
    END;

  • ORA-00164: autonomous transaction disallowed within distributed transaction

    I have been trying to solve this problem for weeks now, I have posted this question everywhere I can think of, but I havent really received and answer that has helped, so now I am going to post it here hoping for an answer.
    We are running 9iAS on Solaris and when the following stuff is run we are getting ORA-00164 errors. If you refresh the page a bunch of time the problem goes away. But it comes back the next time you try to execute the procedure again. Here are the cases when the problem shows up.
    Editing the style:
    PROCEDURE : PORTAL30.wwpob_app_style.edit_style
    Saving changes to the banner for a page
    PROCEDURE : PORTAL30.wwptl_banner.savecustom
    Logging out
    PROCEDURE : PORTAL30.wwsec_app_priv.logout
    After setting the default user group and applying the changes:
    PROCEDURE : PORTAL30.wwsec_app_user_mgr.edit_user
    Creating a new group:
    PROCEDURE : PORTAL30.wwsec_app_group_mgr.create_group
    Opening the add portlet screen:
    PROCEDURE : PORTAL30.wwv_main.main
    There are a few other places but I don't have them documented. In ALL cases the problem goes away once we start and stop the Apache using the following comands:
    /app/oracle/n_portal/Apache/Apache/bin/apachectl stop
    ps -ef | grep httpd | grep n_portal
    /app/oracle/n_portal/Apache/Apache/bin/apachectl start
    After starting and stopping Apache the problem is gone for a little while (20-30 mins) then it starts coming back slowly (sometimes the problem is there then it is not). Once the problem is back if you continually press refresh on the browser (5-10 times) the page might appear, if the page does not appear you will see the
    ORA-00164: autonomous transaction disallowed within distributed transaction
    The following error appears in apache log (50% of the time) when Autonomous Transaction error shows up on the screen:-
    DSHttpSessionBindingListenerImpl.valueUnbound : closing DS session : DSSession id = 5225534324468880950975536484
    215 PortalSession id = 521335001720MERAJ
    DSHttpSessionBindingListenerImpl.valueUnbound : closing DS session : DSSession id = -638034231325135430097553725
    8001 PortalSession id = 992335001711JDALGLIESH
    These errors might be related to dynamic services but we were had the problem long before Dynamic services was installed.
    We want to start pre-production user testing as we have just had 11 developers building portlets for the company, but we cant do much with this error popping up every time a user wants to test it. We have one of the Oracle consultants here and he has asked the oracle developer group what the problem could be, and they seem to think it might be related to our use of DB links however, we never get the problem when we try to run a portlet that uses a database link.
    Please help.
    Jeff Dalgliesh
    null

    Jay,
    My name is Craig McCauley. I'm an Oracle Technical Manager working onsite at Unocal Indonesia. I'm with the Portal group in ATS.
    When I got here the first thing we did was bump up init.ora parameters and apache confif parameters as suggested by the iPlatform group. We have thes sessions parameter (in init.ora) bumped up from 100 to 700. I'm watching v$session and the get these AT messages with as few as 70 total db sessions. Any help your group can give will be greatly appreciated.
    Unocal is planning on implementing Oracle Portal globally - as a common interface. They have similar installs in Thailand and Houston and thus far have not seen the AT messages (although there has not been much development going on at those sites).
    Thanks,
    Craig

  • ORA-00164 Autonomous Transactions in Distributed Env

    Hi,
    We are on 8.1.7 on AIX. We get ORA-00164 when we attempt to call an Autonomous transaction procedure whilst the main transaction has read a remote table.
    In 8.1.6.0.0 this used to check us out with Ora-600, In 8.1.7 it gives error 164. I have read some postings stating that this limitation is expected to be fixed in Oracle server 8.2 or Oracle 9i Release 2.
    Can somebody confirm this,
    BTW what would 9i Release 2 mean - 9.2 or 9.0.2 ?
    Also, is 8.2 out?
    null

    Is this question specific to Oracle9iAS Portal?

  • Pipelined function with Union clause(Invalid Number(ORA-01722) error )

    Hi,
    I have a pipelined function.
    I am fetching the data with the use of a REF cursor.
    The query has two part: query1 and query2
    when I am opeing the cursor with query1 UNION query2,it is giving me Invalid Number(ORA-01722) error.
    but when I open the cursor separately for query1 and query2,I am getting the resultset for each of the query.
    query1 and query2 are running fine with UNION in the sql editor.
    But,when I put them into two variables (var1 :='query1' and var2:='query2' and try to open the cursor with var1 UNION var2 , it's giving me the error.
    But when I put query2 as 'Select ..... from dual' and then try to open the cursor for query1 UNION query2,
    then getting the result of query1 and one extra row for query2(dual).
    The FROM table set is same for query1 and query2..
    can anyone please help me , why this Invalid Number(ORA-01722) error is coming.

    query1 := 'SELECT to_char(st.store_no) STORE_NUMBER,pp.name PROGRAM_NAME, ''HBS'' DISPENSING_SYSTEM,
    pt.PATIENT_SRC_NO SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, pt.last_name PATIENT_LAST_NAME, pt.first_name
    PATIENT_FIRST_NAME, to_char(LPAD (pppd.rx_number, 7, '' '')|| ''-''|| LPAD (pppd.refill_number, 2, 0)) RX_REFILL
    FROM
    pega_patient_program_dispense pppd,pega_patient_program_reg pppr,health_care_profs hcp1,
    health_care_profs hcp2,prescription_dispenses pd,prescriptions p, pega_program_status_reason ppsr ,master_doctors md,
    prescription_disp_orders pdo, hbs_shipment_extract hse,stores st,master_stores ms,pega_programs pp,patients pt,master_patients mpt
    WHERE
    pppr.referring_hcp_id=md.id(+) and md.dispensing_system_id=hcp1.hcp_id and
    pppr.ID=pppd.PEGA_PATIENT_PROGRAM_REG_ID and pppd.prescription_dispense_id=pd.id and pd.prescriptions_id=p.id and
    p.hcp_id=hcp2.hcp_id and ppsr.ID=pppd.PEGA_PROGRAM_STATUS_REASON_ID and pppd.prescription_dispense_id = pdo.prescriptions_dispenses_id(+) AND
    pdo.shipment_number = hse.shp_no(+) and pppd.store_id=ms.id and st.id=ms.dispensing_system_id and pppr.pega_program_id=pp.id
    and pppr.patient_id=mpt.id and pt.patient_id=mpt.dispensing_system_id and pppd.dispensing_system=''HBS'' and pp.name LIKE ''REV%''
    AND
    ((pppd.prescription_dispense_id IS NOT NULL AND pppd.quantity_dispensed > 0 AND pppd.reported_date IS NULL AND
    pppd.src_delete_date IS NULL AND ((pppr.program_specific_patient_code IS NULL ) OR (hcp1.last_name IS NULL) OR
    (hcp1.first_name IS NULL) OR (hcp2.first_name IS NULL) OR (hcp2.last_name IS NULL) OR (hcp2.address_1 IS NULL) OR
    (hcp2.city IS NULL) OR (hcp2.state_cd IS NULL) OR (hcp2.zip_1 IS NULL)OR (pppr.referral_date is NULL) OR
    (hcp1.state_cd IS NULL) OR (hcp1.zip_1 IS NULL)
    OR (hcp2.zip_1 IS NULL) OR (pppr.last_status_change_date IS NULL) OR (pppr.varchar_1 IS NULL) OR
    (pppr.varchar_7 IS NULL OR pppr.varchar_7 LIKE ''NOT AVAILABLE AT REFERRAL%'') OR (pppr.varchar_5 IS NULL OR
    pppr.varchar_5 LIKE ''NOT AVAILABLE AT REFERRAL%'')) ) AND ppsr.INCLUDE_ON_EXCEPTION_RPT_IND=''Y'')
    OR
    ((pppd.authorization_number IS NULL OR NVL(TRUNC(pdo.shipped_date),TRUNC(hse.shp_act_date_dt)) NOT BETWEEN
    TRUNC(pppd.date_1) AND TRUNC(pppd.date_2)) OR (pppd.varchar_4 IS NULL OR NVL(TRUNC(pdo.shipped_date),
    TRUNC(hse.shp_act_date_dt)) NOT BETWEEN TRUNC(pppd.date_3) AND TRUNC(pppd.date_5)))
    OR
    (pppr.pega_program_competitors_id IS NULL AND (ppsr.manufacturer_status=''TRIAGE'' AND ppsr.manufacturer_reason=''COMPETITOR''))
    OR
    (ppsr.manufacturer_reason IS NULL)
    query2 := ' SELECT ''150'' STORE_NUMBER,''test'' PROGRAM_NAME , ''RX2000'' DISPENSING_SYSTEM
    ,''01'' SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, ''test'' PATIENT_LAST_NAME, ''test'' PATIENT_FIRST_NAME,
    ''rx01'' RX_REFILL
    FROM
    pega_patient_program_reg pppr,health_care_profs hcp1, pega_program_status_reason ppsr ,
    master_doctors md,stores st,master_stores ms,pega_programs pp,patients pt,master_patients mpt
    WHERE
    pppr.referring_hcp_id=md.id(+) and md.dispensing_system_id=hcp1.hcp_id and
    ppsr.ID=pppr.REFERRAL_STATUS_ID and st.store_type=''M'' and pppr.store_id=ms.id and st.id=ms.dispensing_system_id
    and pppr.pega_program_id=pp.id and pppr.patient_id=mpt.id and pt.patient_id=mpt.dispensing_system_id and pp.name LIKE ''REV%''
    AND
    ((((pppr.program_specific_patient_code IS NULL ) OR (hcp1.last_name IS NULL) OR (hcp1.first_name IS NULL) OR
    (pppr.referral_date is NULL) OR (hcp1.state_cd IS NULL) OR (hcp1.zip_1 IS NULL) OR (pppr.last_status_change_date IS NULL)
    OR (pppr.varchar_1 IS NULL) OR (pppr.varchar_7 IS NULL) OR (pppr.varchar_5 IS NULL OR pppr.varchar_5 LIKE
    ''NOT AVAILABLE AT REFERRAL%'')) ) AND ppsr.INCLUDE_ON_EXCEPTION_RPT_IND=''Y'')
    OR
    (pppr.pega_program_competitors_id IS NULL AND (ppsr.manufacturer_status=''TRIAGE'' AND ppsr.manufacturer_reason=''COMPETITOR''))
    OR
    (ppsr.manufacturer_reason IS NULL)
    AND
    pppr.id NOT IN(select pppd.PEGA_PATIENT_PROGRAM_REG_ID from PEGA_PATIENT_PROGRAM_DISPENSE pppd)';
    BUT IF I put
    query2 := ' SELECT ''150'' STORE_NUMBER,''test'' PROGRAM_NAME , ''RX2000'' DISPENSING_SYSTEM
    ,''01'' SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, ''test'' PATIENT_LAST_NAME, ''test'' PATIENT_FIRST_NAME,
    ''rx01'' RX_REFILL
    FROM DUAL';
    then it is giving result.

  • Autonomous Transactions & error ORA-01002

    Either there's a bug w/ Autonomous Transactions or the documentation is incomplete because the AT is not working when
    called from within Cursor Loop.
    here's the outline:
    CURSOR acct_cur IS ...FOR UPDATE OF a.account_nm...
    FOR acct_rec IN acct_cur LOOP
    fis_rte_util.print_msg (...) ---autonomous transaction writes to a logging table
    ---w/ commit
    UPDATE ca_account_t
    SET account_nm = acct_rec.account_nm....
    this update statement causes a ORA-01002: fetch out of sequence exception. if
    i comment out the print_msg line it works just fine. its as if the commit in the
    AT is causing the problem. according to the documention, there should be no
    interference between these 2 blocks.
    thanks for any info or insight,
    swg
    null

    Tim,
    Refer to the following:
    ORA-01002: fetch out of sequence
    Cause: This error means that a fetch has been attempted from a cursor which is no longer valid.
    Note that a PL/SQL cursor loop implicitly does fetches, and thus may also cause this error. There are a number of possible causes for this error, including:
    1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned.
    2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error.
    3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement.
    Action:
    1) Do not issue a fetch statement after the last row has been retrieved - there are no more rows to fetch.
    2) Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE.
    3) Reexecute the statement after rebinding, then attempt to fetch again.
    HTH,
    Thierry
    Edited by: Thierry H. on May 4, 2011 12:30 PM Reformatting

  • ORA-00164 Autonomous transaction when creating batch of users

    Hi,
    I ran the script posted earlier in this forum to create a batch of users, I got some errors, support people told me that is appears to be database errors :
    ORA-00164 Autonomous transaction disallowed with distributed transaction.
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL30.WWCTX_SSO", line 669 ORA-06502: PL/SQL: numeric or value error.
    We use 8.1.7.2 database, Portal 3.0.9.8.
    Anyone having a solution for that problem, I don't want to create 250 users manually.
    Thank's

    i'm getting the same thing, but i'm using hardcoded input,
    so i have no dblinks or anything of the sort.
    this is my entire exception line:
    ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYS.OWA_UTIL", line 323 ORA-06512: at "SYS.HTP", line 859 ORA-06512: at "SYS.HTP", line 974 ORA-06512: at "SYS.HTP", line 992 ORA-06512: at "SYS.HTP", line 40 ORA-06512: at "PORTAL30_SSO.WWSEC_UI", line 568 ORA-06512: at "PORTAL30_SSO.WWSSO_APP_USER_MGR", line 576 ORA-06512: at line 1
    any idea what is causing this?

Maybe you are looking for

  • My Macbook Pro feels slow and the hard drive is making a faint rattling noise.

    I'm seriously considering taking it back to the Apple Store. I've had it for just over 4 months. The hard drive is a lot louder than it used to be and rattles faintly. I used to be able to open various large applications like Photoshop, Dreamweaver a

  • Blog entry in iWeb via e-mail?

    Hello, I have an iWeb blog on MobileMe and wondering if it is possible to add blog entries via e-mail? (This feature would be very handy if one is away from his Mac...) Thanks, Attila

  • Need Docs of Product Costing

    Hi Gurus ,                 I need some document for Configuring Product Costing ... Please can anybody help me for it . Thanks in advance Regards Shankar

  • Family Base - Alert messages

    Please explain to me what the "red alert symbol" means within the Family Base Alert Messages.  Also, is there a way to see the text message details posted to my child's phone through my Family Base account?  Or is that only possible by physically tak

  • "Error encountered in source file video"

    I am trying to insert a .mov video into a PPT file using the Adobe Presenter  7.0.5, but I get a message saying "Error encountered in source file video". What is odd is that I was able to insert a video with the same format properties once, and publi