PL/SQL Function in an infinite Loop, how to destroy?

Hi,
My Apex is using a PL/SQL function and there is an infinite loop. How can I stop it so I can recompile the PL/SQL again? Thanks.

the less obvious is whos session exactly.
I had the same problem - wrong thinking, wrong loop , visible effects of infinitive loop (statistics of the db) . I was trying to kill sessions of the : user , who owns DAD and a user in who's schema runs nasty plsql code - without efect. Kill was confirmed but there was no change. I was made to reboot my server. Probably there is more efective way to do solve this (in my case - I have solved loop-problem after reebot).
Would it be better to kill apache session under OS ? (restart it)
Restart oracle's listner under OS ?
Some ideas ?

Similar Messages

  • Workflow infinite loop how to Stop?

    hi,
    My workflow is having a loop it runs infinite bcos the condition is not proper. Inside the loop i have a send mail step.. How to stop the Running workflow???
    Regards
    Roops

    Roop,
    It seems that the loop condition is a workflow step and not something in the method code.
    For active instances of this workflow you will have to manually intervene. There can be 2 options -
    1. Open the workflow log and change the container values such that it comes out of the condition
    2. Logically delete the workflow.
    Hope this helps

  • Pl/sql function overload package program and how to execute

    --creation overload package
    create or replace package pkg_overload is
    procedure get_emp(p_empid in number,p_empsal out number);
    procedure get_emp(p_ename in varchar2, p_empsal out number);
    end;
    -- define its body
    create or replace package body pkg_overload is
    procedure get_emp(p_empid in number,p_empsal out number) is
    begin
    select sal
    into p_empsal
    from emp
    where empno=p_empid;
    end;
    procedure get_emp (p_ename in varchar2,p_empsal out number) is
    begin
    select sal
    into p_empsal
    from emp
    where ename=p_ename;
    end;
    end pkg_overload;
    /* output of this :PACKAGE pkg_overload compiled
    Warning: execution completed with warning
    -- My question is about the warning and how to execute it
    --I tried that way to execute that program
    /*variable g_sal number;
    execute pkg_overload.get_emp(77934,:g_sal);
    RESULT
    Error starting at line 911 in command:
    execute pkg_overload.get_emp(77934,:g_sal)
    Error report:
    ORA-06550: line 1, column 7:
    PLS-00905: object SUBHAJIT.PKG_OVERLOAD is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    emp table code
    -- File created - Thursday-April-12-2012
    -- DDL for Table EMP
    CREATE TABLE "SUBHAJIT"."EMP"
    (     "EMPNO" NUMBER(4,0),
         "ENAME" VARCHAR2(10 BYTE),
         "JOB" VARCHAR2(9 BYTE),
         "MGR" NUMBER(4,0),
         "HIREDATE" DATE,
         "SAL" NUMBER(7,2),
         "COMM" NUMBER(7,2),
         "DEPTNO" NUMBER(2,0)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "USERS" ;
    REM INSERTING into SUBHAJIT.EMP
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7369,'SMITH','CLERK',7902,to_date('17-DEC-80','DD-MON-RR'),800,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7499,'ALLEN','SALESMAN',7698,to_date('20-FEB-81','DD-MON-RR'),1600,300,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7521,'WARD','SALESMAN',7698,to_date('22-FEB-81','DD-MON-RR'),1250,500,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7566,'JONES','MANAGER',7839,to_date('02-APR-81','DD-MON-RR'),2975,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7654,'MARTIN','SALESMAN',7698,to_date('28-SEP-81','DD-MON-RR'),1250,1400,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7698,'BLAKE','MANAGER',7839,to_date('01-MAY-81','DD-MON-RR'),2850,null,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7782,'CLARK','MANAGER',7839,to_date('09-JUN-81','DD-MON-RR'),2450,null,10);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7788,'SCOTT','ANALYST',7566,to_date('09-DEC-82','DD-MON-RR'),3000,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7839,'KING','PRESIDENT',null,to_date('17-NOV-81','DD-MON-RR'),5000,null,10);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7844,'TURNER','SALESMAN',7698,to_date('08-SEP-81','DD-MON-RR'),1500,0,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7876,'ADAMS','CLERK',7788,to_date('12-JAN-83','DD-MON-RR'),1100,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7900,'JAMES','CLERK',7698,to_date('03-DEC-81','DD-MON-RR'),950,null,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7902,'FORD','ANALYST',7566,to_date('03-DEC-81','DD-MON-RR'),3000,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7934,'MILLER','CLERK',7782,to_date('23-JAN-82','DD-MON-RR'),1300,null,10);
    -- Constraints for Table EMP
    ALTER TABLE "SUBHAJIT"."EMP" MODIFY ("EMPNO" NOT NULL ENABLE);
    Edited by: 923746 on Apr 12, 2012 1:18 PM

    >
    Warning: execution completed with warning
    >
    The package compiled with warnings. Post the exact error message.
    The code compiled with no errors for me in the SCOTT schema using that EMP table.

  • Illustrator CC editing symbol goes infinite loop, how to get out of?

    Hey all
    I'm editing a fairly complex illustrator symbol instance (its a world map vector), and now I've gone to go back to the original artboard but for whatever reason the program can't get out of a PROGRESS / SAVE modal popup box and the progess bar fills, goes off screen then comes back on screen and fills again. (I can still see the symbol instance in the background and are not back at the original artboard yet.
    Any way to get out of this without having to CTRL + ALT + Delete and close the program and restart?
    I'm on WIndows 7
    Any hlep would be great

    You could provide a sample . ai file, so other users may inspect it and see if they can observe the same issue as you do.

  • Throws infinite-loop error after cycline through Vector - HELP!!!

    public void paint(Graphics g) {
    FontMetrics fm = g.getFontMetrics();
    xpos = (getSize().width - fm.stringWidth(((String[])parseVector.elementAt(kount))[1])) / 2;
    if (ypos >= getSize().height || ypos <= 0) {
    g.drawString("", 0, 0); // CLEAR THE APPLET
    ypos = getSize().height;
    if (kount <= parseVector.size()) {
    kount++;
    } else {
    kount = 0;
    g.drawString(((String[])parseVector.elementAt(kount))[1], xpos, ypos);
    class ScrollNews implements Runnable {
    public void run() {
    while (true) {
    ypos = ypos - 1;
    ParseNews.this.repaint();
    try {
    Thread.sleep(50);
    } catch (InterruptedException e) {}
    I don't know why this breaks after working one time through the Vector parseVector, what am I missing????
    Phil

    public void paint(Graphics g) {
    FontMetrics fm = g.getFontMetrics();
    xpos = (getSize().width -
    fm.stringWidth(((String[])parseVector.elementAt(kount))
    1])) / 2;
    if (ypos >= getSize().height || ypos <= 0) {
    g.drawString("", 0, 0); // CLEAR THE APPLET
    ypos = getSize().height;
    if (kount <= parseVector.size()) {
    kount++;
    } else {
    kount = 0;
    g.drawString(((String[])parseVector.elementAt(kount))[
    ], xpos, ypos);
    class ScrollNews implements Runnable {
    public void run() {
    while (true) {
    ypos = ypos - 1;
    ParseNews.this.repaint();
    try {
    Thread.sleep(50);
    } catch (InterruptedException e) {}
    I don't know why this breaks after working one time
    through the Vector parseVector, what am I missing????
    PhilI think your problem is here:
    while (true) {You have an infinite loop - how will the while loop ever be false?

  • Multiple Select List looping thru PL/SQL function body returning SQL query

    Hi,
    I have a Multiple Select List. I want to loop through the values from the Select List and process them in a PL/SQL function body returning a SQL query. Currently, my code only returns the SQL SELECT results of one item in the select list. How do I change my code to make it return the results of all of the items in the select list? (I tested it and it is definitely picking up all the values in the select list).
    <b>
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s   VARCHAR2(20);
    q varchar2(32767);
    BEGIN
    selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
    -- htp.p('COUNT: '||selected_items.count);
      FOR i in 1..selected_items.count LOOP
      s := TO_CHAR(selected_items(i));
    -- htp.p('First: '||s);
    -- htp.p('Second: '||:s);
    -- htp.p('Third: '||TO_CHAR(selected_items(i)));
      q:= 'SELECT  '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
      RETURN q;
      END LOOP;
    END;</b>
    Thank you,
    Laura

    Laura,
    First, I would be careful of introducing SQL Injection possibilities. Any time I see
    'Select ... ' || :P123_FOO || ' ... '
    I worry about sql injection. In your case you are converting :P50_SELECTED_INSTRUMENTS into selected_items and then selected_items into s. So when I see
    'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
    I think, "I could use sql Injection and hack this."
    So, I would do some validation on :P50_SELECTED_INSTRUMENTS or some other method to avoid this.
    I'm not certain I understand your query. Do you really intend to allow the user to select the beginning of a string and then find all rows that start with that string? Or, do you just want to let them find when it matches the string. This is one way if you want to do matching:
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s VARCHAR2(32767);
    q varchar2(32767);
    BEGIN
    -- Change the : separate string to be comma separated with quoted strings
    s := '''' || replace(:P50_SELECTED_INSTRUMENTS, ',', ''',''')|| '''' ;
    -- htp.p('COUNT: '||selected_items.count);
    q:= 'SELECT '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE TO_CHAR(orig_geo_loc_sys) in (' || s ||' ) '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
    RETURN q;
    END;
    If you want to do something more like you originally stated, try this:
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s VARCHAR2(20);
    q varchar2(32767);
    BEGIN
    selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
    -- htp.p('COUNT: '||selected_items.count);
    q:= 'SELECT '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE 1=1 ';
    FOR i in 1..selected_items.count LOOP
    s := TO_CHAR(selected_items(i));
    q := q || ' and TO_CHAR(orig_geo_loc_sys) LIKE '''|| s ||'%'' ' ;
    END LOOP;
    q := q || ||'%'' '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
    RETURN q;
    END;
    Hope this helps...
    Anton

  • How to find infinite loop?

    Dear Oracle Gurus,
    I have one (some?) problem and no idea what to do.
    Our platform is IBM xSeries 234, RHEL3, 10g (version ...0.2). Database has only Oracle Application Repository shemas.
    Here is output from OS:
    #ps aux
    ... oracleandja (LOCAL=NO) -More then 200 lines
    ... /d2/oradb/andja/bin/emagent
    ... oracleandja (LOCAL=NO)
    ... ora_pmon_andja
    ... ora_mman_andja
    ... ora_dbw0_andja
    ... ora_lgwr_andja
    ... ora_ckpt_andja
    ... ora_smon_andja
    ... ora_reco_andja
    ... ora_cjq0_andja
    ... ora_d000_andja
    ... ora_s000_andja
    ... ora_qmnc_andja
    ... ora_mmnl_andja
    #top
    216 processes: 214 sleeping, 2 running, 0 zombie, 0 stopped
    1st CPU: 100%
    2nd CPU: 25%
    When I try to shutdown DB from SQL+, I got this:
    ORA-24324: service handle not initialized
    ORA-24323: value not allowed
    ORA-00020: maximum number of processes (%s) exceeded
    The most interesting error has written in .trc file:
    ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop], [], [], [], [], [], [], []
    Can you give me some advice how to find this infinite loop? And how to deal with this?
    Is there anything that I can do to solve this without reinstalling whole DB and AS?
    Regards

    If you cannot shut Oracle down using a shutdown immediate then you will need to get a new /nolog session and issue a "shutdown abort".
    From the error messages you listed it would appear you ran intot your maximum number of proceess limit and you will need to fix that.
    However the bug report for bug 3411348.8 makes it appear you would only get this error when performing DDL like alter table .. upgrade, ?
    What exactly was being done on your system when the problem started?
    HTH -- Mark D Powell --

  • LOOP in PL/SQL Function Body Help Needed

    I have a PL/SQL function that I'm trying to run and use a LOOP but I'm having some problems. I know the loop works since it output's two commas for me, which is how many records the query used for the LOOP returns, but I can't seem to find the right syntax to reference the column.
    DECLARE
    str VARCHAR2(2000) := "";
    BEGIN
    IF :P21_GLOBAL_ID IS NOT NULL THEN
    FOR q IN (
    SELECT
    ID,
    DRAW_DATE,
    ENTERED_BY
    FROM
    SAMPLE_T
    WHERE
    ID = :P21_GLOBAL_ID
    ORDER BY
    DRAW_DATE
    LOOP
    str := str || q.ID || ',' ;
    END LOOP;
    END IF;
    RETURN STR
    END;

    I just sent you the credentials.
    Interestingly, I have this same code for the source of a textarea on the page and the source for a report. I then modified the PL/SQL code as follows:
    DECLARE
         varSelect VARCHAR2(32767) := ''; --hold query SELECT definition
         varFrom VARCHAR2(32767) := ''; --hold query FROM clause definition
         varWhere VARCHAR2(32767) := ''; --hold query WHERE clause definition
         varOrderBy VARCHAR2(32767) := ''; --hold query ORDER BY clause definition
         varQuery VARCHAR2(32767) := ''; --hold query definition
    BEGIN
         IF TRIM(LOWER(TO_NUMBER(:P21_GLOBAL_TEMPLATE_ID))) IS NOT NULL THEN
              varSelect := 'SELECT SUBJECT_ID';
              varSelect := varSelect || ', SUBJECT_ID AS PHI';
              varSelect := varSelect || ', SUBJECT_ID AS ENTER_DATA';
              varSelect := varSelect || ', SUBJECT_ID AS LOGISTICA';
    for varTempQuery IN (
    SELECT
    stc.question_name as field_name,
    sti.read_security,
    sti.write_security,
    nvl(sti.validation_type,decode(stc.validation_rules,'None','TEXT_FIELD')) as validation_type,
    sti.html_caption,
    nvl(upper(sti.html_display_type),'TEXTFIELD') as html_display_type,
    sti.html_table_row,
    sti.html_table_column
    FROM
    rix.study_subject_templates sst,
    rix.study_subject_Template_items sti,
    rix.questions stc
    WHERE
    TRIM(LOWER(TO_NUMBER(sst.ss_template_Id))) = TRIM(LOWER(TO_NUMBER(:P21_GLOBAL_TEMPLATE_ID)))
    AND TRIM(LOWER(TO_NUMBER(sst.ss_Template_id))) = TRIM(LOWER(TO_NUMBER(sti.ss_Template_id)))
    AND TRIM(LOWER(TO_NUMBER(sti.phi_qid))) = TRIM(LOWER(TO_NUMBER(stc.qid)))
    AND TRIM(LOWER(TO_CHAR(sti.template_item_Status))) <> TRIM(LOWER(TO_CHAR('RETIRED')))
    ORDER BY
    sti.html_Table_row,
    sti.html_table_column
    LOOP
    varSelect := varSelect || ', ' || varTempQuery.field_name;
    END LOOP;
              varFrom := 'FROM     RIX.SUBJECTS';
              varWhere := 'WHERE STUDY_ID = ' || TRIM(LOWER(TO_NUMBER(:P21_STUDY_ID )));
              varOrderBy := 'ORDER BY';
              varOrderBy := varOrderBy || ' subject_label ';
    varQuery := varSelect || ' ' || varFrom || ' ' || varWhere || ' ' || varOrderBy;
         ELSE
    varQuery := 'SELECT SUBJECT_ID FROM SUBJECTS WHERE study_id = :P21_STUDY_ID;';
         END IF;
    RETURN varQuery;
    END;
    When I run the page now, the textarea has the SQL statement generated from the first IF block, but the report using the statement from the ELSE block. I thought it maybe was a timing issue, but both blocks reference other fields on the page, so it doesn't seem to be a timing issue. Shouldn't be a condition issue either with the IF block as the textarea and report use the same source, but are evaluating differently.
    Very odd (to me at least).

  • SQL stored procedure Staging.GroomDwStagingData stuck in infinite loop, consuming excessive CPU

    Hello
    I'm hoping that someone here might be able to help or point me in the right direction. Apologies for the long post.
    Just to set the scene, I am a SQL Server DBA and have very limited experience with System Centre so please go easy on me.
    At the company I am currently working they are complaining about very poor performance when running reports (any).
    Quick look at the database server and CPU utilisation being a constant 90-95%, meant that you dont have to be Sherlock Holmes to realise there is a problem. The instance consuming the majority of the CPU is the instance hosting the datawarehouse and in particular
    a stored procedure in the DWStagingAndConfig database called Staging.GroomDwStagingData.
    This stored procedure executes continually for 2 hours performing 500,000,000 reads per execution before "timing out". It is then executed again for another 2 hours etc etc.
    After a bit of diagnosis it seems that the issue is either a bug or that there is something wrong with our data in that a stored procedure is stuck in an infinite loop
    System Center 2012 SP1 CU2 (5.0.7804.1300)
    Diagnosis details
    SQL connection details
    program name = SC DAL--GroomingWriteModule
    set quoted_identifier on
    set arithabort off
    set numeric_roundabort off
    set ansi_warnings on
    set ansi_padding on
    set ansi_nulls on
    set concat_null_yields_null on
    set cursor_close_on_commit off
    set implicit_transactions off
    set language us_english
    set dateformat mdy
    set datefirst 7
    set transaction isolation level read committed
    Store procedures executed
    1. dbo.p_GetDwStagingGroomingConfig (executes immediately)
    2. Staging.GroomDwStagingData (this is the procedure that executes in 2 hours before being cancelled)
    The 1st stored procedure seems to return a table with the "xml" / required parameters to execute Staging.GroomDwStagingData
    Sample xml below (cut right down)
    <Config>
    <Target>
    <ModuleName>TransformActivityDim</ModuleName>
    <WarehouseEntityName>ActivityDim</WarehouseEntityName>
    <RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName>
    <Watermark>2015-01-30T08:59:14.397</Watermark>
    </Target>
    <Target>
    <ModuleName>TransformActivityDim</ModuleName>
    <WarehouseEntityName>ActivityDim</WarehouseEntityName>
    <RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName>
    <ManagedTypeViewName>MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity</ManagedTypeViewName>
    <Watermark>2015-01-30T08:59:14.397</Watermark>
    </Target>
    </Config>
    If you look carefully you will see that the 1st <target> is missing the ManagedTypeViewName, which when "shredded" by the Staging.GroomDwStagingData returns the following result set
    Example
    DECLARE @Config xml
    DECLARE @GroomingCriteria NVARCHAR(MAX)
    SET @GroomingCriteria = '<Config><Target><ModuleName>TransformActivityDim</ModuleName><WarehouseEntityName>ActivityDim</WarehouseEntityName><RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName><Watermark>2015-01-30T08:59:14.397</Watermark></Target><Target><ModuleName>TransformActivityDim</ModuleName><WarehouseEntityName>ActivityDim</WarehouseEntityName><RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName><ManagedTypeViewName>MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity</ManagedTypeViewName><Watermark>2015-01-30T08:59:14.397</Watermark></Target></Config>'
    SET @Config = CONVERT(xml, @GroomingCriteria)
    SELECT
    ModuleName = p.value(N'child::ModuleName[1]', N'nvarchar(255)')
    ,WarehouseEntityName = p.value(N'child::WarehouseEntityName[1]', N'nvarchar(255)')
    ,RequiredWarehouseEntityName =p.value(N'child::RequiredWarehouseEntityName[1]', N'nvarchar(255)')
    ,ManagedTypeViewName = p.value(N'child::ManagedTypeViewName[1]', N'nvarchar(255)')
    ,Watermark = p.value(N'child::Watermark[1]', N'datetime')
    FROM @Config.nodes(N'/Config/*') Elem(p)
    /* RESULTS - NOTE THE NULL VALUE FOR ManagedTypeViewName
    ModuleName WarehouseEntityName RequiredWarehouseEntityName ManagedTypeViewName Watermark
    TransformActivityDim ActivityDim MTV_System$WorkItem$Activity NULL 2015-01-30 08:59:14.397
    TransformActivityDim ActivityDim MTV_System$WorkItem$Activity MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity 2015-01-30 08:59:14.397
    When the procedure enters the loop to build its dynamic SQL to delete relevant rows from the inbound schema tables it concatenates various options / variables into an executable string. However when adding a NULL value to a string the entire string becomes
    NULL which then gets executed.
    Whilst executing "EXEC(NULL)" would cause SQL to throw an error and be caught, executing the following doesnt
    DECLARE @null_string VARCHAR(100)
    SET @null_string = 'hello world ' + NULL
    EXEC(@null_string)
    SELECT @null_string
    So as it hasnt caused an error the next part of the procedure is to move to the next record and this is why its caught in an infinite loop
    DELETE @items WHERE ManagedTypeViewName = @View
    The value for the variable @View is the ManagedTypeViewName which is NULL, as ANSI_NULLS are set to ON in the connection and not overridded in the procedure then the above statement wont delete anything as it needs to handle NULL values differently (IS NULL),
    so we are now stuck in an infinite loop executing NULL for 2 hours until cancelled.
    I amended the stored procedure and added the following line before the loop statement which had the desired effect and "fixed" the performance issue for the time being
    DELETE @items WHERE ManagedTypeViewName IS NULL
    I also noticed that the following line in dbo.p_GetDwStagingGroomingConfig is commented out (no idea why as no notes in the procedure)
    --AND COALESCE(i.ManagedTypeViewName, j.RelationshipTypeViewName) IS NOT NULL
    There are obviously other ways to mitigate the dynamic SQL string being NULL, there's more than one way to skin a cat and thats not why I am asking this question, but what I am concerned about is that is there a reason that the xml / @GroomingCriteria is incomplete
    and / or that the procedures dont handle potential NULL values.
    I cant find any documentation, KBs, forum posts of anyone else having this issue which somewhat surprises me.
    Would be grateful of any help / advice that anyone can provide or if someone can look at their 2 stored procedures on a later version to see if it has already been fixed. Or is it simply that we have orphaned data, this is the bit that concerns most as I dont
    really want to be deleting / updating data when I have no idea what the knock on effect might be
    Many many thanks
    Andy

    First thing I would do is upgrade to 2012 R2 UR5. If you are running non-US dates you need the UR5 hotfix also.
    Rob Ford scsmnz.net
    Cireson www.cireson.com
    For a free SCSM 2012 Notify Analyst app click
    here

  • How to call a SQL function from an XSL expression

    Hi
    In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
    The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
    The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
    1) How to call a SQL function from an XSL expression that is allowed in BI template.
    If anyone ahs faced similar requirements please share your approach.
    Thanks
    Srimathi

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

  • How to use a select list value in a PL/SQL function body returning SQLquery

    Hi Friends,
    I have a select list P6_TEST with values 'nav' anf 'jyo'. I am trying to create a report using "SQL Query (PL/SQL
    function body returning SQL query)". In my report query can i check if P6_TEST='nav' and do something like the
    code shown below.How can i do that.
    DECLARE
    v_sql VARCHAR2(3000);
    BEGIN
    IF :P6_TEST = 'nav' THEN
    v_sql :=
    'SELECT
    * from department';
    ........................Thanks,
    Nav

    Nav:
    What you have should work. Give it a go. Post back if you run into issues.
    Varad

  • How do i use PL/SQL function in filter operator

    Hi,
    i want to use one pl/sql function in filter operator. how do i use it in filter condition.
    error i am getting is
    " error occured during expression validatation.
    my filter condition is
    INOUTGRP1.LAST_UPDATE_DATE > "GET_LAST_UPDATE_DATE"()
    can any one suggest me what is the problem for this error.
    Regards,
    Jyothy

    I tried and getting the same error. don't know why!!
    However, There is another way of accomplishing it.
    You can add a "Mapping Input Parameter" to your mapping and in the default value field call the function "Get_Last_Update_date". Then add the output field from this operator to the filter operator. Then edit the filter condition to replace the function call with output value from the Input parameter operator.
    This should work...

  • How to user HTMLDB_COLLECTIONS in a PL/SQL function?

    Hi!
    I am trying to validate/check that an item from an updateable report is not in a collection before I add the item. I wrote a PL/SQL function to do this. It appears that a "normal" PL/SQL function cannot correctly see the HTMLDB_COLLLECTIONS view. The idea for this was posted to the forum about using a decode statement and a function to detemine whether to display the link value or not for each row. If an item has been added to the collection I want to not display the link. If the item is removed from the collection I need to redisplay the link.
    I have tried validations but they depend on the page being resumbitted. And I tried to force that using a branch where the request was = 'ADD'. However everytime I set it up as a redirect to a URL it kept resetting the branch to a 'branch to a page within this application'.
    Any suggestions on how to check the HTMLDB_COLLECTIONS before it is updated?
    This is V2.0.
    Thanks! Dave Venus

    Hi!
    Yes things work much better when run from within the "application". I had been trying to test the code from both SQL*Plus and from the SQL WorkShop.
    The problem I was having even within the application was that I was getting back NULL return values. So I put some exception handling into the code and trapped the
    data_not_found and others exceptions. I also had SQL%NOTFOUND code in my function. It appears the SQL%NOTFOUND was not being processed and the exception code was. I can paste the code I was using here if you want.
    I went another way around the problem and rewrote the query (esp. the where clause) for the report and it seems to be doing what I need now. I would love to get the function working and understand how it should have worked so that I can use that functionallity in other applications.
    Thanks!
    Dave Venus

  • How to use the Java objects or methods in pl/sql function as a parameter

    dear all,
    I java object passed as a parameter in pl/sql. how can i access the java objects as parameter in pl/sql function. please give a soultion to me
    mohan reddy

    I'm not sure whether this would help you.
    Have a look at this program to list files from a directory.
    CREATE GLOBAL TEMPORARY TABLE DIR_LIST
    ( FILENAME VARCHAR2(255) )
    ON COMMIT DELETE ROWS
    Table created.
    create or replace
    and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    public static void getList(String directory)
    throws SQLException
    File path = new File( directory );
    String[] list = path.list();
    String element;
    for(int i = 0; i < list.length; i++)
    element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    Java created.
    SQL>
    create or replace
    procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    SQL> exec get_dir_list( 'C:\Bhagat' );
    PL/SQL procedure successfully completed.
    Thanks,
    Bhagat

  • ****How to come out of the  infinite loop by passing a perticular message

    Hi all,
    Can You Pl expalin me in detail "How to come out of the  infinite loop by passing a perticular message in BPM Scenarios"
    Thanks,
    Srinivasa

    Hi Potharaju,
    For this al you need to do is define an IP with two branches. One of the branch receives message of a particular type only. And the other branch is used for stopping the message processing. This is achieved using the correlation. Correlation makes sure that the message of the first type goes to the first branch only and that the message of second type should go to the second branch only. Now when the message of the second type is received, the control comes out of the infinite loop.
    Hope it makesit clear.
    Regards,
    Sanjeev.

Maybe you are looking for

  • Switch to Icon layout in folders

    Hi Everyone, I was just wondering how do I make it so the folders in the Home menu on my iMac stay to the new layout? The Icons I'm talking about are the ones that you find in the Go menu of Finder, Those Icons to the side of each word (such as downl

  • AME CS6 h264 output that can play in final cut.

    i need to output H264 files, which will play in Final Cut 7. When I choose H264 codecs in AME CS6, the files are .mp4 which will not play in FCP7. My director needs to be able to play them in FCP7. How can I get AME to output H264 and not .mp4? Thank

  • Aperture 3.5.1

    If Apple have upgraded Aperture twice in the last few weeks, does this mean that version 4 isn't iminent?

  • Reinstall software sollution

    Reading the topics I found a lot of times the advice to reinstall the software for several problems. Do Nokia use faulty memory that corrupts itself very often? It is a foult of the current memory technology? It is because the OS haves bugs? Greeting

  • Regarding transportaion !

    Hi, i had transported one request to the quality some time back. now i want to transport the same request to the production. i know the request number but do not know how to transport. can body here tell me how to procede? Thanks, Ravi