PLSQL table Count giving NO_DATA_FOUND Error

Hi Everyone,
I am having a Associative array define below :
TYPE SchQryRecTyp IS RECORD (
load_port port_call.lcn_code%type
, load_call port_call.call%type
, dsch_port port_call.lcn_code%type
, dsch_call port_call.call%type
, vsl_code port_call.vsl_code%type
, vsl_name vsl.vsl_name%type
, voy_code port_call.voy_code%type
, line_code port_call.line_code%type
, etd port_call.etd%type
, eta port_call.eta%type
, transit_tm number
, load_area_uid area_master_rly.area_uid%type
, load_port_qry port_call.lcn_code%type
, dsch_area_uid area_master_rly.area_uid%type
, dsch_port_qry port_call.lcn_code%type
, flag varchar2(4)
, inact_flg varchar2(1)
, final_or_doc_lock varchar2(1)
TYPE SchQry_Tab_Typ IS TABLE OF SchQryRecTyp
INDEX BY BINARY_INTEGER;
1 ) Now in my code I am polulating the the PLSQL table SchQry_Tab_Typ and
2) based on that PLSQL table data I am again trying to Fetch some other data.
But I came accross a problem which i am mentioning below :
When i am trying to perform the task (2) I am running a Loop i.e.
IF vroute2.COUNT > 0 THEN
FOR a IN 1..vroute2.COUNT LOOP
-- dbms_output.put_line(vroute2(a).vsl_code); **--(But while accessing the value it is giving ORA-01403 - No Data Found )*
END LOOP;
END IF;
But when i changed the loop like this
IF vroute2.COUNT > 0 THEN
FOR a IN vroute2.FIRST..vroute2.LAST LOOP
-- dbms_output.put_line(vroute2(a).vsl_code); **--(Program executed successfully)*
END LOOP;
END IF;
Can anybody help me if they have experienced such problem and the reason for this ?

Wrong forum!
Please mark this question ANSWERED and repost it in the SQL and PL/SQL forum.
PL/SQL
When you post provide your 4 digit Oracle version.

