HOW TO WRITE QUERY OR PL/SQL PROGRAM FOR THIS

I HAVE TABLE X
SELECT ENO FROM X
ENO
123
423
332
562
678
986
621
WHEN I RUN PL/SQL PROGRAM I WILL PASS PARAMETER
FOR EXAMPLE LIKE 134
I NEED OUTPUT LIKE
134 EXIST OUTPUT
123
423
332
562
621
134 NOT EXIST OUTPUT
678
986
Regards
Dev

This?
<tested in TOAD>
SQL> accept my_parm
old: with t as (
select '123' eno from dual union all
select '423' from dual union all
select '332' from dual union all
select '562' from dual union all
select '678' from dual union all
select '986' from dual union all
select '621' from dual )
select eno || ' ' || output_type results
from (
select to_char(&&my_parm) eno, 'EXIST OUTPUT' output_type, 1 output_id
from dual union all
select null eno, null output_type, 3 output_id
from dual union all
select to_char(&&my_parm) eno, 'NOT EXIST OUTPUT' output_type, 4 output_id
from dual union all
select
eno,
null,
case when regexp_instr(eno,'[' || &&my_parm || ']') >0
then 2
else 5
end output_id
from t
order by output_id, eno
new: with t as (
   select '123' eno from dual union all
   select '423' from dual union all
   select '332' from dual union all
   select '562' from dual union all
   select '678' from dual union all
   select '986' from dual union all
   select '621' from dual )
select eno || ' ' || output_type results
from (
   select to_char(134) eno, 'EXIST OUTPUT' output_type, 1 output_id
   from dual union all
   select null eno, null output_type, 3 output_id
   from dual union all
   select to_char(134) eno, 'NOT EXIST OUTPUT' output_type, 4 output_id
   from dual union all
   select  
      eno,
      null,
      case when regexp_instr(eno,'[' || 134 || ']') >0
         then 2
         else 5
      end output_id
   from t
order by output_id, eno
SQL> with t as (
   select '123' eno from dual union all
   select '423' from dual union all
   select '332' from dual union all
   select '562' from dual union all
   select '678' from dual union all
   select '986' from dual union all
   select '621' from dual )
select eno || ' ' || output_type results
from (
   select to_char(134) eno, 'EXIST OUTPUT' output_type, 1 output_id
   from dual union all
   select null eno, null output_type, 3 output_id
   from dual union all
   select to_char(134) eno, 'NOT EXIST OUTPUT' output_type, 4 output_id
   from dual union all
   select  
      eno,
      null,
      case when regexp_instr(eno,'[' || 134 || ']') >0
         then 2
         else 5
      end output_id
   from t
order by output_id, eno
RESULTS            
134 EXIST OUTPUT   
123                
332                
423                
621                
134 NOT EXIST OUTPUT
562                
678                
986                
10 rows selected.Message was edited by:
MScallion

Similar Messages

  • How to write a module pool (M) program for the DEMO_DYNPRO_TABSTRIP_server

    Hi,
    How does someone write a module pool program (type m ) like the one which is given as an example for tabstrip control (paging through the app.server which is a report program). Please check the code given in the abap tutorial by sap below.
    REPORT DEMO_DYNPRO_TABSTRIP_server.
    CONTROLS MYTABSTRIP TYPE TABSTRIP.
    DATA: OK_CODE TYPE SY-UCOMM,
    SAVE_OK TYPE SY-UCOMM.
    DATA NUMBER TYPE SY-DYNNR.
    MYTABSTRIP-ACTIVETAB = 'PUSH2'.
    NUMBER = '0120'.
    CALL SCREEN 100.
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE CANCEL INPUT.
    LEAVE PROGRAM.
    ENDMODULE.
    MODULE USER_COMMAND INPUT.
    SAVE_OK = OK_CODE.
    CLEAR OK_CODE.
    IF SAVE_OK = 'OK'.
    MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='
    MYTABSTRIP-ACTIVETAB.
    ELSE.
    MYTABSTRIP-ACTIVETAB = SAVE_OK.
    CASE SAVE_OK.
    WHEN 'PUSH1'.
    NUMBER = '0110'.
    WHEN 'PUSH2'.
    NUMBER = '0120'.
    WHEN 'PUSH3'.
    NUMBER = '0130'.
    ENDCASE.
    ENDIF.
    ENDMODULE.
    I am finding the problem with the below statements .
    MYTABSTRIP-ACTIVETAB = 'PUSH2'.
    NUMBER = '0120'.
    CALL SCREEN 100.
    how do I write them in a module and how I can ensure that the functionality is not changed?
    Thanks in advance,
    Ajith c

    Hi
    All Tabstribs use the same subarea SUB (see the dynpro 100), in PBO it needs to indicate the program and subscreen number have to be loaded in that subarea.
    In PBO of screen 100 you can see the line:
    CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.
    The variable NUMBER is managed in the USER_COMMAND:
      save_ok = ok_code.
      CLEAR ok_code.
      IF save_ok = 'OK'.
        MESSAGE i888(sabapdocu) WITH 'MYTABSTRIP-ACTIVETAB ='
                                      mytabstrip-activetab.
      ELSE.
        mytabstrip-activetab = save_ok.
        CASE save_ok.
          WHEN 'PUSH1'.
            number = '0110'.
          WHEN 'PUSH2'.
            number = '0120'.
          WHEN 'PUSH3'.
            number = '0130'.
        ENDCASE.
      ENDIF.
    But this module is triggered as soon as you press a button on screen 100 (you have to considere the label of tabstrip is a pushbutton),
    so it needs to initialize the variable NUMBER for the first time screen 100 is called, that mean it needs to indicate which is the first tab has to be shown at the beginning, so you have the code:
    mytabstrip-activetab = 'PUSH2'.  
    number = '0120'.
    CALL SCREEN 100.
    The same code can be included in the PBO in the following way:
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0100.
      MODULE INIT_TABSTRIP. "<--- New Module
      CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.
    PROCESS AFTER INPUT.
      MODULE CANCEL AT EXIT-COMMAND.
      CALL SUBSCREEN SUB.
      MODULE USER_COMMAND.
    MODULE INIT_TABSTRIP.
      IF NUMBER IS INITIAL.
        mytabstrip-activetab = 'PUSH2'.  
        number = '0120'.
      ENDIF.
    ENDMODULE.
    The line:
    mytabstrip-activetab = 'PUSH2'. 
    is to indicate which tabstrip has to be placed in foreground (remember every tabstrip is a pushbutton, so every tabstrip has an own ok_code)
    Max

  • How to write a if else logic expression for this condition

    Hai All
    I have written some if else logic for for my condition
    If the time is betweeb 0145 and 0630 and timeout is a column in a table is null than update sysdate-1
    then if time is bet0645 and 0900 then timein is null then insert into timein in table called dail_att
    and time bet 1130 and 1300 then if barcode null then insert timein else update timeout
    and bet 1645 and1730 then if barcode null and timein null then insert timein or update time out
    this is my condition for generating attendance. Ive tried some logic and pls tell case executed faster than ifelse logic
    and give me a soluton
    This is my coding
    if :bartime between 0145 and 0630 and :barcode is not null then
    update dail_att
    set timeout = :bartime
    where barcode= :barcode
    and timein is not null
    and ATTEND_DATE = :BARDATE-1;
    else if :bartime between 0645 and 0900 and :barcode is null then
    insert into dail_att(barcode,timein,attend_date)
    values(:barcode,:bartime,:bardate);
    else if     :bartime between 1145 and 1300 and :barcode is null then
         insert into dail_att(barcode,timein,attend_date)
    values(:barcode,:bartime,:bardate);
    else
         update dail_att
    set timeout = :bartime
    where barcode= :barcode
    and ATTEND_DATE = :BARDATE ;
    end if;
    else if :bartime between 1645 and 1730 and :barcode is null then
              insert into dail_att(barcode,timein,attend_date)
    values(:barcode,:bartime,:bardate);
    else
         update dail_att
    set timeout = :bartime
    where barcode= :barcode
    and ATTEND_DATE = :BARDATE ;
    end if;
    else :bartime > 1730 and :barcode is null then
         update dail_att
    set timeout = :bartime
    where barcode= :barcode
    and ATTEND_DATE = :BARDATE ;
    end if ;
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE' OR :BARCODE IS NULL;
    NEXT_RECORD;
    forms_ddl('commit');
    end loop;
    Regards
    Srikkanth.M

    Hai Sir
    I am storing time in 24hrs format and its datatype is varchar.Pls tell me we can write an if else with in a elseif
    Regards
    Srikkanth.M

  • Need pl/sql stmnts. for this simple logic

    Hi,
    I need PL/SQL program for this simple logic i am doing mistake somewhere unbale to trace
    out ..
    select * from GSR03_PO_DTL;
    PO_NUM
    L53177000 -- > no changes reqd (only one entry with new format)
    L00041677 --> to be updated to L41677000(only one entry with OLD format)
    L43677000 -- > no change reqd (exists one row with new format and old format like below)
    L00043677 -- > to be deleted this is old format (and new format like above already exists)
    EX:
    L00012345 --- old format
    L12345000 --- new format
    Hope question is clear. I written the following program.
    update is working fine but delete is not working.
    Please help.
    Thanks in Advance
    Devender
    declare
    Cursor c_test is
    (select po_num from GSR03_PO_DTL);
    BEGIN
    FOR r_test in c_Test
    LOOP
    dbms_output.put_line (r_test.po_num);
    IF ('L'||substr(r_test.po_num,5,5)) = ('L'||substr(r_test.po_num,2,5)) then
         dbms_output.put_line ('delete stmnt');
    END IF;     
    EXIT WHEN c_test%NOTFOUND;
    END LOOP;
    FOR r_test in c_Test
    LOOP
    IF r_test.po_num like 'L000%' then
    IF ('L'||substr(r_test.po_num,5,5)) is not NULL then
         update GSR03_PO_DTL set PO_NUM = 'L'||substr(po_num,5,5)||'000'
         where po_num like 'L000%' ;
         dbms_output.put_line ('update stmnt');
    END IF;     
    END IF;
    END LOOP;
    END;
    *********************

    No need for PL/SQL, man.
    SQL> SELECT po_no FROM po1
      2  /
    PO_NO
    L53177000
    L00041677
    L43677000
    L00043677
    SQL> UPDATE po1 y
      2  SET    y.po_no = 'L'||substr(y.po_no,5,5)||'000'
      3  WHERE  y.po_no LIKE 'L000%'
      4  AND    NOT EXISTS ( SELECT null FROM po1 x
      5                      WHERE x.po_no =  'L'||substr(y.po_no,5,5)||'000')
      6  /
    1 row updated.
    SQL> DELETE FROM po1 y
      2  WHERE  y.po_no LIKE 'L000%'
      3  AND    EXISTS ( SELECT null FROM po1 x
      4                  WHERE x.po_no =  'L'||substr(y.po_no,5,5)||'000')
      5  /
    1 row deleted.
    SQL> SELECT po_no FROM po1
      2  /
    PO_NO
    L53177000
    L41677000
    L43677000
    SQL> Cheers, APC

  • What is varray and how to declare in the pl/sql program

    what is varray and how to declare in the pl/sql program

    1b5595eb-fcfc-48cc-90d2-43ba913ea79f wrote:
    what is varray and how to declare in the pl/sql program
    when all else fails Read The Fine Manual
    Oracle Database Search Results: varray

  • How to write query for this in TopLink ?

    I am doing a simple search in jsp where the search will the based on the choices chosen by user.
    I had given 3 check boxes for those choices.
    The problem is, query will be based on the choice or choices chosed by the user.
    How to write query for this in TopLink ?
    Thanks in Advance..
    Jayaganesh

    Try below solution, it is NOT best solution but might work:
    Declare @Questions TABLE (QuestionID INT, QuestionText Varchar(100))
    INSERT INTO @Questions
    VALUES (1, 'Comment'), (2, 'Score')
    DECLARE @Answers TABLE (authkey INT, QuestionID INT, questiontext VARCHAR(100), answertext VARCHAR(100))
    INSERT INTO @Answers
    VALUES (101, 1, 'comment', 'hi!!'), (101, 2, 'score', '4'), (102, 1, 'comment', 'excellent'), (102, 2, 'score', '5'), (103, 2, 'score', '6'), (104, 2, 'score', '8')
    SELECT
    A.AuthKey
    ,Q.QuestionID
    ,Q.QuestionText
    ,A.AnswerText
    FROM
    @Questions Q
    INNER JOIN @Answers A ON Q.QuestionID = A.QuestionID
    UNION
    SELECT
    A.AuthKey
    ,Q.QuestionID
    ,Q.QuestionText
    ,Null
    FROM
    @Questions Q
    CROSS JOIN @Answers A
    WHERE
    NOT EXISTS (SELECT 1 FROM @Answers SubQry WHERE SubQry.AuthKey = A.AuthKey AND SubQry.QuestionID = Q.QuestionID)
    Output
    AuthKey | QuestionID
    | QuestionText
    | AnswerText
    101 | 1 | Comment | hi!!
    101 | 2 | Score | 4
    102 | 1 | Comment | excellent
    102 | 2 | Score | 5
    103 | 1 | Comment | NULL
    103 | 2 | Score | 6
    104 | 1 | Comment | NULL
    104 | 2 | Score | 8
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • PL/SQL Program for automation

    Hi All,
    I want to write a Pl/sql program for the following requirement.
    1. wnat to connect to remote desktop .
    2. There we can find one more DB like AS-access. This one contains one file( ltake it as "XYZ" i)n some particular path.
    3. want to save this file in share folder.
    4. this share folder contains some "abc.txt" file.
    5.want to replace the data which XYZ contains.
    6. It is already having one ".XLS" file in share folder. want to delete it. ( because while running the exporting data the ".XLS" file created daily)
    7. now in share folder we have one ".mdb" file.If we click on that it will ask like "create Report"," Exit".
    8. we should click on "Create Report"
    9.then one pop up will come like "All the exisiting data will be lost",then press "OK"
    10. Again one window will open. It contains 2 buttopns. 1. Import Data 2. Export data.
    11.Click on Import data. Then it will ask for "Password"
    12.After giving the password it will import the whole data. ( It's taking around Hr time)
    13. After that one pop up will come says " Import completed". then press OK and then click on "Export data"
    14.After clicking this it will generate ".xls" file in share folder.
    15. after that open that ".XLS" file and then Goto Tools --> Macros --> Macros, to run the Macros from Excel sheet.
    16. Run the macro - "PERSONAL.XLS!macNewEFG".
    17.Once done, save the ".xls" as "Report - <Month 'YY>.xls" in share folder.
    18.Send then this generated report to respective mail-ids automatically.
    daily manually we are doing this job. But I am planning to do it automatically.
    so can any one please give me ur suggestions fir this.
    Thanks in adv.

    Hi,
    thanks for your quick response.Can you please suggest me how to write a shell script for this .
    I hope this is not the correct place to ask this.But please help me out regarding this.
    Thank you.

  • How do I make Pages the default program for .doc files?

    How do I make Pages the default program for .doc files without having the need to change the default program for each individual.doc file?

    Navigate to a .doc file.
    Ctrl click the file
    Choose Open with and then go down the list, past pages, to other
    Navigate to pages
    Before you click Open make sure you click the 'Always open with' check box.
    You should be okay.
    You can do a similar think by selecting the file, Choosing File-Get Info
    Then open the Open With Disclosure triangle.
    select pages and then click CHANGE ALL
    Hope this hleps.
    M.

  • How to find out back end mapping program for Idoc ?

    HI Experts,
    Iam new to ALE IIDOCS .. i have a issue in existing idoc .
    Some data maping problem is there in the existing idocs
    I need to find out back end program for this perticular idoc  no .
    Exactly where they have written the maping code  .
    How to find out this ?
    is there any preceedure to trace the back end program based on the idoc number .
    Regards
    RameshG

    Hi Ramesh,
    If you are looking at Inbound que then we generally double click on idoc go to control datat info and then take partner data info there
    Goto we20 check teh system and there double click the message type and there in inbound option double clik the porcess code it gives you one FM where you can see logic written to process that IDOC
    Regards,
    Poornima

  • How can get a database like ****.SQL file for test in sqlplus in oracle8i

    How can get a database like ****.SQL file for test in sqlplus in oracle8i,I am a beginner,thanks

    I'll give it a guess as to what it is you want but I'm afraid you'll have to give some more information to go on. I appreciate it's difficult for people who are beginners or who don't have English as their first language.
    Are you trying to run a SQL file? From SQL*plus you can do either of these:
    SQL> start my_file
    or
    SQL> @my_file
    N.B.: if th efile has a .sql extension you don't need to include it, but you do for any other file extension e.g.
    SQL> @myfile.run
    Here is the page Vijay referred to:
    Re: Physical storage Checks & adding disk on server. I hope you find it useful.
    You will more helpful links (including links to the Oracle on-line manuals at this page:
    Re: How to attach a java bean in forms6i
    good luck, APC

  • How can I extract the full SQL script for a schema?

    Hi,
    How can I extract the full SQL script for a schema?
    I am looking for some method that needs jus SQL*Plus and preferably doesn’t need any extra tool.
    Thank you,
    Alan

    How can I extract the full SQL script for a schema?What are you looking for? PL/SQL code? DDL for objects?

  • Need PL/SQL code for this

    Hi,
    I need a PL/SQL code for this one...
    Let me know if something is not clear...
    1) The table CLOB_CLOBJECT_CDA has the columns described below...
    Explaining only those fields which are important in this context
    -- CDA_STEP_ID : Basically a Sequence
    -- CLOBJECT_SOURCE1_ID : Every id has got a set of records
    -- CLOBJECT_SOURCE2_ID : Every id has got a set of records
    -- LVL : There are total 8 levels..
    This is the main aim :
    1) There are total 16 million rows..(limited to 10 rows here)
    2) We need to go through level by level (LVL column) & insert the intersection records (CLOBJECT_SOURCE1_ID intersect CLOBJECT_SOURCE2_ID)
    into another table...but this is how it goes..
    Level (LVL column) 3's basically have CLOBJECT_SOURCE1_ID as level (LVL column) 2 CDA_STEP_ID's..
    (consider the statement --** where CLOBJECT_SOURCE1_ID = 285 which is same as 1st insert statement step id)..
    The above process goes for next levels until 8..(so have to use loops)
    So for ex :
    We go through the first insert statement and insert the insertion records only when both CLOBJECT_SOURCE1_ID & CLOBJECT_SOURCE2_ID has got records ..
    If we don't find any records for both of them we should skip the corresponding step id when we go to the next levels...
    Let's go through the 1st insert statement...
    -- We have CDA_STEP_ID = 285 & two sources CLOBJECT_SOURCE1_ID as 19 & CLOBJECT_SOURCE2_ID as 74...
    -- We see the table CLOBJECT_COUNTS & check whether we have counts for both 19 & 74 ..(In fact we insert counts into this table only if they have records)
    -- If so, we insert the intersection records into CDA_MRN_RESULTS ( we do have counts for both of them..) with CDA_STEP_ID 285...
    -- Then we insert the step id which is 285 along with the count into CLOBJECT_COUNTS..
    Let's go through another insert statement...
    -- Consider CDA_STEP_ID = 288 which has two sources CLOBJECT_SOURCE1_ID as 19 & CLOBJECT_SOURCE2_ID as 92...
    -- We see the table CLOBJECT_COUNTS & check whether we have counts for both 19 & 92 ..(we have records for 19 but not for 92)
    -- So we should not proceed with this..& also skip all those records (future records with increasing levels..basically level 3's) which have got 288 as CLOBJECT_SOURCE1_ID..
    (As said earlier that the present CDA_STEP_ID will always be CLOBJECT_SOURCE1_ID in the next level)...
    I wrote the following code which is after the statement...
    Let me have the create & insert statements here..
    create table CLOB_CLOBJECT_CDA
        CDA_STEP_ID           NUMBER,
        CDA_ID                NUMBER,
        CDA_SEQ_NUMBER        NUMBER,
        CLOBJECT_SOURCE1_TYPE VARCHAR2(3000),
        CLOBJECT_SOURCE1_ID   NUMBER,
        CLOBJECT_OPERATOR     VARCHAR2(3000),
        CLOBJECT_SOURCE2_TYPE VARCHAR2(3000),
        CLOBJECT_SOURCE2_ID   NUMBER,
        LVL                   NUMBER
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (285, 285, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 74, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (286, 286, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 75, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (287, 287, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 91, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (288, 288, 1, 'CLOBJECT', 19, 'INTERSECT', 'CLOBJECT', 92, 2);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4869, 4869, 1, 'CDA_STEP', 285, 'INTERSECT', 'CLOBJECT', 91, 3);  -- **
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4870, 4870, 1, 'CDA_STEP', 285, 'INTERSECT', 'CLOBJECT', 92, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4871, 4871, 1, 'CDA_STEP', 285, 'INTERSECT', 'CLOBJECT', 93, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4880, 4880, 1, 'CDA_STEP', 286, 'INTERSECT', 'CLOBJECT', 91, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4881, 4881, 1, 'CDA_STEP', 286, 'INTERSECT', 'CLOBJECT', 92, 3);
    insert into clob_clobject_cda (CDA_STEP_ID, CDA_ID, CDA_SEQ_NUMBER, CLOBJECT_SOURCE1_TYPE, CLOBJECT_SOURCE1_ID, CLOBJECT_OPERATOR, CLOBJECT_SOURCE2_TYPE, CLOBJECT_SOURCE2_ID, LVL)
    values (4882, 4882, 1, 'CDA_STEP', 286, 'INTERSECT', 'CLOBJECT', 93, 3);
    create table CDA_MRN_RESULTS
       CDA_STEP_ID      NUMBER,
      MRN              NUMBER,
      INSERT_DATE_TIME DATE
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (19, 1, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (19,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (19,  3, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (74,  1, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (74,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (74,  4, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (75,  1, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (75,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (75,  6, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (91,  2, to_date('19-10-2011', 'dd-mm-yyyy'));
    insert into cda_mrn_results (CDA_STEP_ID, MRN, INSERT_DATE_TIME)
    values (91,  3, to_date('19-10-2011', 'dd-mm-yyyy'));
    create table CLOBJECT_COUNTS
      CDA_STEP_ID    NUMBER,
      CLOBJECT_COUNT NUMBER,
      DATE_TIME      DATE
    Insert into CLOBJECT_COUNTS values (19,3, to_date('19-10-2011', 'dd-mm-yyyy'));
    Insert into CLOBJECT_COUNTS values (74,3, to_date('19-10-2011', 'dd-mm-yyyy'));
    Insert into CLOBJECT_COUNTS values (75,3, to_date('19-10-2011', 'dd-mm-yyyy'));
    Insert into CLOBJECT_COUNTS values (91,2, to_date('19-10-2011', 'dd-mm-yyyy'));The output goes into two tables...
    CDA_MRN_RESULTS : O/p of intersection records between source1 & source2 id
    CLOBJECT_COUNTS : Step id with counts ...(useful for skipping next level step id's if either of source id has "0" counts)
    Any help is appreciated..
    Thanks..

    I tried to code this..but looping takes a lot of time..I want to skip certain rows where source1_step_id & source_2_step_id are not in clobject_counts table as we proceed to the next levels..Not sure how to skip the rows..
    declare
    cursor c1 (p_level varchar2 ) is
      Select * from clob_clobject_cda
        where lvl = p_level    ;
       TYPE V_TT IS TABLE OF C1%ROWTYPE INDEX BY PLS_INTEGER;
        L_TT V_TT;
        v1 number;
        v2 number;
        v_step_id number;
        v_operator varchar2(100) := '';
    begin
    for i in 2..8 loop
      open c1(i);
      LOOP
           FETCH C1 BULK COLLECT INTO L_TT LIMIT 500;
            FOR indx IN 1 .. L_TT.COUNT
             LOOP
               v1 := L_TT(indx).clobject_source1_id;
               v2 := L_TT(indx).clobject_source2_id;
               v_step_id := L_TT(indx).cda_step_id;
               v_operator := L_TT(indx).clobject_operator;
      Execute Immediate ('Insert into cda_mrn_results Select --+ parallel (cm 128)
                                                      distinct ' || v_step_id || ', mrn, trunc(sysdate) dt from cda_mrn_results  cm
                        where cda_step_id = ' || v1 || '
                        and   cda_step_id in (Select cda_step_id from clobject_counts) ' ||
         v_operator ||
                    '  Select --+ parallel (cm 128)
                                                      distinct ' || v_step_id || ', mrn, trunc(sysdate) dt from cda_mrn_results  cm
                        where cda_step_id = ' || v2 || '
                        and   cda_step_id in (Select cda_step_id from clobject_counts)  ' );
    Insert --+ Append
           into clobject_counts Select cda_step_id, count(distinct mrn),
                       insert_date_time dt from cda_mrn_results  where cda_step_id =  v_step_id   group by cda_step_id,insert_date_time;
       COMMIT;                    
             END LOOP;
           EXIT WHEN L_TT.COUNT = 0;
         END LOOP;
      CLOSE C1;
    End Loop;    
    Commit;
    End;

  • APP-ALR-04106: Please correct the user-defined SQL statement for this alert

    Hi All,
    I have created an alert for engineering module in R12. It got tested and was working fine. when the user testing it, while trigger the alert getting the error, "APP-ALR-04106: Please correct the user-defined SQL statement for this alert".
    when verified the alert, it got verified and ran also. It parsed the query successfully and when run it fetched few records.
    Need help in resolving the issue.
    Thanks in advance.
    Regards,
    sri
    Edited by: user10939296 on Jan 18, 2010 1:16 AM

    Hi Sri;
    I have already gone through the Note: 948037.1. But this note is related to 11i. The solution provided in the Note is for 11i.
    I am facing this issue in R12. Is this patch applicable to R12?I belive its not. But u can check Solution part 4 for your instance, at least it can give you idea. The other note in metalink related bug and all for R11 too.
    I belive its better way to rise Sr while waiting other forum user response to that thread
    Regard
    Helios

  • I have windows xp. I downloaded quick time no problem still can't get itunes to install. Still get same message (a program for this install to complete could not be run).

    I have windows xp. I downloaded quick time no problem still can't get itunes to install. Still get same message (a program for this install to complete could not be run).

    Try the following user tip:
    "There is a problem with this Windows Installer package ..." error messages when installing iTunes for Windows

  • Hey ! At the moment I am creating a eBook, which should contain links to iTunes. Does anyone know, if it is necesary to join the affiliate program for this ?? Cause I don`t want to ;-)

    Hey ! At the moment I am creating a eBook, which should contain links to iTunes.
    Does anyone know, if it is necessary to join the affiliate program for this ?? Cause I don`t want to ;-)

    Hi Bruce,
    I'm getting closer. I actually tried a variety of  expressions, such as "== null" and yours, but the problem persists.
    I am settling on the following, but there is a hangup related to the field that is being looked at for the condition that I will explain in a minute. Here's the script:
    if 
    (ViolationsTable.ViolCorrSection.ViolationsText.DebitVal.isNull || ViolationsTable.ViolCorrSection.ViolationsText.DebitVal.rawValue.length == 0)
    ViolationsTable.ViolCorrSection.instanceManager.removeInstance(parent.parent.index);
    else
    app.alert ("Warning Statement);
    ViolationsTable.ViolCorrSection.instanceManager.removeInstance(parent.parent.index);
    What happens is that, no matter which row in my table I'm in when I click the remove instance button, the script is always looking to the DebitVal field in the first row of the table. So, if the first row is empty, the message box won't appear for the removal of any row in my table. If the first row has a value in DebitVal, then the deletion of any row in the table will trigger the message box.
    I need a way to specify the script to look at the DebitVal field in the row that I am clicking in, without messing up the remove instance command.
    Ideas?
    Dave

Maybe you are looking for