Nested Table having more than 1 column comparison using ORACLE MULTISET

Dear ALL,
I am using ORACLE 10gR2 Database.
I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
But When I am executing the below given code I am getting the error.
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
My Code
declare
type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
device_info_id number,scope_id number,excep_id number,
config_date date);
type wh_previous_data_table is table of wh_unique_record;
wh_previous_data wh_previous_data_table;
wh_current_data wh_previous_data_table;
wh_union_data wh_previous_data_table;
wh_intersect_data wh_previous_data_table;
-- This cursor I am using to populate the data into the nested tables
cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
begin
open c_previous_data;
fetch c_previous_data bulk collect into wh_previous_data;
close c_previous_data;
open c_current_data;
fetch c_current_data bulk collect into wh_current_data;
close c_current_data;
dbms_output.put_line('Previous count '||wh_previous_data.count);
dbms_output.put_line('Current count '||wh_current_data.count);
--FYI: MULTISET UNION IS WORKING.*
wh_union_data := wh_current_data multiset union wh_previous_data;
dbms_output.put_line('New count '||wh_union_data.count);
wh_intersect_data:=wh_current_data MULTISET EXCEPT  wh_previous_data;
dbms_output.put_line('The records that are repeating are  '||wh_intersect_data.count);
end;
Previous count 74062
Current count 74508
New count 148570
PL/SQL procedure successfully completed.
FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
Appreciate your help on this.
Thanks,
Madhu K.

Madhu,
I am totally amazed. I didn't think any of the MULTISET operations would work with NTs of records. Lucky you!
As for the EXCEPT, well, clearly it is a restriction or bug in PL/SQL.
You may want to report it to Oracle Support.
Regards,SF
At 11:45 AM 10/1/2009, you wrote:
Dear Steven,
I am using ORACLE 10gR2 Database.
I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
But When I am executing the below given code I am getting the error.
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
My Code
declare
type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
device_info_id number,scope_id number,excep_id number,
config_date date);
type wh_previous_data_table is table of wh_unique_record;
wh_previous_data wh_previous_data_table;
wh_current_data wh_previous_data_table;
wh_union_data wh_previous_data_table;
wh_intersect_data wh_previous_data_table;
-- This cursor I am using to populate the data into the nested tables
cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
from r_cfg_wh_excep
where cpy_key=17278
and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
begin
open c_previous_data;
fetch c_previous_data bulk collect into wh_previous_data;
close c_previous_data;
open c_current_data;
fetch c_current_data bulk collect into wh_current_data;
close c_current_data;
dbms_output.put_line('Previous count '||wh_previous_data.count);
dbms_output.put_line('Current count '||wh_current_data.count);
--FYI: MULTISET UNION IS WORKING.
wh_union_data := wh_current_data multiset union wh_previous_data;
dbms_output.put_line('New count '||wh_union_data.count);
wh_intersect_data:=wh_current_data MULTISET EXCEPT wh_previous_data;
dbms_output.put_line('The records that are repeating are '||wh_intersect_data.count);
end;
Previous count 74062
Current count 74508
New count 148570
PL/SQL procedure successfully completed.
FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
Appreciate your help on this.
Thanks,
Madhu K.

