Plz find error... ?? in pl/sql block...

i couldn't able to run the query ... may i know where i have gone wrong... plz don't tell me the new solution... but rather find the wrong code in my program...
1 DECLARE
2 CURSOR cursor_list_tables_db IS
3 SELECT table_name FROM user_tables WHERE table_name LIKE upper('emp%');
4 row_count NUMBER ;
5 BEGIN
6 FOR rec IN cursor_list_tables_db LOOP
7 SELECT count(*) INTO row_count FROM rec.table_name;
8 DBMS_OUTPUT.PUT_LINE (rec.table_name || ' ' || row_count);
9 END LOOP ;
10* END ;
I even replace the line 7 as ....
EXECUTE IMMEDIATE 'SELECT count(*) FROM REC.TABLE_NAME' INTO row_count ;
but still getting the same error....i.e
PL/SQL: ORA-00942: table or view does not exist
Regards...
Dichan

hi Jennesh ,
I am new to PL/SQL .
May I know Y
FOR rec IN cursor_list_tables_db LOOP
SELECT count(*) INTO row_count FROM rec.table_name;
is giving error
it is removed by
EXECUTE IMMEDIATE 'SELECT count(*) FROM '
||REC.TABLE_NAME INTO row_count ;
may i know the reason how it is recified . for the
first view it seems ok.
Thanks and Regads
Sachin
sql>
DECLARE
CURSOR cursor_list_tables_db IS
   SELECT table_name
   FROM user_tables
   WHERE table_name LIKE upper('emp%');
row_count NUMBER ;
BEGIN
dbms_output.put_line('First syntax results in this query-- Second syntax results in this query:');
FOR rec IN cursor_list_tables_db LOOP
    dbms_output.put_line('SELECT count(*) FROM '|| rec.table_name||'---SELECT count(*) FROM  rec.table_name ');