Similar Messages

  • Divide two counts giving an error

    I've a query in the following structure where im trying to divide in the select statement like this:
    SELECT cnt1/ cnt2
    FROM (SELECT count(*) cnt1, col1, col2
    FROM emp),
    (SELECT COUNT(*) cnt2, col1, col2
    FROM all_tables);
    How can i bring in additional fields from emp or all_tables (i.e col1 and col2)? I can get the divide calculation done but not able to get the other two fields in the main select statement as it gives me following error. These two columns col1 and col2 are there in both the tables.
    00904. 00000 - "%s: invalid identifier"
    Edited by: 1010059 on Jun 5, 2013 12:53 PM

    Hi,
    Welcome to the forum!
    1010059 wrote:
    I've a query in the following structure where im trying to divide in the select statement like this:
    SELECT cnt1/ cnt2
    FROM (SELECT count(*) cnt1, col1, col2
    FROM emp),
    (SELECT COUNT(*) cnt2, col1, col2
    FROM all_tables);
    How can i bring in additional fields from emp or all_tables (i.e col1 and col2)? I can get the divide calculation done but not able to get the other two fields in the main select statement as it gives me an error.How do you want to bring those columns in? I can't picture what the results would look like, or what you might want to achieve.
    Whenever you have a problem, please post CREATE TABLE and INSERT statements for a little sample data, and the exact results you want from that data.
    When you use an aggregate function, such as COUNT, the output of the query will contain 1 row for every group as defined by the GROUP BY clause. If there is no GROUP BY clause, the output will have 1 row.
    You probably have hundreds of rows in all_tables, but even if you had only 2 or 3 rows, what would you want to display in the last 2 columns on the 1 row that the sub-query produces? The same goes for the sub-query on emp.
    Take a few minutes to read the forum FAQ {message:id=9360002} It shows lots of ways to get better replies faster on this forum.

  • How to get the plsql table data into output cursor

    Hi,
    Could anybody please help me.
    Below is an example of the scenario..
    CREATE OR REPLACE PACKAGE chck IS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR);
    TYPE get_rec is record (ename varchar2(20),
    eno number(12));
    TYPE t_recs IS TABLE OF get_rec INDEX BY BINARY_INTEGER;
    emp_tab t_recs;
    END chck;
    CREATE OR REPLACE PACKAGE BODY chck AS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR)
    is
    BEGIN
    select ename, eno
    bulk collect into emp_tab
    from emp;
    open oc_result_cursor for select * from table(emp_tab); -- I believe something is wrong here ....
    END;
    END chck;
    the above package is giving me an error:
    LINE/COL ERROR
    10/29 PL/SQL: SQL Statement ignored
    10/43 PL/SQL: ORA-22905: cannot access rows from a non-nested table
    item
    let me know what needs to be changed
    Thanks
    Manju

    manjukn wrote:
    once i get the data into a plsql table, how to get this plsql table data into the cursor?There is no such thing as a PL/SQL table - it is an array.
    It is nothing at all like a table. It cannot be indexed, partitioned, cluster, etc. It does not exist in the SQL engine as an object that can be referenced. It resides in expensive PGA memory and needs to be copied (lock, stock and barrel) to the SQL engine as a bind variable.
    It is an extremely primitive structure - and should never be confused as being just like a table.
    Its use in SQL statements is also an exception to the rule. Sound and valid technical reasons need to justify why one want to push a PL/SQL array to the SQL engine to run SELECT 's against it.

  • Plsql table initialize

    hi,
    plz help regarding initializing a plsql table
    declare
    type numlist is table of integer;
    nums numlist;
    c varcar2(20) := '10,20,30'
    begin
    nums := numlist(c); --i want to use the variable here but it's showing error
    end;
    i need a method for this. the value is coming through a comma separated string.
    plz help me out.
    regards,
    akp

    AKP,
    Try this:
    declare
      type numlist is table of integer index by binary_integer;
      nums numlist;
      c varchar2(200) := '10, 20, 30';
      procedure comma_to_array (i_list in varchar2, o_array out numlist)
      is
        l_list varchar2(4000) := i_list;
        l_first_comma binary_integer;
        i binary_integer := 1;
      begin
        while length(l_list) > 0 loop
          l_first_comma := instr(l_list, ',');
          begin
            if l_first_comma > 0 then
              o_array(i) := to_number(substr(l_list, 1, l_first_comma-1));
            else
              o_array(i) := to_number(l_list);
              l_first_comma := length(l_list);
            end if;
          exception
            when others then
              -- Handle errors of number conversion here. For this example simply setting value to -1
              o_array(i) := -1;
          end;
          l_list := substr(l_list, l_first_comma+1);
          i := i + 1;
        end loop;     
      end comma_to_array;
    begin
      comma_to_array(c, nums);
      if nums.count > 0 then
        for i in nums.first .. nums.last
        loop
          dbms_output.put_line('num('||i||')='||nums(i));
        end loop;
      end if;
    end;I hope that helps.
    -Roger

  • Help with PLSQL table population.....

    Hi all,
    I am populating a PLSQL table from a cursor and then inserting into a target table using FORALL.
    While populating, I need two two records differing only by the process_name.
    Say my populated PLSQL table should look like this.
    vt_proc_status_tbl:
    1     76     Pname_A     20     Sysdate     1     U     1
    1     76     Pname_B     20     Sysdate     1     U     1
    How can I create duplicate records like this inside the PLSQL table varying only by process_name????
    OPEN cur_fcst_sites_ppo;
    FETCH cur_fcst_sites_ppo
    BULK COLLECT INTO vt_fcst_sites_tbl;
    CLOSE cur_fcst_sites_ppo;
    FOR v_idx_fcst_sites IN 1 .. vt_fcst_sites_tbl.COUNT
    LOOP
    BEGIN
    SELECT seq_ods_site_process_status.NEXTVAL
    INTO v_odssiteprocessid
    FROM DUAL;
    END;
    v_pst_idx := v_pst_idx + 1;
    vt_proc_status_tbl (v_pst_idx).odssiteprocessid :=
    v_odssiteprocessid;
    vt_proc_status_tbl (v_pst_idx).SYSTEM := pi_system;
    vt_proc_status_tbl (v_pst_idx).process_name := pi_process_name;
    vt_proc_status_tbl (v_pst_idx).siteid :=
    vt_fcst_sites_tbl (v_idx_fcst_sites).siteid;
    vt_proc_status_tbl (v_pst_idx).bday := pi_transferday;
    vt_proc_status_tbl (v_pst_idx).is_no := pi_is_no;
    vt_proc_status_tbl (v_pst_idx).rest_status := c_status_unprocessed;
    vt_proc_status_tbl (v_pst_idx).batch_id := v_batch_id;
    v_cntr := v_cntr + 1;
    IF v_cntr = pi_sites_at_a_time
    THEN
    v_batch_id := v_batch_id + 1;
    v_cntr := 0;
    END IF;
    v_odssiteprocessid := NULL;
    END LOOP;
    IF v_pst_idx > 0
    THEN
    BEGIN
    FORALL v_proc_status_tbl_idx IN 1 .. vt_proc_status_tbl.COUNT
    INSERT INTO ods_site_process_status
    VALUES vt_proc_status_tbl (v_proc_status_tbl_idx);
    END;
    ELSE
    v_code := NULL;
    SELECT SUBSTR ( '[M]:0- No Site Available for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ppo, 'IS_NO '
    || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    END IF;
    Thanks in Advance.
    Jagadish
    Edited by: user646716 on Oct 12, 2008 10:08 AM
    Edited by: user646716 on Oct 12, 2008 12:02 PM

    hi aweiden,
    Please find my entire code below.
    what I am trying to achieve is that when my plsql table vt_proc_status_tbl is populated, I want two different rows to be populated for different process names (i.e bmi_ppo and bmi_ai ) and load it into ODS_SITE_PROCESS_STATUS table so that i do not have to alter my forall statement.
    Thanks for the help
    PROCEDURE p_mfcst_transform_master (
    pi_system IN mfcst_ppo.SYSTEM%TYPE,
    pi_is_ no IN mfcst_ppo.is_no%TYPE,
    pi_transferday IN mfcst_ppo.transferday%TYPE,
    pi_sites_at_a_time IN NUMBER,
    pi_process_name IN ods_site_process_status.process_name%TYPE,
    po_status OUT NUMBER,
    po_error OUT VARCHAR2
    AS
    -- Cursor to get sites to be processed for bmi to ppo transformation process
    CURSOR cur_fcst_sites_ppo
    IS
    SELECT DISTINCT siteid
    FROM sci_restaurant
    WHERE hist_load_status in ('L','H')
    AND SYSTEM = pi_system
    ORDER BY siteid;
    -- Cursor to get sites to be processed for bmi to ai transformation process
    -- Note this cursor is based on the system and transfer day
    TYPE sites_tbltype IS TABLE OF cur_fcst_sites_ppo%ROWTYPE
    INDEX BY PLS_INTEGER;
    vt_fcst_sites_tbl sites_tbltype;
    TYPE proc_status_tbltype IS TABLE OF ods_site_process_status%ROWTYPE
    INDEX BY PLS_INTEGER;
    vt_proc_status_tbl proc_status_tbltype;
    v_cnt NUMBER := 0;
    v_cntr NUMBER := 0;
    v_batch_id NUMBER := 1;
    v_pst_idx PLS_INTEGER := 0;
    v_k PLS_INTEGER := 0;
    v_odssiteprocessid ods_site_process_status.odssiteprocessid%TYPE;
    v_exceptionid NUMBER;
    --variable to log exception into sci_exception table
    BEGIN
    --- If sites were identitfied before, skip the rest of the execution
    --- Note that ods_site_process_status holds the status from the prior runs
    po_error := '';
    po_status := 0;
    scimf_common.p_get_market_parameters (NULL,
    pi_system,
    vr_market,
    v_error_out
    IF v_error_out IS NOT NULL
    THEN
    RAISE e_market_not_found;
    END IF;
    IF pi_process_name = c_transform_bmi_ppo
    THEN
    SELECT COUNT (*)
    INTO v_cnt
    FROM ods_site_process_status
    WHERE SYSTEM = pi_system
    AND process_name = pi_process_name
    AND is_no = pi_is_no
    AND ROWNUM < 2;
    ELSIF pi_process_name = c_transform_bmi_ai
    THEN
    SELECT COUNT (*)
    INTO v_cnt
    FROM ods_site_process_status
    WHERE SYSTEM = pi_system
    AND process_name = pi_process_name
    AND rest_status = c_status_processed
    AND ROWNUM < 2;
    ELSE
    v_code := NULL;
    v_errm :=
    SUBSTR ( '[E]:0- Process Name :>'
    || pi_process_name
    || '<Is Not Proper For System:>'
    || pi_system
    || '< and IS_NO :>'
    || pi_is_no
    || '< and TransferDay :>'
    || pi_transferday
    || '<',
    1,
    125
    DBMS_OUTPUT.put_line (v_errm);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform',
    v_errm,
    vr_market.marketid,
    'I'
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || v_errm;
    po_status := -1;
    -- Log Exception in the log file and come out.
    END IF;
    IF NVL (v_cnt, 0) > 0
    THEN
    IF pi_process_name = c_transform_bmi_ppo
    THEN
    SELECT SUBSTR
    ( ':0- Sites are already identified before for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ppo, 'IS_NO ' || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..'
    || 'proceeding to invoke child scripts',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    ELSIF pi_process_name = c_transform_bmi_ai
    THEN
    SELECT SUBSTR
    ( '[I]:0- Sites are already identified before for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ai, 'IS_NO ' || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..'
    || 'proceeding to invoke child scripts',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    END IF;
    ELSIF NVL (v_cnt, 0) = 0
    THEN
    OPEN cur_fcst_sites_ppo;
    FETCH cur_fcst_sites_ppo
    BULK COLLECT INTO vt_fcst_sites_tbl;
    CLOSE cur_fcst_sites_ppo;
    END IF;
    -- Logic to batch the sites to be processed in the batches of
    -- sites derived from the pi_sites_at_a_time parameter
    -- Batch_Id starts with 1 and need to used along with
    -- either is_no (bmi-ppo) and process name or along with
    -- system, bday and process_name (bmi-ai)
    IF pi_sites_at_a_time IS NULL
    THEN
    v_code := NULL;
    v_errm := 'Site At A Time not defined';
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || v_errm;
    po_status := -1;
    raise_application_error (-200002, v_errm);
    END IF;
    FOR v_idx_fcst_sites IN 1 .. vt_fcst_sites_tbl.COUNT
    LOOP
    BEGIN
    SELECT seq_ods_site_process_status.NEXTVAL
    INTO v_odssiteprocessid
    FROM DUAL;
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.put_line ( '[E]:0- Sequence :>'
    || 'seq_ods_site_process_status'
    || ' <Is Invalid>'
    || '<'
    v_errm :=
    SUBSTR ( 'Sequence seq_ods_site_process_status Error:'
    || SQLERRM,
    1,
    125
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform',
    v_errm,
    vr_market.marketid,
    'I'
    po_error :=
    TO_CHAR (SQLCODE) || ' -Error Message: '
    || v_errm;
    po_status := -1;
    raise_application_error (-200002, v_errm);
    END;
    v_pst_idx := v_pst_idx + 1;
    vt_proc_status_tbl (v_pst_idx).odssiteprocessid :=
    v_odssiteprocessid;
    vt_proc_status_tbl (v_pst_idx).SYSTEM := pi_system;
    vt_proc_status_tbl (v_pst_idx).process_name := pi_process_name;
    vt_proc_status_tbl (v_pst_idx).siteid :=
    vt_fcst_sites_tbl (v_idx_fcst_sites).siteid;
    vt_proc_status_tbl (v_pst_idx).bday := pi_transferday;
    vt_proc_status_tbl (v_pst_idx).is_no := pi_is_no;
    vt_proc_status_tbl (v_pst_idx).rest_status := c_status_unprocessed;
    vt_proc_status_tbl (v_pst_idx).batch_id := v_batch_id;
    v_cntr := v_cntr + 1;
    IF v_cntr = pi_sites_at_a_time
    THEN
    v_batch_id := v_batch_id + 1;
    v_cntr := 0;
    END IF;
    v_odssiteprocessid := NULL;
    END LOOP;
    IF v_pst_idx > 0
    THEN
    BEGIN
    FORALL v_proc_status_tbl_idx IN 1 .. vt_proc_status_tbl.COUNT
    INSERT INTO ods_site_process_status
    VALUES vt_proc_status_tbl (v_proc_status_tbl_idx);
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    v_error_count := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.put_line
    ( '[E]:0- Bulk Insert Fail using FORALL Number of Failure:>'
    || v_error_count
    || '<'
    FOR v_i IN 1 .. v_error_count
    LOOP
    v_errm :=
    SUBSTR
    ( '[E]:Error Insert into ODS_SITE_PROCESS_STATUS table '
    || 'Insert Error: '
    || v_i
    || ' Array Index: '
    || SQL%BULK_EXCEPTIONS (v_i).ERROR_INDEX
    || SQLERRM
    (-SQL%BULK_EXCEPTIONS (v_i).ERROR_CODE),
    1,
    125
    DBMS_OUTPUT.put_line (v_errm);
    END LOOP;
    v_code := NULL;
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    po_error :=
    TO_CHAR (SQLCODE) || ' -Error Message: '
    || v_errm;
    po_status := -1;
    END;
    ELSE
    v_code := NULL;
    SELECT SUBSTR ( '[M]:0- No Site Available for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ppo, 'IS_NO '
    || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    END IF;
    END IF;
    COMMIT;
    po_status := NVL (po_status, 0);
    EXCEPTION
    WHEN e_market_not_found
    THEN
    ROLLBACK;
    v_code := NULL;
    v_errm := SUBSTR ('[E]:Error Market Not Found ' || SQLERRM, 1, 125);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    raise_application_error (-200001,
    'Market parameter not found for system'
    || pi_system
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || SQLERRM;
    po_status := -1;
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.put_line ( '[E]:0-ERROR :-- '
    || ' --SQLCODE: '
    || SQLCODE
    || ' -Error Message: '
    || SQLERRM
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || SQLERRM;
    po_status := -1;
    END;

  • Report giving runtime error

    hi,
    i HAD MADE A REPORET IN which i havce to display the bolck stock ,it is giving runtime error as i had added 1 more table,plzz help me out as it is really urgent to me. here is d code:-
    *& Report  ZDEMO_SMARTFORM_COPY
    REPORT  ZDEMO_SMARTFORM_COPY.
    TABLES: MCHB,MARA,T001W.
    DATA: BEGIN OF ITAB OCCURS 0,
          ITEMID LIKE MARD-MATNR,
          SPEME LIKE MARD-SPEME,
          WERKS LIKE MARD-SPEME,
          LGORT LIKE MARD-LGORT,
          NTGEW LIKE MARA-NTGEW,
          MEINS LIKE MARA-MEINS,
          GEWEI LIKE MARA-GEWEI,
          CHARG LIKE MCHB-CHARG,
          WTKG LIKE MARA-NTGEW,
          STOCK TYPE P LENGTH 10 DECIMALS 3,
          DESC LIKE MAKT-MAKTX,
          TOTWT LIKE MARD-SPEME,
          WT TYPE P LENGTH 12 DECIMALS 3,
          END OF ITAB.
         ITEMID LIKE MCHB-MATNR,
         CSPEM LIKE MCHB-CSPEM,
         CHARG LIKE MCHB-CHARG,
         WERKS LIKE MCHB-WERKS,
    *PARAMETERS : PLANT LIKE MCHB-WERKS OBLIGATORY.
    PARAMETERS : PLANT LIKE MARD-WERKS OBLIGATORY.
    DATA : DESC LIKE MAKT-MAKTX.
      SELECT AMATNR ASPEME AWERKS ALGORT BNTGEW BMEINS BGEWEI CCHARG FROM MARD AS A
        INNER JOIN MARA AS B ON BMATNR = AMATNR
          INNER JOIN MCHB AS C ON CMATNR = AMATNR
            INTO TABLE ITAB WHERE AWERKS = PLANT AND ASPEME > 0.
    SELECT AMATNR ACSPEM ACHARG AWERKS  BNTGEW BMEINS B~GEWEI FROM MCHB AS A
       INNER JOIN MARA AS B ON BMATNR = AMATNR
         INTO TABLE ITAB WHERE AWERKS = PLANT AND ACSPEM > 0.
    WRITE: / 'ITEMID           DESCRIPTION                              STOCK.QTY  BATCH NO.           NETWT          TOTAL.WEIGHT '.
    ULINE.
    LOOP AT ITAB.
          IF ITAB-NTGEW <> 0 .
            CALL FUNCTION 'ZGET_ITEM_WEIGHT'
             EXPORTING
               P_BUID         = ITAB-WERKS
               P_ITEMID       = ITAB-ITEMID
               P_QTY          = ITAB-NTGEW
               P_UOM          = ITAB-GEWEI
               P_UOM1         = 'KG'
             IMPORTING
               P_RETVAL       = ITAB-WTKG.
          ENDIF.
       CONVERTING ITEM QTY IN KG
          ITAB-WT = ITAB-STOCK.
          IF ITAB-MEINS = 'G'.
            ITAB-WT = ITAB-STOCK / 1000000.
          ELSEIF ITAB-MEINS = 'KG'.
            ITAB-WT = ITAB-STOCK / 1000.
          ELSEIF ITAB-MEINS = 'TO'.
            ITAB-WT = ITAB-STOCK * ITAB-WTKG / 1000.
         ENDIF.
       ITAB-TOTWT = ITAB-WTKG * ITAB-CSPEM.
       ITAB-TOTWT = ITAB-WTKG * ITAB-SPEME.
       SELECT SINGLE MAKTX FROM MAKT INTO DESC WHERE MATNR = ITAB-ITEMID.
         WRITE:/ ITAB-ITEMID,15 DESC,50 ITAB-SPEME,ITAB-CHARG,ITAB-WTKG,ITAB-TOTWT.
       MODIFY ITAB.
       ENDLOOP.

    HI,
    i had tried to ftech data from mard and it isgiving runtime error. dis is the code:-
    TABLES: MCHB,MARA,MARD.
    DATA: BEGIN OF ITAB OCCURS 0,
          MATNR LIKE MARD-MATNR,
          SPEME LIKE MARD-SPEME,
          WERKS LIKE MARD-SPEME,
          LGORT LIKE MARD-LGORT,
          END OF ITAB.
          SELECT MATNR SPEME WERKS LGORT FROM MARD INTO CORRESPONDING FIELDS OF TABLE ITAB.
          LOOP AT ITAB.
          WRITE:/ ITAB-MATNR,ITAB-SPEME,ITAB-WERKS,ITAB-LGORT.
          ENDLOOP.

  • How to improve performance using bulk collects with plsql tables or arrays

    Hi All,
    my procedure is like this
    declare
    cursor c1 is select ----------------------
    begin
    assigning to variables
    validations on that variables
    --50 validations are here --
    insert into a table
    end;
    we have created indexes on primary keys,
    i want to use
    DECLARE
    CURSOR a_cur IS
    SELECT program_id
    FROM airplanes;
    TYPE myarray IS TABLE OF a_cur%ROWTYPE;
    cur_array myarray;
    BEGIN
    OPEN a_cur;
    LOOP
    FETCH a_cur BULK COLLECT INTO cur_array LIMIT 100;
    ***---------can i assign cursor data to the plsql table variables or array***
    ***validate on the pl sql variable as---***
    i
    nsert into a table
    EXIT WHEN a_cur%NOTFOUND;
    END LOOP;
    CLOSE a_cur;
    END;
    Edited by: Veekay on Oct 21, 2011 4:28 AM

    Fastest way often is this:
    insert /*+append */
    into aTable
    select * from airplanes;
    commit;The select and insert part can even be done in parallel if needed.
    However if the oparation is complex or the dataset is very very very very very large or the programmer is decent but not excellent then the bulk approach should be considered. It is often a pretty stable and linear scaling approach.
    The solution depends a little on the database version.
    LOOP
      FETCH a_cur BULK COLLECT INTO cur_array LIMIT 100;
      EXIT WHEN a_cur.count = 0;
      forall i in a_cur.first.. a_cur.last
      insert into aTable (id)
      values (a_cur(i));
    END LOOP;
    ...If you have more then one column then you might need a single collection for each column. Other possibilities depend on the db version.
    Also: do not exit using a_cur%NOTFOUND. This is wrong! You might loose records from the end of the data set.

  • Hi I am using an iphone 4 and its was working fine.  Presently its giving browsing error.  Whenever I am trying to browse internet by using safari or any other browser it retruns with "server not responding" Can somebody give me a solution for this ?

    Hi I am using an iphone 4 and its was working fine.  Presently its giving browsing error.  Whenever I am trying to browse internet by using safari or any other browser it retruns with an error message "server not responding" Even the same thing is happening with youtube also. The worst part is am able to check my mails, able to chat and so on... only thing not able to browse through the browser.  I have tried restore option also.  This is happening with both Wlan and Data con. too
    Please help...

    I do not really know much about this kind of problem, but i may be your internet connection.
    If you are on your own #G network then:
    Go to Settings > then enable "Airplane Mode". Count to 10 and then disable it.
    Then wait patiently until you get a good connection and then try again.
    If you are on a nearby Wi-Fi connection then:
    Go to Settings > Wi-Fi > then disable then enable after counting to 10. Make sure that you are connected and then try again.
    If all else fails, then you need to contact your provider for assistance.
    Sprint:888-211-4727
    AT&T:?
    Verizon:?

  • How to retrieve data from plsql table in BI publisher Data template

    Hi All,
    I have created a data template for XML publisher report. In data template i m getting data from plsql table. for that i have created one package with pipelined function. I am able to run that sql from sql developer .But if i run the concurrent program then i got error like "java.sql.SQLSyntaxErrorException: ORA-00904: "XXXXX": invalid identifier".
    I have used the same parameters in Data template and concurrent program....
    please clarify me what needs to be done....
    thanks in advance....
    Regards,
    Doss

    Hi Alex ,
    i am using pipelined function and get the data from cursor and load it into plsql table (nested table). and i use the below in my data template to fetch the data:
    <sqlStatement name="Q1">
    <![CDATA[select * from  table(PO_SPEND_RPT_PKG.generate_report(P_ORG_ID,P_SOB_ID,P_ORG_NAME,P_PERIOD_NAME,P_CLOSE_STATUS,P_E_PCARD_NEED,P_REPORT_TYPE))]]>
    </sqlStatement>
    if i run the above in sql developer i can get the result....from apps if i run i got the error "java.sql.SQLSyntaxErrorException: ORA-00904: "P_ORG_ID": invalid identifier"
    Edited by: kalidoss on Sep 14, 2012 4:32 AM

  • Mapping of PLSQL  table type  Date to java

    i am having problem in mapping plsql table type DATE in java,
    able to execute procedures which return plsql table type NUMBER,VARCHAR.
    i am using oracle 9 , jdk1.4, oci driver, windows 2000.
    sample code:
    registering:
    st.registerIndexTableOutParameter(15,100,OracleTypes.DATE,1000);
    st.registerIndexTableOutParameter(16,100,OracleTypes.DATE,1000);
    st.execute();
    getting out params in arrays:
    java.sql.Date[] O_lSubFolder_CrOn=(java.sql.Date[])java.sql.Date[] st.getPlsqlIndexTable(15);
    O_lSubFolder_MdOn=(java.sql.Date[])st.getPlsqlIndexTable(16);
    error while executing the code:
    java.sql.SQLException: Invalid PL/SQL Index Table element type
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
    at oracle.jdbc.driver.OraclePreparedStatement.checkPlsqlIndexTableBindTypes(OraclePreparedSt
    atement.java:2705)
    at oracle.jdbc.driver.OracleCallableStatement.registerIndexTableOutParameter(OracleCallableS
    tatement.java:834)
    can anyone help me to solve this problem.

    i am having problem in mapping plsql table type
    DATE in java,
    able to execute procedures which return plsql table
    type NUMBER,VARCHAR.
    i am using oracle 9 , jdk1.4, oci driver, windows
    2000.
    sample code:
    registering:
    st.registerIndexTableOutParameter(15,100,OracleTypes.D
    TE,1000);
    st.registerIndexTableOutParameter(16,100,OracleTypes.D
    TE,1000);
    st.execute();
    getting out params in arrays:
    java.sql.Date[]
    O_lSubFolder_CrOn=(java.sql.Date[])java.sql.Date[]
    st.getPlsqlIndexTable(15);
    O_lSubFolder_MdOn=(java.sql.Date[])st.getPlsqlIndexTab
    e(16);
    can anyone help me to solve this problem.1. Write a wrapper procedure that converts the table of dates to either number or date and then re-convert the table back into date.
    2. Since it's an out param you could create a temp table, insert the contents of the index by array into it and return a cursor.
    3. Create a oracle type using CREATE TYPE and then use an array of the type.
    David Rolfe
    Orinda Software

  • How can I resolve Exception : "Count Field Incorrect" error

    Hi all,
    I am experiencing with "Count Field incorrect" error. What's wrong with it? How can I resolve it?
    This error is occured at UPDATE function of SQL. My JSP page is to update the old record.
    Sometimes, "Update statement error" message appear. These two problems I always confusing.
    What are the possible point of these error in my Java file and JSP page? I use package import to JSP Page.
    Pls help me.
    With thanks,

    Thanks,
    Your URLs help me exectly. But after I have changed my code, the error is changed to "Too Few Parameters : Expected 35". What's wrong with it? The following is my code.
    try {                                                                                                                                                                                                                
    String DRIVER = ("sun.jdbc.odbc.JdbcOdbcDriver");               
    String URL = "jdbc:odbc:Industrial_One_DSN";
    String sql = "UPDATE BusinessRegistration " +
    "SET [Date] = ?, ISIC = ?, BizName = ?, BizAddress = ?, " +
    "OwnerName = ?, OwnerNRC = ?, Investment = ?, EstablishedYear = ?, " +
    "L_Male = ?, L_Female = ?, F_Male = ?, F_Female = ?, " +
    "OwnershipType = ?, Remarks = ?, IndustialZoneName = ?, Unit = ?, " +
    "Fuel = ?, FactoryType = ?, FactoryName = ?, Township = ? " +
    "MainProductName = ?, MainProductCountType = ?, " +
    "MainProductQuantity = ?, MainProductValue = ?, RMName = ?, " +
    "RMCountType = ?, RMQuantity = ?, RMValue = ?, EnergyName = ?, " +
    "MachinePower = ?, AmountGallon = ?, StateDiv = ?, BizSize = ?  " +
    "WHERE RegistrationID = ?";
    Class.forName(DRIVER);
    Connection con = DriverManager.getConnection(URL);
    PreparedStatement pstmt = con.prepareStatement(sql);
    int ilmale = Integer.parseInt(lmale);
    int ilfemale = Integer.parseInt(lfemale);
    int ifmale = Integer.parseInt(fmale);
    int iffemale = Integer.parseInt(ffemale);
    int impq = Integer.parseInt(mpq);
    int impv = Integer.parseInt(mpv);
    int irmq = Integer.parseInt(rmq);
    int irmv = Integer.parseInt(rmv);
    int iamountgallon = Integer.parseInt(amountgallon);
    pstmt.setString(1, date);
    pstmt.setString(2, isic);
    pstmt.setString(3, bizname);
    pstmt.setString(4, bizaddress);
    pstmt.setString(5, ownername);
    pstmt.setString(6, ownernrc);
    pstmt.setString(7, investment);
    pstmt.setString(8, eyear);
    pstmt.setInt(9, ilmale);
    pstmt.setInt(10, ilfemale);
    pstmt.setInt(11, ifmale);
    pstmt.setInt(12, iffemale);
    pstmt.setString(13, ownershiptype);
    pstmt.setString(14, remark);
    pstmt.setString(15, izn);
    pstmt.setString(16, unit);
    pstmt.setString(17, fuel);
    pstmt.setString(18, ft);
    pstmt.setString(19, fname);
    pstmt.setString(20, township);
    pstmt.setString(21, mpn);
    pstmt.setString(22, mpct);
    pstmt.setInt(23, impq);               
    pstmt.setInt(24, impv);
    pstmt.setString(25, rmname);
    pstmt.setString(26, rmct);
    pstmt.setInt(27, irmq);
    pstmt.setInt(28, irmv);
    pstmt.setString(29, ename);
    pstmt.setString(30, mpower);
    pstmt.setInt(31, iamountgallon);
    pstmt.setString(32, statediv);
    pstmt.setString(33, bizsize);
    pstmt.setInt(34, Integer.parseInt(rid));
    pstmt.executeUpdate();
    }I have got 35 fields in my db. But i wanna edit 34 fields only. I have no primary key in my table. Is't alright?
    pls keep on helping me.
    With thanks,
    WTDAHL

  • SQL from PLSQL Table

    Hi,
    I have a PLSQL Table with two columns.
    Is there a way where i can read the PLSQL Table data into SQL.
    Below is the sample code.
    Is there a way to get distinct records of contact_person and party_id
    IF x_msg_tbl.COUNT > 0
    THEN
    FOR i IN x_msg_tbl.FIRST .. x_msg_tbl.LAST
    LOOP
    IF x_msg_tbl.EXISTS (i)
    THEN
    LOG(x_msg_tbl(i).contact_person);
    LOG(x_msg_tbl(i).party_id);
    LOG(i);
    END IF;
    END LOOP;
    END IF;
    Thanks,
    Srikanth

    > Is there a way where i can read the PLSQL Table data into SQL.
    Pet peeve of mine - calling an array or collection a PL/SQL "table". There is no such thing as a PL/SQL table. The term "table", especially in the RDBMS context we're using PL/SQL, has a very specific meaning.
    And an array or collection in PL/SQL is nothing at all like a table.
    But because of this term, developers are under the very misguided impression that arrays/collections in PL/SQL can be treated as tables. To the point where they want to use SQL against them.. because they are mistakenly and very incorrectly called "tables".
    SQL against a PL/SQL structure is expensive. Why? Because the SQL engine cannot run against data structures in the PL/SQL engine. That data structure needs to be 'shipped' from PL/SQL to SQL, cast into a SQL structure, in order for the SQL engine to run SQLs against it.
    Which begs the question then - why is that data not in the SQL engine in the first place? Something like a temp session table will be a lot more flexible, scalable and a lot faster.
    The best place for data is in Oracle tables. Not in PL/SQL collections are arrays.
    Why then PL/SQL collections and arrays? For the same reason these primitive data structures exist in most other 3GL languages. Dealing with local programming data in a structure way. And in PL/SQL specifically, to create a larger buffer for shipping data between PL/SQL and SQL (bulk processing) in order to reduce context switching. It is not intended as an alternative to a database table.
    And as soon as you want to use SQL against it, you are saying you want it to be like a database table. In which case why are you not using a database table?

  • Dynamically Access a plsql table

    If I have 2 plsql tables :
    vt1_games and vt2_games that I usuallly update with the
    following:
    vt1_games(vt1_count) := ......
    or
    vt2_games(vt2(count) := ......
    How can I use a variable for the plsql table name and pointer?
    Thanks,
    Paul

    I've moved this question to the correct forum.

  • (NOLOCK) is giving syntax error

    Hi,
    I have query which runs properly in 1 server and in the other server it gives syntax error because of (NOLOCK).
    When i remove (NOLOCK) its working fine.
    my query is a big one...
    But it is something like
    INSERT INTO @abc
    SELECT a.id,SUM(b.count) FROM
    (SELECT DISTINCT id FROM table1 (NOLOCK)) AS a
    INNER JOIN Table2 (NOLOCK) AS b
    GROUP BY a.id
    It is giving syntax error at only one (NOLOCK) that is near Table2 in one server and in other server it works fine...
    Both the server versions are exactly same...
    What is the reason?

    First, it is generally a bad idea to post a follow-up "me, too" response to an old and answered question.  Fewer people will look at an answered question generally. 
    Next, the reason this thread provides no information about the original problem and the solution is because the complete problem was not posted.  If your query generates an error message, it is important to see the complete and actual error message.
    Given the conversation, it is likely that there was a syntax error in the various statements that OP tried and it was a happy accident that the removal of the hint caused the error to go away. 
    Lastly one should refrain from using hints generally.  For some unfathomable reason there is a myth that it is a good practice to use the nolock hint. 

  • How to compare two PLSQL tables dynamically.

    Hi,
    Can you any body help for the following scenario,
    I have two PLSQLtables with same structure ,Each PLSQL table contains more than 100 columns.
    Now I want to compare content of the two PLSQL tables column wise.
    I Knew allready one method like below
    FOR I IN 1..100
    LOOP
    IF PLSQL_1_TAB(I).ACCT_NO = PLSQL_2_TAB(I).ACCT_NO THEN
    INSERT INTO …....
    END IF;
    END LOOP;
    is there any method to compare two PLSQL tables dynamically
    Edited by: RAVI KUMAR.T.V. on May 5, 2011 11:51 PM

    Hi Saubhik,
    Thanks for your reply..
    See the below code..
    DECLARE
    CURSOR cur_emp IS
    SELECT *
    FROM emp
    WHERE job = 'MANAGER';
    TYPE typ1 IS TABLE OF emp%ROWTYPE INDEX BY BINARY_INTEGER;
    v_pl_old typ1;
    v_pl_new typ1;
    BEGIN
    OPEN cur_emp;
    FETCH cur_emp INTO v_pl_old(1);
    CLOSE cur_emp;
    UPDATE emp SET comm = comm+1000 WHERE hiredate < '01-MAY-1981' AND job = 'MANAGER';
    COMMIT;
    OPEN cur_emp;
    FETCH cur_emp INTO v_pl_new(1);
    CLOSE cur_emp;
    IF v_pl_old(1) = v_pl_new(1) THEN
    DBMS_OUTPUT.PUT_LINE('Latest comm not yet Updated');
    ELSE
    DBMS_OUTPUT.PUT_LINE('Latest comm Updated');
    END IF;
    END;
    When the above code is executed iam getting the following error :
    ORA-06550: line 19, column 19: PLS-00306: wrong number or types of arguments in call to '='
    ORA-06550: line 19, column 4: PL/SQL: Statement ignored
    Here in the example I have taken the standard EMP table, but
    actually, Iam having a bigger table with 90 columns of different datatypes,
    in which some of the columns gets updated after some UPDATE statements executed based on some conditions.
    Now, my requirement is to compare the values of each and every column in the table before and after the execution of the UPDATE statements,
    and to insert the modified values only along with the primary key column value into in a new table of similar structure.
    If I write the code (to compare the values of each and every column in the table, and if the value is modified then insert that value along with the primary key value into a different talbe) then as the table is having many columns (90), the code becomes lengthy..
    Is there any alternative method which does the same with shorter code.
    Can you please give me an idea/sol. to meet my requirement.
    Thanks..
    Edited by: RAVI KUMAR.T.V. on May 9, 2011 2:43 AM

Maybe you are looking for