Similar Messages

  • Trouble with the SQL smt to :list tables having more than 1000 rows

    Please I trying to list only tables having more than 1000 rows, but the sql stmt below doesn't work, can someone gives me a tips
    select table_name from user_tables where table_name in ( select table_name from user_tables where rownum > 1000 ) : The result is no rows!
    But I know that I have at lest 50 tables having more than 1000 rows
    Thanks a lot for the help

    If your tables are reasonably analyzed, then you can simply query:
    SELECT table_name,
           num_rows
      FROM user_tables
    WHERE num_rows >= 1000This will give you quite a reasonable estimate.
    Otherwise you have to go for dynamic sql or use the data dictionary to help you generate suitable scripts ....

  • Can i  create IN/UP/DE Trigger on a existing table having more than 2L rows

    Hi All,
    Can i create a INSERT/UPDATE/DELETE Trigger on a existing table having more than 2 lacs records ? if yes (is that works for only some kind of triggers? or for all ?). if not, tell me the reasons and limitations with guidelines.
    Thanks in Advance.

    Hi,
    Sure; you can create new triggers for tables that already have rows. The type of trigger and the number of rows already in the table don't matter.
    Try it. If the trigger works with a small table in your Development database, then there's no reason to expect it won't work on a larger table in your Production datbase.

  • Logical table having more than one Logical table sources

    Hi ,
    Is it possible a logical table has 2 logical table sources and there is no join between the underlying table of logical table sources?
    What will happen if we create the request which contains one attribute from each source?
    Will BI server return records with Cartesian join?
    Is it mandatory if logical table is having more than one logical table sources(exp. Logical table sources are X,Y and underlying table is A,B respectively),
    The underlying tables (A&B) must be joined ?
    Can someone explain the logic behind the logical table sources? How does it work?
    Any reference of document will be appreciable.
    Thanks,Ashish

    Hi Stijn,
    Thanks for response.
    You are saying that Oracle BI server will run a query against both tables and combine the results. But if there is no possibilty of any type of join, how BI server will combine the results from both tables.
    I have a scenario like below -
    Suppose i have 2 tables A and B at physical layer. Both table contains the information of any common subject area.
    But there is no attribute is common between A and B so not any kind of join possible between two.
    Now if i create a logical table with 2 logical table source A and B and create any request having one column from A and one from B ,
    What will happen? How BI server will combine the result? Will BI server not result records after Cartesian join.
    How can i model this scenario?

  • Interactive alv report......with one table having more than 2 foreign key

    *& Report  ZRAHUL_ALV_SFLIGHT2
    REPORT  zrahul_alv_sflight2 NO STANDARD PAGE HEADING.
    TYPE-POOLS slis.
    DATA: fcat TYPE slis_fieldcat_alv,
          it_fcat TYPE slis_t_fieldcat_alv,
          fcat1 TYPE slis_fieldcat_alv,
          it_fcat1 TYPE slis_t_fieldcat_alv,
          fcat2 TYPE slis_fieldcat_alv,
          it_fcat2 TYPE slis_t_fieldcat_alv,
          lout TYPE slis_layout_alv,
          head TYPE slis_listheader,
          it_head TYPE slis_t_listheader.
    TABLES: SFLIGHT, SCURX, SAPLANE.
    DATA: BEGIN OF it_sflight OCCURS 0,
            carrid TYPE sflight-carrid,      "PK
            connid TYPE sflight-connid,
            fldate TYPE sflight-fldate,
            currency TYPE sflight-currency,        "FK 1
            planetype TYPE sflight-planetype,      "FK 2
          END OF it_sflight.
    DATA: BEGIN OF it_scurx OCCURS 0,
            currkey TYPE scurx-currkey,        "PK 1
            currdec TYPE scurx-currdec,
          END OF it_scurx.
    DATA: BEGIN OF it_saplane OCCURS 0,
            planetype TYPE saplane-planetype,      "PK 2
            seatsmax TYPE saplane-seatsmax,
            tankcap TYPE saplane-tankcap,
            weight TYPE saplane-weight,
          END OF it_saplane.
    SELECTION-SCREEN: BEGIN OF BLOCK blk WITH FRAME TITLE t.
    SELECT-OPTIONS: id FOR it_sflight-carrid,
                    id2 FOR it_sflight-connid.
    SELECTION-SCREEN END OF BLOCK blk.
    INITIALIZATION.
      t = 'enter required criterias'.
      lout-zebra = 'X'.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE it_sflight
                WHERE carrid IN id AND connid IN id2.
    END-OF-SELECTION.
    ****FCAT F0R IT_SFLIGHT
      fcat-col_pos = 1.
      fcat-tabname = 'IT_SFLIGHT'.
      fcat-fieldname = 'CARRID'.
      fcat-outputlen = 10.
      fcat-seltext_m = 'PLANE ID'.
      APPEND fcat TO it_fcat.
      CLEAR fcat.
      fcat-col_pos = 2.
      fcat-tabname = 'IT_SFLIGHT'.
      fcat-fieldname = 'CONNID'.
      fcat-outputlen = 10.
      fcat-seltext_m = 'CONN ID'.
      APPEND fcat TO it_fcat.
      CLEAR fcat.
      fcat-col_pos = 3.
      fcat-tabname = 'IT_SFLIGHT'.
      fcat-fieldname = 'FLDATE'.
      fcat-outputlen = 10.
      fcat-seltext_m = 'FLDATE'.
      APPEND fcat TO it_fcat.
      CLEAR fcat.
      fcat-col_pos = 4.
      fcat-tabname = 'IT_SFLIGHT'.
      fcat-fieldname = 'CURRENCY'.
      fcat-outputlen = 10.
      fcat-seltext_m = 'CURRENCY'.
      APPEND fcat TO it_fcat.
      CLEAR fcat.
      fcat-col_pos = 5.
      fcat-tabname = 'IT_SFLIGHT'.
      fcat-fieldname = ';PLANETYPE'.
      fcat-outputlen = 10.
      fcat-seltext_m = 'PLANETYPE'.
      APPEND fcat TO it_fcat.
      CLEAR fcat.
    *****GRID DISPLAY
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        I_INTERFACE_CHECK                 = ' '
        I_BYPASSING_BUFFER                = ' '
        I_BUFFER_ACTIVE                   = ' '
        i_callback_program                = 'ZRAHUL_ALV_SFLIGHT2'
        I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'CLICK'
         i_callback_top_of_page            = 'HEADER'
        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = ' '
         i_grid_title                      = 'GRID 1'
        I_GRID_SETTINGS                   =
         is_layout                         = lout
         it_fieldcat                       = it_fcat
        IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 =
        IT_SORT                           =
        IT_FILTER                         =
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = ' '
        IS_VARIANT                        =
        IT_EVENTS                         =
        IT_EVENT_EXIT                     =
        IS_PRINT                          =
        IS_REPREP_ID                      =
        I_SCREEN_START_COLUMN             = 0
        I_SCREEN_START_LINE               = 0
        I_SCREEN_END_COLUMN               = 0
        I_SCREEN_END_LINE                 = 0
        I_HTML_HEIGHT_TOP                 = 0
        I_HTML_HEIGHT_END                 = 0
        IT_ALV_GRAPHICS                   =
        IT_HYPERLINK                      =
        IT_ADD_FIELDCAT                   =
        IT_EXCEPT_QINFO                   =
        IR_SALV_FULLSCREEN_ADAPTER        =
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           =
        ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_sflight
      EXCEPTIONS
        PROGRAM_ERROR                     = 1
        OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *&      Form  header
          text
    FORM header.
      CLEAR it_head.
      head-typ = 'H'.
      head-info = 'KINGFISHER'.
      APPEND head TO it_head.
      head-typ = 'S'.
      head-key = 'KEY'.
      head-info = 'AIRLINES'.
      APPEND head TO it_head.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_head
         i_logo                   = 'KING_LOGO'
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    "header
    *&      Form  CLICK
          text
         -->OK         text
         -->SEL        text
    FORM click USING ok TYPE sy-ucomm
                     sel TYPE slis_selfield.
      CLEAR it_fcat.
      CASE ok.
        WHEN '&IC1'.
    ********SAPLANE RELATION
          READ TABLE it_sflight INDEX sel-tabindex.
          SELECT * FROM saplane INTO CORRESPONDING FIELDS OF TABLE it_saplane WHERE planetype = it_sflight-planetype.
          fcat-col_pos = 1.
          fcat-tabname = 'IT_SAPLANE'.
          fcat-fieldname = 'PLANETYPE'.
          fcat-outputlen = 10.
          fcat-seltext_m = 'TYPE OF PLANE'.
          APPEND fcat TO it_FCAT.
          CLEAR fcat.
          fcat-col_pos = 2.
          fcat-tabname = 'IT_SAPLANE'.
          fcat-fieldname = 'SEATSMAX'.
          fcat-outputlen = 10.
          fcat-seltext_m = 'MAX SEATS'.
          APPEND fcat TO it_FCAT.
          CLEAR fcat.
          fcat-col_pos = 3.
          fcat-tabname = 'IT_SAPLANE'.
          fcat-fieldname = 'TANKCAP'.
          fcat-outputlen = 10.
          fcat-seltext_m = 'FUEL TANK CAPACITY'.
          APPEND fcat TO it_FCAT.
          CLEAR fcat.
          fcat-col_pos = 4.
          fcat-tabname = 'IT_SAPLANE'.
          fcat-fieldname = 'WEIGHT'.
          fcat-outputlen = 10.
          fcat-seltext_m = 'WEIGHT F PLANE'.
          APPEND fcat TO it_FCAT.
          CLEAR fcat.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
             i_callback_program                = 'ZRAHUL_ALV_SFLIGHT2'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
             i_callback_top_of_page            = 'HEADER'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
             i_grid_title                      = 'GRID 2'
      I_GRID_SETTINGS                   =
             is_layout                         = LOUT
             it_fieldcat                       = IT_FCAT
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
            tables
              t_outtab                          = IT_SAPLANE
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *******SCURX RELATION
                    CLEAR: IT_FCAT2,IT_FCAT.
                    READ TABLE IT_SFLIGHT INDEX SEL-TABINDEX.
                      SELECT * FROM SCURX INTO CORRESPONDING FIELDS OF TABLE IT_SCURX WHERE CURRKEY = IT_SFLIGHT-CURRENCY.
                      FCAT2-COL_POS = 1.
                      FCAT2-TABNAME = 'IT_SCURX'.
                      FCAT2-FIELDNAME = 'CURRKEY'.
                      FCAT2-OUTPUTLEN = 15.
                      FCAT2-SELTEXT_M = 'CURRENCY'.
                      APPEND FCAT2 TO IT_FCAT2.
                      CLEAR FCAT2.
                      FCAT2-COL_POS = 2.
                      FCAT2-TABNAME = 'IT_SCURX'.
                      FCAT2-FIELDNAME = 'CURRDEC'.
                      FCAT2-OUTPUTLEN = 15.
                      FCAT2-SELTEXT_M = 'CURRENCY DEC'.
                      APPEND FCAT2 TO IT_FCAT2.
                      CLEAR FCAT2.
                      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                       EXPORTING
                        I_INTERFACE_CHECK                 = ' '
                        I_BYPASSING_BUFFER                = ' '
                        I_BUFFER_ACTIVE                   = ' '
                         I_CALLBACK_PROGRAM                = 'ZRAHUL_ALV_SFLIGHT2'
                        I_CALLBACK_PF_STATUS_SET          = ' '
                        I_CALLBACK_USER_COMMAND           = ' '
                         I_CALLBACK_TOP_OF_PAGE            = 'HEADER'
                        I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                        I_CALLBACK_HTML_END_OF_LIST       = ' '
                        I_STRUCTURE_NAME                  =
                        I_BACKGROUND_ID                   = ' '
                         I_GRID_TITLE                      = 'GRID 3'
                        I_GRID_SETTINGS                   =
                         IS_LAYOUT                         = LOUT
                         IT_FIELDCAT                       = IT_FCAT2
                        IT_EXCLUDING                      =
                        IT_SPECIAL_GROUPS                 =
                        IT_SORT                           =
                        IT_FILTER                         =
                        IS_SEL_HIDE                       =
                        I_DEFAULT                         = 'X'
                        I_SAVE                            = ' '
                        IS_VARIANT                        =
                        IT_EVENTS                         =
                        IT_EVENT_EXIT                     =
                        IS_PRINT                          =
                        IS_REPREP_ID                      =
                        I_SCREEN_START_COLUMN             = 0
                        I_SCREEN_START_LINE               = 0
                        I_SCREEN_END_COLUMN               = 0
                        I_SCREEN_END_LINE                 = 0
                        I_HTML_HEIGHT_TOP                 = 0
                        I_HTML_HEIGHT_END                 = 0
                        IT_ALV_GRAPHICS                   =
                        IT_HYPERLINK                      =
                        IT_ADD_FIELDCAT                   =
                        IT_EXCEPT_QINFO                   =
                        IR_SALV_FULLSCREEN_ADAPTER        =
                      IMPORTING
                        E_EXIT_CAUSED_BY_CALLER           =
                        ES_EXIT_CAUSED_BY_USER            =
                        TABLES
                          t_outtab                          = IT_SCURX
                      EXCEPTIONS
                        PROGRAM_ERROR                     = 1
                        OTHERS                            = 2
                      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                      ENDIF.
      ENDCASE.
    ENDFORM.                    "click
    this program runs fine when one navigation is used......but when both the foreign keys come in picture then its shows sequencialy...cant we jump directly to the third one which i require....
    plz guide me.thank u.

    in short i want help on table having multiple foreign keys....and how to navigate in this when working on ALV reports.....
    its easy when using interactive reports by using sy-cucol and sy-curow.....
    reply asap.
    thank u in advance.

  • Trigger to insert unique data into other table (having more than 40 millions of records) - MYSQL

    Hi All,
    i am facing impact of trigger in MYSQL, scenario is this:
    I am Having one table with duplicate records that is consist of (eid,tin,status and some other columns are also there but i need only these three).  there is another table which is having same these three columns (eid, tin, status).
    eid and tin will be same for given combination only status will be different i.e.
    1245 23 0
    1245 23 1
    1245 23 5
    1233 33 3
    1211 24 2
    1211 24 5
    so as per above example i have to feed data into other table as
    1245 23 0
    1233 33 3
    1211 24 5
    priority of status is like 0 will be inserted if that is present in record otherwise it will be decrease from 5 to 1.
    so i have designed trigger for this which will insert data after reading each row, but it is taking around 6.5 minutes for inserting 300000 records. so is there any other way to improve performance  for this mysql program.
    DELIMITER $$
    CREATE
        /*[DEFINER = { user | CURRENT_USER }]*/
        TRIGGER `kyr_log`.`upd_status` AFTER INSERT
        ON `kyr_log`.`kyrlog_bup`
        FOR EACH ROW
        BEGIN
    DECLARE v_eid VARCHAR(28);
    DECLARE v_status INT(11);
    SELECT kyrl_eid,kyrl_status INTO v_eid,v_status FROM kyrlog_bup ORDER BY kyrl_id DESC LIMIT 1;
       IF v_eid NOT IN (SELECT kyrl_eid FROM update_status.new_status) THEN
    INSERT INTO update_status.new_status(kyrl_eid,kyrl_tin,kyrl_status)
    SELECT kyrl_eid,kyrl_tin,kyrl_status FROM kyrlog_bup ORDER BY kyrl_id DESC LIMIT 1;
       ELSE IF v_status=2 THEN
    IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
              UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
    END IF;
       ELSE IF v_status=3 THEN
    IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
              UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;  
    END IF;
       ELSE IF v_status=4 THEN
    IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
               UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid; 
    END IF;
       ELSE IF v_status=5 THEN
    IF v_status > ANY (SELECT kyrl_status FROM kyrlog_bup WHERE kyrl_eid=v_eid AND kyrl_status<>0) THEN
               UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;
    END IF;
               ELSE IF v_status=0 THEN
    UPDATE update_status.new_status SET kyrl_status=v_status WHERE kyrl_eid=v_eid;            
              END IF;
           END IF;
           END IF;
           END IF;
           END IF;
           END IF;
        END;
    $$
    DELIMITER ;
    please suggest me if there is  possibility of any other solution.
    thanks

    actually you didn't have seen discussion on this link , there are many discussion related to MYSQL . and mysql is owned by oracle. so i post it here.
    thanks for suggestion

  • SAPCL Having more than one DB2 use the same trace directory.

    Hello,
    Looking at the DBACOCKPIT SAP Collector settings panel, we have all of the DB2 subsystems that run in a given LPAR use the same trace directory.  (HFS path of trace directory.)
    In our case, that directory is /usr/sap/saposcol/traces.  This means that we have trace files called db2cl* from all of our alert routers running on an LPAR in the same directory.  It is a little confusing, but we can handle it.  The question I have is that there is a cmds.alr file in that same directory.  The contents of that file seem to change occasionally.  At times throughout the day, the file seems to be contain information related to the five alert routers using that trace directory.  Is it OK for the contents of this file to change?
    Another question I have is related to the sapcl file that is in this directory.  The timestamp on this file seems to change periodically.  Sometimes the file size changes.  Note 958252, the SAPCL FAQ says "The trace directory is required to save errors or trace files and to start the alert router. To start the alert router, the system loads the executable SAPCL from the database, saves it temporarily in the trace directory and starts it in USS."
    With 5 alert routers, sharing the same trace directory, you could end up with 5 sapcl executables that get changed around based on what a particular alert router needs.
    Would it be better to point each alert router to a different trace directory?
    Thanks,
    Ron Foster

    Hello,
    There are two configuration parameters in transaction DBACOCKPIT -> u201CSAP Collector Settingsu201D to determine the SAPCL directories.
    HFS path of collector:
    This is the directory, where the files u201CDBRM.db2cldbu201D and u201Csapdb2clu201D are located. The two files are used during installation of SAPCL and u201Ccopiedu201D into two targets:
    A) Linked into DB2 Load library to be used as the stored procedure SAPCL.
    B) Stored into a database table to be used as Alert Router.
    This directory is accessed during installation only. Not during runtime.
    HFS path of trace directory:
    This is the directory, where trace files are stored of the stored procedure SAPCL and the Alert Router. In addition, this is used during startup of the Alert Router. Startup of the Alert Router is done by the following steps:
    1. Unload the Alert Router executable out of the database table into the file u201Csapclu201D.
    2. Creating the Alert Router parameter file u201Ccmds.alru201D. E.g. it contains the SSID.
    3. The executable sapcl is started and the name of the Alert Router parameter file is used as the input parameter of sapcl to determine the behavior. E g.  /u/sapr3/s12run/trace/sapcl /u/sapr3/s12run/trace/cmds.alr
    To keep the input parameters files separate for each SSID, it is recommended to have a trace directory for each SSID. It is also recommended to have a trace directory for each DB2 member of a data sharing group. However, this is just a recommendation. Every time, an Alert Router is stared, the files u201Csapclu201D and u201Ccmds.alru201D are recreated and overwrite the existing files. After startup of the Alert Router, the two files are no more used.
    In the case, where you are using different patch levels or versions of SAPCL and you are using the same trace directory for all SSIDs, it is very likely, that you see different sizes of the file u201Csapclu201D. This is because different patch levels or versions of SAPCL have different sizes and you always see the file size of the most recent stared Alert Router.
    In case, that two Alert Routers are stared at the exactly same time, it could end up in problems.
    Here is an example of the contents of cmds.alr of a two way data sharing group with the SSIDs SGC1 and SGC2 with a shred directory /u/sapr3/jotrun:
    ssid=SGC1 sqlid=SAPJOT planname=CSAPCL FKTID=13 ACE=0 DBTRACE=0 TRACE=0 TRCDIR=/u/sapr3/jotrun/traceSGC1 GUID=4D0685A211780174E10080000A11C971
    ssid=SGC2 sqlid=SAPJOT planname=CSAPCL FKTID=13 ACE=0 DBTRACE=0 TRACE=0 TRCDIR=/u/sapr3/jotrun/traceSCG2 GUID=4D0685C411780174E10080000A11C971
    You can see, that almost all parameters are the same, except u201Cssidu201D and u201CTRCDIRu201D. TRCDIR come from the SAP Collector Settings parameter u201CHFS path of trace directoryu201D. Please note that there is not slash between u201Ctraceu201D and u201CSGCu201D. The directory name is u201CtraceSGC1u201D and u201CtraceSGC2u201D.
    Regards
        Dirk
    Dirk Nakott, IBM, DBACOCKPIT development

  • Handling internal table with more than 1 million record

    Hi All,
    We are facing dump for storage parameters wrongly set.
    Basically the dump is due to the internal table having more than 1 million records. We have increased the storage parameter size from 512 to 2048 , still the dump is happening.
    Please advice is there any other way to handle these kinds of internal table.
    P:S we have tried the option of using hashed table, this does not suits our scenario.
    Thanks and Regards,
    Vijay

    Hi
    your problem can be solved by populating the internal table in chunks. for that you have to use Database Cursor concept.
    hope this code helps.
    G_PACKAGE_SIZE = 50000.
      * Using DB Cursor to fetch data in batch.
      OPEN CURSOR WITH HOLD DB_CURSOR FOR
             SELECT *
               FROM ZTABLE.
        DO.
        FETCH NEXT CURSOR DB_CURSOR
           INTO CORRESPONDING FIELDS OF TABLE IT_ZTABLE
           PACKAGE SIZE G_PACKAGE_SIZE.
        IF SY-SUBRC NE 0.
          CLOSE CURSOR DB_CURSOR.
          EXIT.
        ENDIF.

  • Create pagination for table contain more than 2 PK

    Guys;
    Is there any way to use the wizard for creating FORM PAGINATION for tables having more than 2 PK??
    Regards;

    Hi dimitri;
    after the user login & start using this form thiswhat should happen to these 3 PKs:
    -1st PK will be a unique number for the questions.
    -2nd PK should be the ID for each survey ( created as global variable in Zero Page ).
    -3rd PK will be the division for this user (also created as a global variable in ZERO PAGE)..so this is the only field which will nt be changed while the user is logged..
    i tried to use the 1st 2 PKs...& set the last one to get a default value..it worked in the begining but gave me the 1st record for each Survey but my problem that i couldnt navigate to the 2nd record..& after that once i log out & relogin it willnt give me anything.
    Regards;
    ehammad

  • Row chaining in table with more than 255 columns

    Hi,
    I have a table with 1000 columns.
    I saw the following citation: "Any table with more then 255 columns will have chained
    rows (we break really wide tables up)."
    If I insert a row populated with only the first 3 columns (the others are null), is a row chaining occurred?
    I tried to insert a row described above and no row chaining occurred.
    As I understand, a row chaining occurs in a table with 1000 columns only when the populated data increases
    the block size OR when more than 255 columns are populated. Am I right?
    Thanks
    dyahav

    user10952094 wrote:
    Hi,
    I have a table with 1000 columns.
    I saw the following citation: "Any table with more then 255 columns will have chained
    rows (we break really wide tables up)."
    If I insert a row populated with only the first 3 columns (the others are null), is a row chaining occurred?
    I tried to insert a row described above and no row chaining occurred.
    As I understand, a row chaining occurs in a table with 1000 columns only when the populated data increases
    the block size OR when more than 255 columns are populated. Am I right?
    Thanks
    dyahavYesterday, I stated this on the forum "Tables with more than 255 columns will always have chained rows." My statement needs clarification. It was based on the following:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#i4383
    "Oracle Database can only store 255 columns in a row piece. Thus, if you insert a row into a table that has 1000 columns, then the database creates 4 row pieces, typically chained over multiple blocks."
    And this paraphrase from "Practical Oracle 8i":
    V$SYSSTAT will show increasing values for CONTINUED ROW FETCH as table rows are read for tables containing more than 255 columns.
    Related information may also be found here:
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c11schem.htm
    "When a table has more than 255 columns, rows that have data after the 255th column are likely to be chained within the same block. This is called intra-block chaining. A chained row's pieces are chained together using the rowids of the pieces. With intra-block chaining, users receive all the data in the same block. If the row fits in the block, users do not see an effect in I/O performance, because no extra I/O operation is required to retrieve the rest of the row."
    http://download.oracle.com/docs/html/B14340_01/data.htm
    "For a table with several columns, the key question to consider is the (average) row length, not the number of columns. Having more than 255 columns in a table built with a smaller block size typically results in intrablock chaining.
    Oracle stores multiple row pieces in the same block, but the overhead to maintain the column information is minimal as long as all row pieces fit in a single data block. If the rows don't fit in a single data block, you may consider using a larger database block size (or use multiple block sizes in the same database). "
    Why not a test case?
    Create a test table named T4 with 1000 columns.
    With the table created, insert 1,000 rows into the table, populating the first 257 columns each with a random 3 byte string which should result in an average row length of about 771 bytes.
    SPOOL C:\TESTME.TXT
    SELECT
      SN.NAME,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    INSERT INTO T4 (
    COL1,
    COL2,
    COL3,
    COL255,
    COL256,
    COL257)
    SELECT
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3)
    FROM
      DUAL
    CONNECT BY
      LEVEL<=1000;
    SELECT
      SN.NAME,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    SET AUTOTRACE TRACEONLY STATISTICS
    SELECT
    FROM
      T4;
    SET AUTOTRACE OFF
    SELECT
      SN.NAME,
      SN.STATISTIC#,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    SPOOL OFFWhat are the results of the above?
    Before the insert:
    NAME                      VALUE                                                
    table fetch continue        166
    After the insert:
    NAME                      VALUE                                                
    table fetch continue        166                                                
    After the select:
    NAME                 STATISTIC#      VALUE                                     
    table fetch continue        252        332  Another test, this time with an average row length of about 12 bytes:
    DELETE FROM T4;
    COMMIT;
    SPOOL C:\TESTME2.TXT
    SELECT
      SN.NAME,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    INSERT INTO T4 (
      COL1,
      COL256,
      COL257,
      COL999)
    SELECT
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3)
    FROM
      DUAL
    CONNECT BY
      LEVEL<=100000;
    SELECT
      SN.NAME,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    SET AUTOTRACE TRACEONLY STATISTICS
    SELECT
    FROM
      T4;
    SET AUTOTRACE OFF
    SELECT
      SN.NAME,
      SN.STATISTIC#,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    SPOOL OFFWith 100,000 rows each containing about 12 bytes, what should the 'table fetch continued row' statistic show?
    Before the insert:
    NAME                      VALUE                                                
    table fetch continue        332 
    After the insert:
    NAME                      VALUE                                                
    table fetch continue        332
    After the select:
    NAME                 STATISTIC#      VALUE                                     
    table fetch continue        252      33695The final test only inserts data into the first 4 columns:
    DELETE FROM T4;
    COMMIT;
    SPOOL C:\TESTME3.TXT
    SELECT
      SN.NAME,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    INSERT INTO T4 (
      COL1,
      COL2,
      COL3,
      COL4)
    SELECT
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3),
    DBMS_RANDOM.STRING('A',3)
    FROM
      DUAL
    CONNECT BY
      LEVEL<=100000;
    SELECT
      SN.NAME,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    SET AUTOTRACE TRACEONLY STATISTICS
    SELECT
    FROM
      T4;
    SET AUTOTRACE OFF
    SELECT
      SN.NAME,
      SN.STATISTIC#,
      MS.VALUE
    FROM
      V$MYSTAT MS,
      V$STATNAME SN
    WHERE
      SN.NAME = 'table fetch continued row'
      AND SN.STATISTIC#=MS.STATISTIC#;
    SPOOL OFFWhat should the 'table fetch continued row' show?
    Before the insert:
    NAME                      VALUE                                                
    table fetch continue      33695
    After the insert:
    NAME                      VALUE                                                
    table fetch continue      33695
    After the select:
    NAME                 STATISTIC#      VALUE                                     
    table fetch continue        252      33695 My statement "Tables with more than 255 columns will always have chained rows." needs to be clarified:
    "Tables with more than 255 columns will always have chained rows +(row pieces)+ if a column beyond column 255 is used, but the 'table fetch continued row' statistic +may+ only increase in value if the remaining row pieces are found in a different block."
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.
    Edited by: Charles Hooper on Aug 5, 2009 9:52 AM
    Paraphrase misspelled the view name "V$SYSSTAT", corrected a couple minor typos, and changed "will" to "may" in the closing paragraph as this appears to be the behavior based on the test case.

  • Table with more than 35 columns

    Hello All.
    How can one work with a table with more than 35 columns
    on JDev 9.0.3.3?
    My other question is related to this.
    Setting Entities's Beans properties from a Session Bean
    bought up the error, but when setting from inside the EJB,
    the bug stays clear.
    Is this right?
    Thank you

    Thank you all for reply.
    Here's my problem:
    I have an AS400/DB2 Database, a huge and an old one.
    There is many COBOL Programs used to communicate with this DB.
    My project is to transfer the database with the same structure and the same contents to a Linux/ORACLE System.
    I will not remake the COBOL Programs. I will use the existing one on the Linux System.
    So the tables of the new DB should be the same as the old one.
    That’s why I can not make a relational DB. I have to make an exact migration.
    Unfortunately I have some tables with more than 5000 COLUMNS.
    Now my question is:
    can I modify the parameters of the ORACE DB to make it accept Tables and Views with more than 1000 columns, If not, is it possible to make a PL/SQL Function that simulate a table, this function will insert/update/select data from many other small tables (<1000 columns). I want to say a method that make the ORACLE DB acting like if it has a table with a huge number of columns;
    I know it's crazy but any idea please.

  • Compressed tables with more than 255 columns

    hi,
    Would anyone have a sql to find out compressed tables with more than 255 columns.
    Thank you
    Jonu

    SELECT table_name,
           Count(column_name)
    FROM   user_tab_columns utc
    WHERE  utc.table_name IN (SELECT table_name
                              FROM   user_tables
                              WHERE  compression = 'ENABLED')
    HAVING Count(column_name) > 255
    GROUP  BY table_name

  • General Scenario- Adding columns into a table with more than 100 million rows

    I was asked/given a scenario, what issues do you encounter when you try to add new columns to a table with more than 200 million rows? How do you overcome those?
    Thanks in advance.
    svk

    For such a large table, it is better to add the new column to the end of the table to avoid any performance impact, as RSingh suggested.
    Also avoid to use any default on the newly created statement, or SQL Server will have to fill up 200 million fields with this default value. If you need one, add an empty column and update the column by using small batches (otherwise you lock up the whole
    table). Add the default after all the rows have a value for the new column.

  • Spatial index creation for table with more than one geometry columns?

    I have table with more than one geometry columns.
    I'v added in user_sdo_geom_metadata table record for every column in the table.
    When I try to create spatial indexes over geometry columns in the table - i get error message:
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 8
    ORA-06512: at line 1
    What is the the solution?

    I'v got errors in my user_sdo_geom_metadata.
    The problem does not exists!

  • Can I create a table with more than 40 columns ?

    Hello,
    I need to organize my work with a table and need about 66 columns. I am not very good with Numbers but I know a little bit of Pages. I cannot find a way to create a table with more than 40 columns... Is it hopeless ? (Pages '08 v. 3.0.3)
    Thank you all

    It's never too late to try to teach users that the Search feature is not only for helpers.
    The number of columns allowed in Numbers is not a relevant value when the question is about Pages '08 tables.
    I tried to copy a 256 columns Numbers table into a Pages '09 document.
    I didn't got a table but values separated by TABs.
    I tried to convert this text range in a table and got this clear message :
    If I remember well, in Pages '08, the limit is 40 columns.
    It seems that you are a specialist of inaccurate responses, but I'm not a moderator so I'm not allowed to urtge you to double check what you wrote before posting.
    Yvan KOENIG (VALLAURIS, France) vendredi 29 avril 2011 14:57:58
    Please :
    Search for questions similar to your own before submitting them to the community

Maybe you are looking for