END LOOP;
END;
First syntax results in this query-- Second syntax results in this query:
SELECT count(*) FROM EMP---SELECT count(*) FROM rec.table_name
SELECT count(*) FROM EMP1---SELECT count(*) FROM rec.table_name
SELECT count(*) FROM EMP2---SELECT count(*) FROM rec.table_name
PL/SQL procedure successfully completed.
Message was edited by:
        jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Error in PL/SQL Block of Trigger

    Hi all,
    I have written a trigger whose PL/SQL block contains a simple select statment among many other statements.
    Now I find that, if the select statement returns no rows the trigger does not continue its operation further and aborts there itself. And if the select statement returns some rows, then it works fine.
    I tried to execute a simplified PL/SQL block of the trigger in SQL*Plus and following were the results:
    declare
    tempdate date;
    begin
    select trdt into tempdate from inv_trans;
    if sql%notfound then
    null;
    end if;
    end;
    When no data is present in inv_trans table, the result was:
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 4
    And when the table inv_trans had data, the result was:
    PL/SQL procedure successfully completed.
    Why is the piece of code flashing an error when I have already given a treatment if no data is found.
    Why is it taking "No Data in table" as an abnormal condition and not normal?
    THanks in advance
    Warm Regards
    Manu

    In your case you have to use a cursor:
    declare
      cursor c_cur is
        select trdt from inv_trans;
      r_cur   c_cur%rowtype;
    begin
      open c_cur;
      fetch c_cur into r_cur;
      if c_cur%notfound then
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Error executing pl sql block

    Hii All,
    I'm facing the following error
    ERROR at line 66:
    ORA-06550: line 66, column 20:
    PLS-00306: wrong number or types of arguments in call to '||'
    ORA-06550: line 66, column 11:
    PL/SQL: Statement ignoredVersion Details
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionMy pl sql block
    Declare
        p_table_name  clob := 'CP_CA_DTLS' ;
        Type t_column_name_tab is table of varchar2(4000)
        index by binary_integer;
        l_table_tab      t_column_name_tab;
        l_file_name constant varchar2(5000) := 'column_counts';
        l_count      number;
        l_tab_count    number;
        l_str    varchar2(32000);
        l_tbl_str  varchar2(32000);
      Cursor c_table_columns(c_table_name user_tables.table_name%type)
      Is
        Select  column_name
        from  user_tab_cols
        where  table_name = upper(c_table_name);
      Type t_table_columns is table of c_table_columns%rowtype;
       l_column_name_tab  t_table_columns;
    Begin
        --Splitting comma seperated data
        Select  regexp_substr(p_table_name,'[^,]+{1}',1,level)
        bulk collect into  l_table_tab
        from  dual
        connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
        for k in 1..l_table_tab.count
        loop
         -- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');   
          Begin
              l_tbl_str := 'Select count(*) from '||l_table_tab(k);
              execute immediate l_tbl_str into l_tab_count;
            --  dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_count);   
          End;
       -- dbg_print(l_file_name,'Column Name '||','||'Count'); 
        Open c_table_columns(l_table_tab(k));
        loop
          Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
          exit when l_column_name_tab.count = 0;
          dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
            for i in 1..l_column_name_tab.count
            loop
            Begin
              l_str := 'Select count(*) ' ;
              l_str := l_str||' from  '||l_table_tab(k) ;
              l_str := l_str||' where '||l_column_name_tab(i);
              l_str := l_str||' is null'  ;
              Execute Immediate l_str into l_count;
            End;
            --dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
            end loop;
        end loop;
        Close c_table_columns;
      end loop;
          dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
    End;Even I'm not able to print l_column_name_tab(i) using dbms_output.
    (Later I came to know that this information can be achieved using user_tab_col_statistics table)
    But would like to know whats wrong with my code.???
    Plz help me .
    Edited by: 792353 on Dec 3, 2010 1:26 AM

    Hii RDB,
    when I comment this part of code
      --   l_str := l_str||' where '||l_column_name_tab(i);
           --   l_str := l_str||' is null'  ;
    SQL> Declare
      2 
      3 
      4      p_table_name  clob := 'CP_CA_DTLS' ;
      5 
      6      Type t_column_name_tab is table of varchar2(4000)
      7      index by binary_integer;
      8     
      9      l_table_tab      t_column_name_tab;
    10    
    11 
    12 
    13 
    14      l_file_name constant varchar2(5000) := 'column_counts';
    15      l_count      number;
    16      l_tab_count    number;
    17      l_str    varchar2(32000);
    18      l_tbl_str  varchar2(32000);
    19   
    20    Cursor c_table_columns(c_table_name user_tables.table_name%type)
    21    Is
    22      Select  column_name
    23      from  user_tab_cols
    24      where  table_name = upper(c_table_name);
    25     
    26     
    27    Type t_table_columns is table of c_table_columns%rowtype;
    28   
    29   
    30     l_column_name_tab  t_table_columns;
    31   
    32  Begin
    33      --Splitting comma seperated data
    34     
    35      Select  regexp_substr(p_table_name,'[^,]+{1}',1,level)
    36      bulk collect into  l_table_tab
    37      from  dual
    38      connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
    39     
    40      for k in 1..l_table_tab.count
    41      loop
    42       -- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');   
    43       
    44        Begin
    45            l_tbl_str := 'Select count(*) from '||l_table_tab(k);
    46       
    47            execute immediate l_tbl_str into l_tab_count;
    48       
    49          --  dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_coun
    t);   
    50 
    51        End;
    52 
    53     -- dbg_print(l_file_name,'Column Name '||','||'Count'); 
    54 
    55      Open c_table_columns(l_table_tab(k));
    56      loop
    57        Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
    58        exit when l_column_name_tab.count = 0;
    59        dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
    60          for i in 1..l_column_name_tab.count
    61          loop
    62          
    63          Begin
    64            l_str := 'Select count(*) ' ;
    65            l_str := l_str||' from  '||l_table_tab(k) ;
    66         --   l_str := l_str||' where '||l_column_name_tab(i);
    67         --   l_str := l_str||' is null'  ;
    68         
    69            Execute Immediate l_str into l_count;
    70 
    71          End;
    72         
    73          --dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
    74       
    75          end loop;
    76      end loop;
    77      Close c_table_columns;
    78    end loop;
    79 
    80        dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
    81  End;
    82  /
    PL/SQL procedure successfully completed.its running fine so the problem is l_column_name_tab(i) !!!!!!
    and there is nothing wrong with l_table_tab(k) and its declaration.
    Edited by: 792353 on Dec 3, 2010 2:17 AM

  • Exception error  in PL/SQL block

    Hi,
    do the following conditions in a PL/SQL block cause an exception error to occur ?
    A- Select statement does not return a row.
    B- Select statement returns more than one row.
    Thank you.

    If you're talking about SELECT INTO then yes:
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as cmza
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    v_text varchar2(4000);
      3  begin
      4    -- question 1
      5    select banner
      6      into v_text
      7      from v$version;
      8  end;
      9  /
    declare
      v_text varchar2(4000);
    begin
      -- question 1
      select banner
        into v_text
        from v$version;
    end;
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at line 6
    SQL> declare
      2    v_text varchar2(4000);
      3  begin
      4    -- question 2
      5    select banner
      6      into v_text
      7      from v$version
      8     where 1 = 2;
      9  end;
    10  /
    declare
      v_text varchar2(4000);
    begin
      -- question 2
      select banner
        into v_text
        from v$version
       where 1 = 2;
    end;
    ORA-01403: no data found
    ORA-06512: at line 6
    SQL>

  • Error with PL/SQL block

    Hi
    If I run PL/SQL block
    DECLARE
    CURSOR C1 is SELECT CLM_CASE_NO FROM CLAIM_OBJECT.CLM_INVLVD_PRTY_T where CLM_CASE_NO=XXXX;
    BEGIN
    FOR X in C1 loop
    INSERT INTO POSTL_ADDRS_ARCHIVE P (SELECT A.* FROM CLAIM_OBJECT.POSTL_ADDRS A, CLAIM_OBJECT.CLM_INVLVD_PRTY_T C WHERE
    C.CLNT_NO = A.CLNT_NO AND C.CURR_ROW_IND='A' AND C.CLM_CASE_NO =X.CLM_CASE_NO );
    end loop;
    end;
    there is no error with the above block
    If I remove where clause in cursor and run block
    DECLARE
    CURSOR C1 is SELECT CLM_CASE_NO FROM CLAIM_OBJECT.CLM_INVLVD_PRTY_T;
    BEGIN
    FOR X in C1 loop
    INSERT INTO POSTL_ADDRS_ARCHIVE P (SELECT A.* FROM CLAIM_OBJECT.POSTL_ADDRS A, CLAIM_OBJECT.CLM_INVLVD_PRTY_T C WHERE
    C.CLNT_NO = A.CLNT_NO AND C.CURR_ROW_IND='A' AND C.CLM_CASE_NO =X.CLM_CASE_NO );
    end loop;
    end;
    ERROR at line 1:
    ORA-01013: user requested cancel of current operation
    ORA-06512: at line 12
    I searched for ORA-06512
    Cause:
         This error message indicates the line number in the PLSQL code that the error resulted.
    SELECT CLM_CASE_NO FROM CLAIM_OBJECT.CLM_INVLVD_PRTY_T has over 800,672 records.
    SELECT CLM_CASE_NO FROM CLAIM_OBJECT.CLM_INVLVD_PRTY_T where CLM_CASE_NO=XXXX; has 2 records.
    I am not not understanding why block 2 is throwing error (with no where clause in cursor)
    Any help will be greatly appreciated
    Thanks in advance

    As the error message indicates clearly the process was cancelled as you pressed CTRL+C. And yes you can’t see any data you insert in one session from other session until it gets committed. And as others have mentioned row by row operation is very expensive think about revising your approach.
    Instead of having a cursor why don’t you join it directly in you select in the insert statement and try?
    Thanks,
    Karthick.
    Message was edited by:
    karthick_arp

  • Error in PL/SQL block..

    Hi Im facing an error in the following code.. Cant trace it out.
    /* Formatted on 2009/10/21 22:09 (Formatter Plus v4.8.8) */
    DECLARE
       latest_task_id    NUMBER;
       task_name_em7      VARCHAR2 (50);
       select_flag_em7    NUMBER        := 1;
       ds_count_em7       NUMBER;
       stateid           NUMBER;
       ds_id_em7          NUMBER;
       server_id_em7      NUMBER;
    BEGIN
       SELECT server_id
         INTO server_id_em7
         FROM ems_servers
        WHERE server_name = :P82_EM7_COLLECTOR;
       FOR i IN 1 .. apex_application.g_f01.COUNT
       LOOP
          SELECT COUNT (*)
            INTO ds_count_em7
            FROM delivered_service_mapping
           WHERE equipment_id = apex_application.g_f01(i)
             AND termination_id IS NULL;
          IF ds_count_em7 = 0
          THEN
             MERGE INTO provision_em7 pem7
                USING (SELECT apex_application.g_f01(i) apex_equip_id_em7
                         FROM DUAL) a
                ON (    a.apex_equip_id_em7 = pem7.equipment_id
                    AND pem7.termination_id IS NULL)
                WHEN MATCHED THEN
                   UPDATE
                      SET "PROVISION_STATE_ID" = 2, "SERVER_ID" = server_id_em7,
                          "LAST_PROVISION_BY" = :app_user
                      WHERE provision_state_id IN (1, 4, 10, 5)
                WHEN NOT MATCHED THEN
                   INSERT (EQUIPMENT_ID, PROVISION_STATE_ID, ERROR_CODE,
                           SERVER_ID, LASTMODIFIED_BY, LAST_MODIFIED_ON,
                           REMARKS, COLLECTOR_IP, COLLECTION_STATE,CURRENT_STATE)
                   VALUES (a.apex_equip_id_em7,2,NULL,server_id_em7,:APP_USER,SYSDATE,NULL,NULL,NULL,NULL                     NULL, , , 'remarks_by_navarose for iv',
             SELECT delivered_service_id
               INTO ds_id_em7
               FROM delivered_service
              WHERE delivered_service_name = apex_application.g_f02(i);
             INSERT INTO delivered_service_mapping
                         (ID, customer_id,
                          equipment_id, termination_id, delivered_service_id,
                          last_modified_by, last_modified_on
                  VALUES (delivered_service_seq.NEXTVAL, NULL,
                          apex_application.g_f01(i), NULL, ds_id_em7,
                          :APP_USER, SYSDATE
             select_flag_em7 := 0;
          ELSE
             UPDATE delivered_service_mapping SET delivered_service_id = apex_application.g_f01(i),
             last_modified_by = :APP_USER, last_modified_on = SYSDATE;  
             select_flag_em7 := 0;
          END IF;
       END LOOP;
       IF select_flag_em7 = 0
       THEN
          IF P82_CHECK_TASK_NAME_EM7 = 1
          THEN
             IF :P82_CHECK_TASK_NAME_EM7 IS NULL
             THEN
                task_name_em7 :=
                      :app_user
                   || '_PROVISIONING PERIODIC EM7_'
                   || TO_CHAR (SYSDATE, 'YYYYMMDD_HHMISS');
                INSERT INTO tasks
                            (task_id, task_name, created_by,
                             created_on, task_action, task_state_id, server_id
                     VALUES (task_id_seq.NEXTVAL, task_name_em7, :app_user,
                             SYSDATE, 14, 1, server_id_em7
             ELSE
                INSERT INTO tasks
                            (task_id, task_name, created_by,
                             created_on, task_action, task_state_id, server_id
                     VALUES (task_id_seq.NEXTVAL, :P82_TASK_NAME_EM7, :app_user,
                             SYSDATE, 14, 1, server_id_em7
             END IF;
             SELECT MAX (task_id)
               INTO latest_task_id
               FROM tasks
              WHERE created_by = :APP_USER;
             FOR i IN 1 .. apex_application.g_f01.COUNT
             LOOP
                INSERT INTO task_details
                            (task_details_id,
                             equipment_id, task_id
                     VALUES (task_detail_seq.NEXTVAL,
                             apex_application.g_f01 (i), latest_task_id
             END LOOP;
          END IF;
       END IF;
    END;The errror is
    1 error has occurred
    ORA-06550: line 42, column 123: PL/SQL: ORA-00917: missing comma ORA-06550: line 28, column 10: PL/SQL: SQL Statement ignored

    Hi,
    This line:
    VALUES (a.apex_equip_id_em7,2,NULL,server_id_em7,:APP_USER,SYSDATE,NULL,NULL,NULL,NULL                     NULL, , , 'remarks_by_navarose for iv',needs a comma between the two nulls - there's just a huge gap instead!
    Andy

  • Error in pl/sql  block with parameters

    Hi,
    I have the following code which works in normal cursor forloops,
    Can some one please check how to achive the same functionality using bulk insert.( i want to use parameterised cursor)
    step 1 ---working
    declare
    CURSOR DEPT_inst
    is
    select d.deptno
    from dept d where d.dname='RESEARCH';
    CURSOR emp_inst (p_dept in number)
             IS
         SELECT e.empno ,
                e.ename  ,
                e.deptno
           from emp1 e
          where e.deptno = p_dept;
    begin
    for i in dept_inst loop
       delete from emp2 where deptno=i.deptno;
       for j in emp_inst(i.deptno) loop
          INSERT INTO emp2(empno,
                               ename,
                               deptno )
                       VALUES (j.empno,
                               j.ename,
                              j.deptno
    end loop;
    end loop;
    commit;
    exception
    when others then
    dbms_output.put_line( 'exception in err insert'||SQLERRM);
    ROLLBACK;
    end;
    step - 2  compilation error
    declare
    CURSOR DEPT_inst
    is
    select d.deptno
    from dept d where dname='RESEARCH';
    CURSOR emp_inst (p_dept in number)
             IS
         SELECT e.empno ,
                e.ename  ,
                e.deptno
           from emp1 e
          where e.dept = p_dept;
    TYPE id_tab_dep_1 IS TABLE OF dept_inst%ROWTYPE
                INDEX BY PLS_INTEGER;
         t_id_dep_1       id_tab_dep_1;
        TYPE id_tab_det_1 IS TABLE OF emp_inst(t_id_det_1(indxi).deptno)%ROWTYPE
                INDEX BY PLS_INTEGER;
         t_id_det_1       id_tab_det_1;
           BEGIN
             OPEN dept_inst;
               FETCH dept_inst
               LOOP
               BULK COLLECT into t_id_dep_1 LIMIT 100;
               EXIT WHEN t_id_dep_1.count <= 0;
             FOR indxi IN t_id_det_1.FIRST  .. t_id_det_1.LAST LOOP
                   delete from emp2 where deptno=t_id_det_1(indxi).deptno;
             OPEN emp_inst;
             LOOP
             FETCH emp_inst(t_id_det_1(indxi).deptno)
                 BULK COLLECT INTO t_id_det_1  limit 100;
                 EXIT WHEN t_id_det_1.count <= 0;
             FOR indxj IN t_id_det_1.FIRST  .. t_id_det_1.LAST LOOP
                     INSERT INTO emp2(empno,
                               ename,
                               deptno )
                       VALUES (t_id_det_1(indxj).empno,
                               t_id_det_1(indxj).ename,
                              t_id_det_1(indxj).deptno
              END LOOP;
              END LOOP;
              CLOSE emp_inst;
              END LOOP;
              END LOOP;
              CLOSE dept_inst;
            EXCEPTION
                   WHEN OTHERS
                   THEN
                      dbms_output.put_line( 'exception in err insert' || SQLCODE ||' ' ||SQLERRM);
                      ROLLBACK;
                      RETURN;
            END;
    I am getting below error
        TYPE id_tab_det_1 IS TABLE OF emp_inst(t_id_det_1(indxi).deptno)%ROWTYPE
    ERROR at line 16:
    ORA-06550: line 16, column 69:
    PLS-00103: Encountered the symbol "%" when expecting one of the following:
    ; not null alter index characterEdited by: user11289444 on Dec 26, 2010 3:58 AM

    hoek wrote:
    I was referring to OP's second Bulk DML, the insert part.
    You cannot reference individual columns there.Then you have to be even more specific. You cannot reference individual columns there unless you are on 11g:
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> declare
      2    cursor dept_inst
      3    is
      4    select d.deptno
      5    from   dept d
      6    where  d.dname = 'RESEARCH';
      7    --
      8    cursor emp_inst(b_deptno in number)
      9    is
    10    select e.empno
    11    ,      e.ename
    12    ,      e.deptno
    13    from   emp1 e
    14    where  e.deptno = b_deptno;
    15    --
    16    type depttype is table of number index by binary_integer;
    17    depttab depttype;
    18    type emptype is table of emp_inst%rowtype /*this will not work*/ index by binary_integer;
    19    emptab emptype;
    20    --
    21  begin
    22    --
    23    open dept_inst;
    24    loop
    25     
    26      fetch dept_inst bulk collect into depttab limit 100;
    27      forall i in depttab.first..depttab.last
    28        delete from emp2 where deptno = depttab(i);
    29         --
    30        dbms_output.put_line(sql%rowcount||' records were deleted from table emp2');
    31        --
    32  --      open emp_inst(depttab(i));
    33        open emp_inst(depttab(1));
    34        loop
    35          fetch emp_inst bulk collect into emptab limit 100;
    36          forall j in emptab.first..emptab.last
    37            insert into emp2 values(emptab(j).empno,emptab(j).ename,emptab(j).deptno);
    38          --
    39          exit when emp_inst%notfound;
    40          --
    41        end loop;
    42        exit when dept_inst%notfound;
    43        close dept_inst;         
    44      --
    45    end loop;
    46    close dept_inst;
    47  end;
    48  /
              insert into emp2 values(emptab(j).empno,emptab(j).ename,emptab(j).deptno);
    ERROR at line 37:
    ORA-06550: line 37, column 35:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
    table of records
    ORA-06550: line 37, column 35:
    PLS-00382: expression is of wrong type
    ORA-06550: line 37, column 51:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
    table of records
    ORA-06550: line 37, column 51:
    PLS-00382: expression is of wrong type
    ORA-06550: line 37, column 67:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND
    table of records
    ORA-06550: line 37, column 67:
    PLS-00382: expression is of wrong type
    ORA-06550: line 37, column 35:
    PL/SQL: ORA-22806: not an object or REF
    ORA-06550: line 37, column 11:
    PL/SQL: SQL Statement ignored
    SQL> select * from v$version
      2  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> declare
      2    cursor dept_inst
      3    is
      4    select d.deptno
      5    from   dept d
      6    where  d.dname = 'RESEARCH';
      7    --
      8    cursor emp_inst(b_deptno in number)
      9    is
    10    select e.empno
    11    ,      e.ename
    12    ,      e.deptno
    13    from   emp1 e
    14    where  e.deptno = b_deptno;
    15    --
    16    type depttype is table of number index by binary_integer;
    17    depttab depttype;
    18    type emptype is table of emp_inst%rowtype /*this will not work*/ index by binary_integer;
    19    emptab emptype;
    20    --
    21  begin
    22    --
    23    open dept_inst;
    24    loop
    25     
    26      fetch dept_inst bulk collect into depttab limit 100;
    27      forall i in depttab.first..depttab.last
    28        delete from emp2 where deptno = depttab(i);
    29         --
    30        dbms_output.put_line(sql%rowcount||' records were deleted from table emp2');
    31        --
    32  --      open emp_inst(depttab(i));
    33        open emp_inst(depttab(1));
    34        loop
    35          fetch emp_inst bulk collect into emptab limit 100;
    36          forall j in emptab.first..emptab.last
    37            insert into emp2 values(emptab(j).empno,emptab(j).ename,emptab(j).deptno);
    38          --
    39          exit when emp_inst%notfound;
    40          --
    41        end loop;
    42        exit when dept_inst%notfound;
    43        close dept_inst;         
    44      --
    45    end loop;
    46    close dept_inst;
    47  end;
    48  /
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Why sys_extract_utc(sysdate) never causes error in pl/sql block?

    Oracle 11.2
    I cannot use
    SELECT sys_extract_utc(sysdate) FROM DUAL But I can use
    v := sys_extract_utc(sysdate)in a procedure or a trigger without causing any compile or run-time error.
    In my opinion, the return value of function sysdate doesn't contain any timezone info, so it should not be able to be used as the parameter of function sys_extract_utc, because it needs timezone info to do the conversion.
    Any clues?
    Thanks in advance.

    Kiran wrote:
    use systimestamp it will contain timezone.I know, what I don't know is why sys_extract_utc(sysdate) can be used in procedure without causing any error. It should cause error, right?

  • Error while invoking webservice using UTL_HTTP from PL/SQL Block

    Hi All,
    I am invoking a webservice (SOAP Request) from a PL/SQL block using UTL_HTTP package.
    I am able to send the complete request and am getting the required instance on the BPEL Console, but the process is erroring out while getting response back.
    and the PL/SQL Block is ending in error mentioned below:
    ERROR at line 1:
    ORA-29266: end-of-body reached
    ORA-06512: at "SYS.UTL_HTTP", line 1321
    ORA-06512: at "APPS.CSM_BPEL_TEST_PKG", line 34
    ORA-06512: at line 1
    Package is completing successfully if i test in local DB and local BPEL.
    But giving above error in client's.
    Can anyone let me know what is the cause of this.
    Thanks in advance

    I got it working by making process Synchronous.
    But with asynchronous process it is still same error.
    Thanks...

  • PL/SQL block query error when going to a remote system with 1 parameter.

    Hi,
    I am getting the error:
    Invalid function body condition: ORA-01460: unimplemented or unreasonable conversion requested ORA-02063: preceding line from HANSEN_REMOTE
    The issue appears to result from opening a cursor that is a select statement is in some way accessing records via a dblink and the 'where' clause is has more then one session parameter in it. Here is the smallest pl/sql block that results with an error:
    DECLARE
    CURSOR c_GetPay IS
    SELECT PERSON_ID
    FROM CASH_PERSON@HANSEN_REMOTE
    WHERE LAST_NAME = :P320_HANSEN_LAST_NAME
    AND FIRST_NAME = :P320_HANSEN_FIRST_NAME;
    BEGIN
    OPEN c_GetPay ;
    CLOSE c_GetPay ;
    RETURN TRUE;
    END ;
    If I remove 'AND FIRST_NAME = :P320_HANSEN_FIRST_NAME' from the curser, there is no problem. This block of pl/sql is in a On Load: Before Header
    on a page branch. This issue remains consistent in our 1.6.1.00.02 instance of HTMLDB with an Oracle database version 10.1.0.3.0. This instance is
    a fresh install of the 10g and HTMLDB.
    Does any one have any ideas of why I am getting this error message. I really need to get it resolve soon as we are trying to get an application up by the end of August and there is still alot of coding needing to be done.
    Thanks for the help.
    Lanie

    Scott, I have tried everything that this point except copy the whole table from the remote system.
    Here is a short version of what I have tried...
    -- hard coded condition...timing was not an issue here...it was quick.
    declare
    v_in_PersonId number(9);
    cursor c_GetPay
    IS select PERSON_ID --, first_name, LAST_NAME
         from HANSEN_CONTACT
              where first_name like 'LANIE'
              AND last_name LIKE 'MOORE'
    BEGIN
    OPEN c_GetPay;
    FETCH c_GetPay INTO v_in_PersonId;
    CLOSE c_GetPay;
    RETURN TRUE;
    END           
    -- this is an internal variable set to the string literal...does not as the v function was not called.
    declare
    V_TEST VARCHAR2(150);
    V_TEST2 VARCHAR2(150);
    v_in_PersonId number(9);
    cursor c_GetPay
    IS select PERSON_ID --, first_name, LAST_NAME
         from HANSEN_CONTACT
              where first_name like :V_TEST
              AND last_name LIKE :V_TEST2
    BEGIN
    V_TEST := 'LANIE';
    V_TEST2 := 'MOORE';
    OPEN c_GetPay;
    FETCH c_GetPay INTO v_in_PersonId;
    CLOSE c_GetPay;
    RETURN TRUE;
    END
    -- this has the v function called in the cursor since no matter what I do, I have to call it so I don't get my original error. This takes over a minute to return, and it is using hard coded values...if I use session variables where I place the information from the user, it takes even longer.
    declare
    V_TEST VARCHAR2(150);
    V_TEST2 VARCHAR2(150);
    v_in_PersonId number(9);
    cursor c_GetPay
    IS select PERSON_ID --, first_name, LAST_NAME
         from HANSEN_CONTACT
              where first_name like V(:V_TEST)
              AND last_name LIKE V(:V_TEST2)
    BEGIN
    V_TEST := 'LANIE';
    V_TEST2 := 'MOORE';
    OPEN c_GetPay;
    FETCH c_GetPay INTO v_in_PersonId;
    CLOSE c_GetPay;
    RETURN TRUE;
    END
    It does not appear to be an issue if I am looking at a view going to the remote system or the table it's self. The slowness issue takes place. (In short I have tried replacing HANSEN_CONTACT which is a view with the direct table link of imsv7.contact@HANSEN_REMOTE and that did not solve the timing issue).
    Any ideas?

  • PL/SQL block error message

    Hi,
    I'm still learning PL/SQL. In my application, I created a PL/SQL block which contains an update and an insert statement. When I click Apply Changes, I receive the following error message:
    1 error has occurred
    ORA-06550: line 24, column 5: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 19, column 2: PL/SQL: SQL Statement ignored
    This is my code. I'm not seeing the problem very clearly. Can someone help me out? Thanks.
    BEGIN
    update
        HISA_AGREEMENTS
         set
           CREATED_BY=V('APP_USER'),
           LAST_UPDATED_BY=V('APP_USER'),
           APPROVER_SALUTATION=:P7_APPROVER_SALUTATION,
           APPROVER_FIRST_NAME=:P7_APPROVER_FIRST_NAME,
           APPROVER_MIDDLE_INITIAL=:P7_APPROVER_MIDDLE_INITIAL,
           APPROVER_LAST_NAME=:P7_APPROVER_LAST_NAME,
           APPROVER_NAME_SUFFIX=:P7_APPROVER_NAME_SUFFIX,
           APPROVER_EMAIL_ADDR=:P7_APPROVER_EMAIL_ADDR,
           SPONSOR_EMAIL_ADDR=:P7_SPONSOR_EMAIL_ADDR,
           APPROVER_TITLE=:P7_APPROVER_TITLE
    where
          ORG_KEY_LE=:P7_ORG_KEY_LE;
    insert into
        HISA_AGREEMENT_DOCS
           (ORG_DOC_CURR_KEY)
       values
           (:P7_DOCUMENT)
        where
          ORG_KEY_LE=:P7_ORG_KEY_LE;
    END;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello,
    insert into
    HISA_AGREEMENT_DOCS
    (ORG_DOC_CURR_KEY)
    values
    (:P7_DOCUMENT)
    where
    ORG_KEY_LE=:P7_ORG_KEY_LE;
    is wrong. The WHERE clause needs to be omitted...or you need an update.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • SharePoint 2010 with SQL Reporting Services 2012 "Installation Error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\110 registry key"

    i have a small sharepoint farm "2 servers" (WFE) and SQL Server 2012 ,
    i installed rsSharePoint for reporting services , as a read the Reporting services is Application Service  with SQL 2012 not as SQL 2008 R2 with SharePoint integrated mode, so after installation when am trying to configure the  SQL Server
    Reporting Services Application services i got the below error :
    "Installation Error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\110 registry key"
    any kind of help would be much appreciated .

    I'm having the same issue, but to me it seems like the instructions I've seen are all over the place.  I already have SP 2013 and SQL 2012 SP 1 installed.  I already added the features for Reporting Services - Sharepoint and Reporting Services
    Add-in for SharePoint Products.  I didn't see the Reporting Service service in CA, so I ran the powershell scripts to add SPRSService and SPRSServiceProxy. 
    My initial quest, was to get the BI features enabled, which took me on the journey of adding the Report Services, then I got the error.
    Then when I read this about installing the BI features
    http://blogs.msdn.com/b/querysimon/archive/2012/11/26/installing-the-bi-features-of-sharepoint-2013.aspx, which I already had SQL and SP installed.  Do I have to rerun and selct the SQL Server PowerPoint for SharePoint option?  I have the PowerPoint
    Configuration Tool on my SQL server, I run it and I get PowerPivot for SP 2013 Configuranoi is missing prerequisits:  SP 2013 EE is required.  Which I have EE.
    Is Reporting Services different or in addition to the BI Feature (PowerPivot)? 
    Have I missed a step?
    Thanks for you help.
    Kim
    Kim.Williams

  • While executing the following pl/sql block   Iam getting  following error

    While executing the following pl/sql block
    Iam getting following error
    ORA-06550: line 5, column 11:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 5, column 11:
    PL/SQL: Item ignored
    declare
    TYPE t_customer_details IS REF CURSOR;
    o_customer_details t_customer_details;
    v_rec o_customer_details%ROWTYPE;
    begin
    o_customer_details:=pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
    LOOP
    FETCH o_customer_details INTO rec ;
    EXIT WHEN o_customer_details%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(' print' );
    END LOOP;
    CLOSE o_customer_details;
    end;

    sorry
    declare
    TYPE t_customer_details IS REF CURSOR;
    o_customer_details t_customer_details;
    begin
    o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
    FOR v_rec IN o_customer_details
    LOOP
      DBMS_OUTPUT.PUT_LINE(' print' );
    END LOOP;
    END;I changed code,
    Can you say , o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329); is it right?
    pkg_search.fngetcustdetails return ref cursor??

  • PL/SQL Block working fine but same code procedure is giving error.

    Hi Experts,
    I am executing  procedure getting error ORA-27486: insufficient privileges
    If It's PL/SQL block it's creating job classes.
    Both the cases same user.
    CREATE OR REPLACE PROCEDURE JOB_CLASS_PROC
    AS
       V_SQL   VARCHAR2 (4000);
       V_JOB_STEP VARCHAR2 (50);
    BEGIN
    -- Create Job Class if not exist
       BEGIN
       FOR i
          IN (SELECT SNS.OWNER_NAME OWNER_NAME,
                     VDB.NAME
                        SNAME
                FROM SCHEMA_NAMES SNS,
                     V$DATABASE VDB
               WHERE OWNER_NAME NOT IN ('')
                AND (OWNER_NAME || '_JOB_CLASS')
                     NOT IN
                    (SELECT JOB_CLASS_NAME FROM DBA_SCHEDULER_JOB_CLASSES))
       LOOP
          V_SQL :=
                'BEGIN
                  DBMS_SCHEDULER.CREATE_JOB_CLASS
                   job_class_name => ''' || i.owner_name || '_JOB_CLASS'',
                   service           => ''' || i.SNAME || ''',
                   comments       => ''Job class for ' || i.owner_name || '''
                EXCEPTION
                 WHEN OTHERS THEN
                  RAISE;                 
                END;';
          EXECUTE IMMEDIATE V_SQL;
       END LOOP;
    END;
    EXCEPTION
       WHEN OTHERS
       THEN
       RAISE_APPLICATION_ERROR(-20001, V_JOB_STEP||' SQLERRM: ' || SQLERRM || ' SQLCODE: '|| SQLCODE);
    END JOB_CLASS_PROC;
    DECLARE
       V_SQL   VARCHAR2 (4000);
       V_JOB_STEP VARCHAR2 (50);
    BEGIN
    -- Create Job Class if not exist
       BEGIN
       FOR i
          IN (SELECT SNS.OWNER_NAME OWNER_NAME,
                     VDB.NAME
                        SNAME
                FROM SCHEMA_NAMES SNS,
                     V$DATABASE VDB
               WHERE OWNER_NAME NOT IN ('')
                AND (OWNER_NAME || '_JOB_CLASS')
                     NOT IN
                    (SELECT JOB_CLASS_NAME FROM DBA_SCHEDULER_JOB_CLASSES))
       LOOP
          V_SQL :=
                'BEGIN
                  DBMS_SCHEDULER.CREATE_JOB_CLASS
                   job_class_name => ''' || i.owner_name || '_JOB_CLASS'',
                   service           => ''' || i.SNAME || ''',
                   comments       => ''Job class for ' || i.owner_name || '''
                EXCEPTION
                 WHEN OTHERS THEN
                  RAISE;                 
                END;';
          EXECUTE IMMEDIATE V_SQL;
       END LOOP;
    END;
    EXCEPTION
       WHEN OTHERS
       THEN
       RAISE_APPLICATION_ERROR(-20001, V_JOB_STEP||' SQLERRM: ' || SQLERRM || ' SQLCODE: '|| SQLCODE);
    END;
    Why for same code procedure is giving error.
    Please help me.
    Thanks.

    Hi,
    Then with the same grants how the below script is working.
    If I put the below same script in Procedure it's not working.
    DECLARE
       V_SQL   VARCHAR2 (4000);
       V_JOB_STEP VARCHAR2 (50);
    BEGIN
    -- Create Job Class if not exist
       BEGIN
       FOR i
          IN (SELECT SNS.OWNER_NAME OWNER_NAME,
                     VDB.NAME
                        SNAME
                FROM SCHEMA_NAMES SNS,
                     V$DATABASE VDB
               WHERE OWNER_NAME NOT IN ('')
                AND (OWNER_NAME || '_JOB_CLASS')
                     NOT IN
                    (SELECT JOB_CLASS_NAME FROM DBA_SCHEDULER_JOB_CLASSES))
       LOOP
          V_SQL :=
                'BEGIN
                  DBMS_SCHEDULER.CREATE_JOB_CLASS
                   job_class_name => ''' || i.owner_name || '_JOB_CLASS'',
                   service           => ''' || i.SNAME || ''',
                   comments       => ''Job class for ' || i.owner_name || '''
                EXCEPTION
                 WHEN OTHERS THEN
                  RAISE;               
                END;';
          EXECUTE IMMEDIATE V_SQL;
       END LOOP;
    END;
    EXCEPTION
       WHEN OTHERS
       THEN
       RAISE_APPLICATION_ERROR(-20001, V_JOB_STEP||' SQLERRM: ' || SQLERRM || ' SQLCODE: '|| SQLCODE);
    END;
    Please help me.
    Thanks.

  • Installation Error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\120 registry key.

    Dear Expert,
    I setup SharePoint for 3 tiers, WFE, APP + DB Server.
    I installed SQL 2014 reporting service Add-in on APP Server and already enable sql reporting service in DB Server. DB Server can do report server.
    I follow the step : https://msdn.microsoft.com/en-us/library/jj219068(v=sql.120).aspx  but I stuck in no.2, I cannot start the services, in picture below.
    I checked the SSRS provision is disabled not online
    Please help.

    Hi MasterBird,
    According to your description, when you register and start the Reporting Services SharePoint Service, the error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\120 registry key is thrown out.
    As this
    article say, if you use three-computer deployment, the first computer hosts an instance of a SharePoint product. The Reporting Services Add-in is installed on this computer. The second computer hosts SQL Server Reporting Services and the third computer
    hosts an instance of the Database Engine.
    Regarding the error message, it could cause by the Reporting Services – SharePoint feature and Reporting Services Add-in for SharePoint Products haven’t been installed. Please refer to articles:
    SSRS SharePoint 2013 Create Service Application error: Could not find SOFTWARE\Microsoft\Microsoft SQL Server\110 registry key Error
    Installing SSRS 2012 in SharePoint Mode on SP2010
    If issue persists, please check the error detailed information in ULS logs, and check Program Files\Microsoft SQL Server\120\Setup Bootstrap\Log to see if any error occurred during set up. For more information, please refer to this article:
    Troubleshoot a Reporting Services Installation.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

Maybe you are looking for