Same mistake again - ORA-06511: PL/SQL: cursor already opened

Hello

Even if I close the cursor, I get the following error "ORA-06511-6511: PL/SQL: cursor already opened. Please can you give your suggestion.

CUR CURSOR IS
JULIE name FROM test;

BEGIN

IF heart % ISOPEN THEN
CLOSE cur
END IF;

Heart OPEN;

FOR my heart IN cuv
LOOP
-sql statements
END LOOP;

END;

Published by: AravindhK on December 6, 2011 13:56

Do not open cursors when you write

For  in 
loop

SQL> Declare
CURSOR cur IS
SELECT 1 A FROM dual;
BEGIN
IF cur%ISOPEN THEN
CLOSE cur;
END IF;
--OPEN cur;
DBMS_OUTPUT.PUT_LINE('Cursor opened by for');
FOR cuv IN cur
LOOP
DBMS_OUTPUT.PUT_LINE(cuv.A);
END LOOP;
END;

Cursor opened by for
1

PL/SQL procedure successfully completed.

Tags: Database

Similar Questions

  • Getting error - ORA-06511: PL/SQL: cursor already opened

    I have the following code for an Apex (Application Express) project I'm developing.

    declare
    mail_id varchar2 (100);
    number of min_skill_cnt;
    skill_cde varchar2 (30);
    number of total_leave;
    number of toal_emp;

    CUR cursor is
    Select S_EMP_EMAIL
    from EMP_SKILLS_INFO where SKILLCODE = 'MGR' and S_EMP_EMAIL = lower(:APP_USER);


    cursor minskill is
    Select skill_code, MINRQMT_AM
    of skills_code_info
    where skill_code in (select skillcode from the emp_skills_info where S_EMP_EMAIL = lower (:APP_USER));

    cursor leavecnt (v_skill IN VARCHAR2) is
    Select count (*) in emp_leave_info
    where leave_date =: P24_LEAVE_DATE
    and emp_email IN (select S_EMP_EMAIL from the EMP_SKILLS_INFO where SKILLCODE = v_skill);


    cursor empcnt (v_skills IN VARCHAR2) is
    Select count (*) in EMP_SKILLS_INFO
    where SKILLCODE = v_skills;

    Start

    Open the heart;

    Open minskill;

    LOOP
    extract the minskill in skill_cde min_skill_cnt;
    When the output minskill % NOTFOUND;

    Open leavecnt (skill_cde);
    extract the leavecnt in total_leave;

    Open empcnt (skill_cde);
    extract the empcnt in toal_emp;

    IF toal_emp-total_leave < min_skill_cnt

    then

    () apex_mail. Send
    p_to = >: APP_USER,.
    P_FROM = > '[email protected] ',.
    p_cc = > NULL,
    p_body = > ' * this is a system generated message, please do not respond to this *' |
    Chr (10) | UTL_TCP. CRLF. "Please consider the skills as ' |: APP_USER |' on leave ' |"

    Chr (10) | UTL_TCP. CRLF. "Thank you,.
    p_subj = > 'Alert code skills');

    end if;

    END LOOP;

    close empcnt;
    close leavecnt;
    close minskill;
    close cur;

    end;

    =======================
    Ideally this should send an email to managers when a particular skill runs short when the employee is requesting authorization.
    I am getting an error that cursor is already open when I run this code. I don't know what cursor or where it sits open cursor command.

    All entries will be appreciated.

    You open cursors leavecnt and empcnt in a loop without closing. Second iteration of loop will obviously trigger the cursor is already open.

    SY.

  • PL/SQL: cursor already open

    Hi all

    You people could help to resolve the error
    "PL/SQL: cursor already open '."

    Thanks in advance
     CREATE OR REPLACE FUNCTION get_row_lane_counts_text
     RETURN VARCHAR2
     IS
        my_row_counts_text      VARCHAR2(10000);
        my_row_counts_entry      VARCHAR2(10000);
        my_row_counts_pct_entry      VARCHAR2(10000);      
        my_row_count_total_text  VARCHAR2(10000);
        my_total            NUMBER(12);
        my_count_result     VARCHAR2(20);
     
        CURSOR row_counts_text IS
            SELECT 'edr_rpt_lane_by_class_package.gen_total_lane_count('
                            ||'lane_id, '
                            ||'direction_id, '
                            ||'interval_start_date_time, '
                            ||'interval_end_date_time, '
                            ||'range_low, '
                            ||'range_high, '
                            || site_lane_id || ', '                                        
                            || site_lane_id || ') "#'|| site_lane_id || '"'
              FROM edr_rpt_tmp_report_lanes     
          ORDER BY site_lane_id;
          
           CURSOR row_counts_pct_text IS
            SELECT 'edr_rpt_lane_by_class_package.gen_total_lane_count_pct('
                            ||'lane_id, '
                            ||'direction_id, '
                            ||'interval_start_date_time, '
                            ||'interval_end_date_time, '
                            ||'range_low, '
                            ||'range_high, '
                            || site_lane_id || ', '                                        
                            || site_lane_id || ') "#'|| site_lane_id || '%"'
              FROM edr_rpt_tmp_report_lanes     
          ORDER BY site_lane_id;
          
          
     
     BEGIN
     
       my_row_counts_text      := ''; 
       my_row_counts_entry     := '';
       my_row_counts_pct_entry := ''; 
      
       -- generate the speed ranges function calls
       OPEN row_counts_text;
       LOOP
     
         FETCH row_counts_text INTO my_row_counts_entry;
     
         EXIT WHEN row_counts_text%NOTFOUND;
         
              OPEN row_counts_pct_text;
            LOOP
     
                  FETCH row_counts_pct_text INTO my_row_counts_pct_entry;
     
                  EXIT WHEN row_counts_pct_text%NOTFOUND;
         
                 my_row_counts_text := my_row_counts_entry || ', ' || my_row_counts_pct_entry;
             
             END LOOP; 
             
            
        
       END LOOP;
       
         CLOSE row_counts_pct_text;
       
       CLOSE row_counts_text;
       
       
     
       RETURN my_row_counts_text;
       
     
     END;
     /

    Works fine for me...

    SQL > create table t1 (number, number of b).

    Table created.

    SQL > insert into t1 values (1,1);

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > CREATE or REPLACE FUNCTION get_row_lane_counts_text
    2 RETURN VARCHAR2
    3 EAST
    4 my_row_counts_text VARCHAR2 (10000);
    5 my_row_counts_entry VARCHAR2 (10000);
    6 my_row_counts_pct_entry VARCHAR2 (10000);
    7 my_row_count_total_text VARCHAR2 (10000);
    8 my_total NUMBER (12);
    9 my_count_result VARCHAR2 (20);
    10
    11 row_counts_text of CURSOR IS
    12. SELECT one
    13 FROM t1;
    14
    15
    16
    17 row_counts_pct_text of CURSOR IS
    18 SELECT b
    19 FROM t1;
    20
    21
    22
    23
    24
    BEGIN 25
    26
    27
    28 my_row_counts_text: = ";
    29 my_row_counts_entry: = ";
    30 my_row_counts_pct_entry: = ";
    31
    32
    33 generates speed ranges function calls
    34 row_counts_text OPEN;
    LOOP 35
    36
    37
    38 FETCH row_counts_text INTO my_row_counts_entry;
    39
    40
    EXIT 41 WHEN row_counts_text % NOTFOUND;
    42
    43
    44 row_counts_pct_text OPEN;
    45 LOOP
    46
    47
    48 FETCH row_counts_pct_text INTO my_row_counts_pct_entry;
    49
    50
    EXIT 51 WHEN row_counts_pct_text % NOTFOUND;
    52
    53
    54 my_row_counts_text: = my_row_counts_entry | ', ' || my_row_counts_pct_entry;
    55
    56
    57 END LOOP;
    58
    59
    60 row_counts_pct_text CLOSE;
    61
    LOOP END 62;
    63
    64
    65
    66
    67
    68 row_counts_text CLOSE;
    69
    70
    71
    72
    73 my_row_counts_text RETURN;
    74
    75
    76
    END 77;
    78
    79.

    The function is created.

    SQL >

    SQL > select get_row_lane_counts_text() from double;

    GET_ROW_LANE_COUNTS_TEXT()
    --------------------------------------------------------------------------------
    1, 1

  • ORA-06528: PL/SQL Profiler generator runtime error

    Version 11.2.0.3.  I have installad DBMS_PROFILER:

    SYS AS SYSDBA > @?/rdbms/admin/profload.sql

    SYS AS SYSDBA > @?/rdbms/admin/proftab.sql


    I tried to use dbms_profiler.start_profiler in PLSQL code with user NUFN and discovered that lacked the NUFN user privileges on the objects of the Profiler. So I ran the following grants:

    grant the update, insert and delete on plsql_profiler_units to NUFN;

    grant the update, insert and delete on plsql_profiler_runs to NUFN;

    Grant execute on DBMS_PROFILER to NUFN;

    But still no luck:

    SQL > START

    dbms_profiler.start_profiler ('test1');

    EXECUTE IMMEDIATE 'select max (STATS_UPDATE_TIME), owner of the DBA_TAB_STATS_HISTORY group from owner to owner.

    dbms_profiler.stop_profiler ();

    END;

    /

    BEGIN

    *

    ERROR on line 1:

    ORA-06528: PL/SQL Profiler generator runtime error

    ORA-06512: at "SYS." DBMS_PROFILER", line 123

    ORA-06512: at "SYS." DBMS_PROFILER", line 132

    ORA-06512: at line 2

    I can't find what is missing from my user NUFN for her to be able to run DBMS_PROFILER.  Help, please!

    Thanks Bella, I had not run @?/rdbms/admin/proftab.sql as my user NUFN but as sys.  But you know what?  Even after execution of @?/rdbms/admin/proftab.sql as NUFN, the problem persisted!

    So I traced my session, read the trace file and found nothing wrong (but I have no experience in finding fault with the workings of dbms_profiler).  But I found the SQL code executed by the dbms_profiler.start_profiler command, which is:

    PARSING IN CURSOR #4574691968 len = 155 dep = 2 uid = 155 oct 2 lid = 155 = tim = hv 530047132716 = ad 3718124591 = "7000000946da848" sqlid = "akx2pxvftw51g."

    INSERT INTO PLSQL_PROFILER_RUNS (RUNID, RUN_DATE, RELATED_RUN, RUN_OWNER) VALUES (PLSQL_PROFILER_RUNNUMBER. NEXTVAL,: B1,: B2, USER) RETURN RUNID IN: O0

    END OF STMT

    ANALYSIS #4574691968:c = 315, e = 844, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 1, plh = 0, tim = 530047132715

    I tried manually the same HOME, and bingo, I discovered the cause of my problem:

    INSERT INTO PLSQL_PROFILER_RUNS (RUNID, RUN_DATE, RELATED_RUN, RUN_OWNER) VALUES (PLSQL_PROFILER_RUNNUMBER. NEXTVAL, sysdate, 'manually', 'ME');

    ORA-01950: no privileges on tablespace execution times

    After performing ALTER USER NUFN QUOTA UNLIMITED ON STATES; the problem has been resolved.

    Conclusion: after DBMS_PROFILER installation for a user, make sure that the user can write in objects DBMS_PROFILER (SUBSIDIES and QUOTAS).

  • ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    Hello!

    I have a simple object type and a proecdure in which I am trying to use it to insert into another table

    -object

    CREATE ORREPLACETYPEmt_mtg ASOBJECT

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    CREATE ORREPLACETYPEREF_MTG ASTABLEOFMt_MTG ;

    -same structure as the use of sampletbl target table in the cursor query

    create table tbl_MT_MTG

    (

    ACOL NUMBER ,

    BCOL NVARCHAR2 (100)

    );

    -procedure

    CREATE ORREPLACEINTERIORTEST_PROCEDURE1

    AS

    ref_cur sys_refcursor ;

    REFR ref_mtg ;

    BEGIN

    OPEN ref_cur FOR

    Select acol,

    BCOL

    DE sampletbl rownum<10;

    Fetch ref_cur in bulk collectintorefr;

    Insert intotbl_MT_MTG(acol,bcol)selectacol,bcol fromtable(refr);

    commit;

    CLOSE Ref_cur;

    END;

    /

    When I run this procedure fails with

    ORA-06504: PL/SQL: return variables of the game results or the query types do not match

    ORA-06512: at "TEST_PROCEDURE1", line 10

    ORA-06512: at line 2

    Any help on this please...

    Thanks to an OLD POST below

    so perfect helped me! Thank you

    Tubby

    After 5 years of more :-)

    How to store refcursor in collection How to store refcursor in collection

  • Error: ORA-06508: PL/SQL: called program unit is not found

    Hello

    I was surprise issue while testing my code from Oracle. Let me explain first of all the details of the environment. Our application built
    Java/J2EE (Weblogic) and backend is Oracle 11 g re2. Calling Java call through different users who have been providing
    synonymous with option and running for corresponding procedure.
    I created the EXTRACT_CUSTOMER_INFO_PK package which exract data from file text with UTL_FILE (direcory, UTL_FILE grant is provided to the user to DB).
    Now this package was called rp_execute_procedure_pr - I have here is the code
    CREATE OR REPLACE PROCEDURE RP_EXECUTE_PROCEDURE_PR
    (
    i_atlas_job_schedule_fk IN atlas_job_schedule.atlas_job_schedule_pk%TYPE,
    i_job_id IN atlas_job.job_id%TYPE,
    i_parm_value IN atlas_job_schedule.parm_value%TYPE,
    o_status_code ON the NUMBER,
    o_status_mesg OUT VARCHAR2
    )
    IS
    -Other older code that is not relevant to this problem-

    -Other older code that is not relevant to this problem-

    -The code below, I added-
    ELSIF l_job_id = "CUST_EXTRACT" THEN


    EXTRACT_CUSTOMER_INFO_PK.customer_report (i_parm_value,
    o_status_code,
    o_status_mesg);


    -o_status_code: =-99999999.
    -o_status_mesg: = "PARTHA PARTHA PARTHAcess arrested!";

    ON THE OTHER
    o_status_code: =-20300;
    o_status_mesg: = ' Job Id: ' | l_job_id | ' Not found. Process is completed!';
    END IF;

    update_log_auto
    (
    ajs_rec.atlas_job_schedule_pk,
    ' Treatment time (GMT) of the end: '
    );

    EXCEPTION
    WHEN eProcError THEN
    o_status_code: = SQLCODE;
    o_status_mesg: = SUBSTR(vMsg ||) e -'|| SQLERRM, 1, 200);

    WHILE OTHERS THEN
    o_status_code: =-20300;
    o_status_mesg: = SUBSTR (SQLERRM, 1, 200);

    update_log_auto
    (
    ajs_rec.atlas_job_schedule_pk,
    ' Error: '. SQLERRM | » '
    );

    update_log_auto
    (
    ajs_rec.atlas_job_schedule_pk,
    ' Treatment time (GMT) of the end: '
    );
    END RP_EXECUTE_PROCEDURE_PR;


    Now he compiled sucesfully. And while I SAT RP_EXECUTE_PROCEDURE_PR then run fine and extracted txt file. But while I called him procedural Java it gives us the error as
    Error: ORA-06508: PL/SQL: 13:16:51 August 2, 2012 called program unit could not be found.

    Like I said RP_EXECUTE_PROCEDURE_PR old proc and used by the other proc, so I first think question is newly added code or maybe a few grants or synonym (although it should not be)
    So I created public means amd gave run grant to my public pkg.
    But he repeated the same mistake.
    I have a lot of R & D on my package but nothing happen. Finally I have my new pkg RP_EXTRACT_CUSTOMER_INFO_PK remane and it works fine

    I need to know what is the RCA for her. I donot think any problem as renaming pkg dependecy works very well.

    NB my user DB iATLAS and Javauser is SUDEEP


    Thanks in advance

    Martin Paiva

    Name conflict usually occurs because there is another object with the same name: could be it is even a java package name and plsql package package or could be same name from a different scheme.

    First of all, try to use the fully qualified name: myschema.mypackage.myprocedure

  • ORA-06502: PL/SQL: digital or value error: character conversion number e

    Hi all
    I work with DBLOCALE , which is
    Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
    PL/SQL Release 10.2.0.3.0 - Production
    CORE     10.2.0.3.0     Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
    NLSRTL Version 10.2.0.3.0 - Production
    and DBREMOTE
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE     9.2.0.8.0     Production
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production
    Leave a procedure on DBLOCALE I run SCHEMA. MYPROCEDURE@dbremote (NUMBER, stringPar VARCHAR2, datePar DATE numberPar)

    I use this procedure only to call a function in a package of DBREMOTE with education booleanresult: = MYPACKAGE. MYFUNC (NUMBER, stringPar VARCHAR2, datePar DATE numberPar)

    In the service, I try to INSERT IN MYTABLE (numberPar, stringPar, datePar) and the error
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    is triggered.

    I missed something basic? Where is my mistake?

    I have check all types of past data and types of data in the table, that I have to insert.

    Any help or suggestion will be appreciated. Feel free to ask me any questions that need me to explain or for more details.

    Best regards
    Alex

    OraclePSP wrote:

    It starts with a page of APEX who call a procedure in DBLOCALE.

    Apex point (page) variables are all text - and bind as text variables when used in PL/SQL and SQL code.

    In this procedure, ii assess the past, then insert into a few tables@DBREMOTE without errors.
    The end of it, I'm calling the remote packaged function.
    In the function I use parameters to open a cursor and insert into MYTABLE.

    That you pass as parameters? The variable element of Apex (e.g. : P1_DATE) or do you attribute the object variable to a PL/SQL variable and the neck of the PL/SQL variable as a parameter?

    Even if I agree with you on the copy & paste I don't know what part of the process, I can speak to you.

    Well, you can try the following. Create a dynamic PL/SQL region on the page. This region should be implemented and made that the page has been sent (in other words, element variables used in the page need value for this region, for the record). You can create a condition for this region that must be met to be made - and this can check the QUERY variable, or to check if the relevant variables have values.

    In this dynamic PL/SQL code for the region block, use HTP.prn () as you would use DBMS_OUTPUT.put_line () in client-server test normal (using TOAD or SQL * more). And in this block of code, call the remote procedure.

    For example

    --// dynamic PL/SQL region code block:
    HTP.prn( 'Item P1_DATE = ['||:P1_DATE||'] 
    ' ); HTP.prn( 'Item P1_NUMBER = ['||:P1_NUMBER||']
    ' ); ..etc.. HTP.prn( 'Calling remote procedure:
    ' ); begin RemoteProc@RemoteDB( param1=>:P1_DATE, param2=>:P1_NUMBER ); HTP.prn( 'Call was successful
    ' ); exception when OTHERS then HTP.prn( 'Call failed with: '||SQLERMM(SQLCODE)||'
    '); end; ..etc..
  • ORA-06502: PL/SQL: digital error or the value in the conversion for a long TIME on the CLOB type

    Hello

    I have an EA of RDBMS Oracle 11.2.0.4.

    I ger the following error when I try to convert a data type LONG to type CLOB data thanks to a PL/SQL procedure:

    declare
    v_prefix varchar2 (20): = null;
    v_text_view_clob clob: = null;
    long v_text_view_long: = null;

    cursor c_v
    is
    Select
    a.view_name as view_name
    Of
    USER_VIEWS one;

    Start
    for r_v in c_v
    loop
    Start
    v_text_view_clob: = null;
    v_text_view_long: = null;

    -Do the SQL code of the view
    Select
    a.Text text
    in
    v_text_view_long
    Of
    USER_VIEWS one
    where
    a.view_name = r_v.view_name;

    v_text_view_clob: = v_text_view_long;

    update of ohibo_views one
    set
    a.view_text = v_text_view_clob
    where
    a.view_name = r_v.view_name;
    exception
    while others then
    dbms_output.put_line ('View =' | r_v.view_name |) "kan niet worden geconverteerd!");
    dbms_output.put_line (substr (sqlerrm, 1, 60));
    end;
    end loop;
    -commit;
    exception
    while others then
    lift;
    end;
    /

    I get the error a specific record:

    View = VER_POLISMUTATIES_VW kan niet worden geconverteerd!

    ORA-06502: PL/SQL: digital error or value

    At looked the origina; Value of type LONG and it is indeed a "long" piece of text.

    However, CLOB has a restriction about 4G * db_block_size and LONG 2 G - 1 according to the documentation.

    I should be able with the method above to convert a LONG in CLOB.

    Anyone had a similar situation?

    Thanks in advance for advice how to solve.

    Kind regards

    PS: my apologies, I didn't know which group to post this discussion: database or PL/SQL.

    Good indeed, a link with the right explanation.

    I didn't know that there was such a function.

    Thank you!

    Kind regards

  • The adaptation and Pl/SQL cursor sharing

    Hello

    I have this database:

    NLSRTL11.2.0.1.0Production
    Oracle Database 11g Enterprise Edition11.2.0.1.064 bit Production
    PL/SQL11.2.0.1.0Production
    AMT for Solaris:11.2.0.1.0Production

    I'm testing the queries and adaptive cursor sharing. I have a table T1 that is created by selecting all object. It has additional is NOT NULL ID of the column that is PK and is filled through sequence. It has a regular index (OBJECT_TYPE, OBJECT_NAME). Statistics are collected on the T1 table and its indexes.

    Total of T1 lines and are 1065951.

    I have run this test in SqlPlus:

    ID of the VARIABLE NUMBER;

    EXECUTE: id: = 10;

    SELECT COUNT (*) FROM t1 WHERE id <: id;

    So I check the instruction in v$ sql and the execution plan and I can see that the plan is:

    SQL_ID, 3m2qaytqgk9jt, number of children 0

    -------------------------------------

    Select COUNT (*) from t1 where id <: id

    Hash value of plan: 212448250

    ---------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ---------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |       |       |       |   193 (100) |          |

    |   1.  GLOBAL TRI |       |     1.     6.            |          |

    |*  2 |   INDEX RANGE SCAN | PK_T1 | 99999.   585K |   193 (1) | 00:00:03 |

    ---------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 - access("ID"<:ID))

    Second test:

    ID of the VARIABLE NUMBER;

    EXECUTE: id: = 1000000.

    SELECT COUNT (*) FROM t1 WHERE id <: id;

    Execution plan:

    SQL_ID, 3m2qaytqgk9jt, number of children 1

    -------------------------------------

    Select COUNT (*) from t1 where id <: id

    Hash value of plan: 1953966236

    -------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    -------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |       |       |       |   559 (100) |          |

    |   1.  GLOBAL TRI |       |     1.     6.            |          |

    |*  2 |   FULL RESTRICTED INDEX SCAN FAST | PK_T1 |  1000K |  5859K |   559 (2) | 00:00:07 |

    -------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 - filter("ID"<:ID))

    Output:

    SQL > SELECT sql_id, child_number, executions, 'IS_BIND_SENSITIVE', 'IS_BIND_AWARE', 'IS_SHAREABLE' OF V$ SQL WHERE SQL_ID = "3m2qaytqgk9jt";

    THE EXECUTIONS OF CHILD_NUMBER SQL_ID I I I

    ------------- ------------ ---------- - - -

    3m2qaytqgk9jt 0 2 O N N

    1 3 3m2qaytqgk9jt Y Y Y

    As we can see it Adaptive cursor sharing has been used and in both cases the appropriate execution plan has been used.

    When I run test with PL/SQL block, however, I don't see the use of extended cursor sharing. Could you please help understand why?

    The test is (I used deliberately < = in order to create the new parent cursor):

    DECLARE

    PID NUMBER;

    CNT PLS_INTEGER;

    BEGIN

    BECAUSE me in 1... 10 LOOP

    IF i IN (2, 4, 6, 10) THEN

    PID: = round (dbms_random.value (1, 5000));

    ON THE OTHER

    PID: = round ((100000, 1600000) dbms_random.value);

    END IF;

    dbms_output.put_line ('ID: ' | pid);

    COUNT (*) of SELECT INTO cnt FROM t1 WHERE id < = pid;

    END LOOP;

    END;

    /

    Output of this is:

    ID: 396582

    ID: 2584

    ID: 560405

    ID: 3275

    ID: 827442

    ID: 4515

    ID: 167771

    ID: 652411

    ID: 512147

    ID: 230

    As we can see some ID values are good candidates for INDEX BEACH, others are for the INDEX FAST FULL SCAN. However, I am only a child cursor for my parents:

    SQL > SELECT sql_id, child_number, executions, 'IS_BIND_SENSITIVE', 'IS_BIND_AWARE', 'IS_SHAREABLE' OF V$ SQL WHERE SQL_ID = "6xh03mm87nmu3";

    THE EXECUTIONS OF CHILD_NUMBER SQL_ID I I I

    ------------- ------------ ---------- - - -

    0 10 6xh03mm87nmu3 Y N Y

    SQL >

    Please pay attention to the value for IS_BIND_AWARE, who is with my first child 0. So no other children were created. Why in PL/SQL, it behaves differently and how can we enjoy the cursor of adaptation in this context?

    Thank you!

    My immediate thoughts were under cover PLSQL optimizations.

    PLSQL_OPTIMIZE_LEVEL has no effect.

    To run I had to Board BIND_AWARE and SESSION_CACHED_CURSORS value 0.

    Subsequently found Randolf Geist post in the same direction:

    Oracle related stuff: Adaptive Cursor Sharing

  • Process apex Pl/SQL error: ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator

    Apex 4.2

    I searched through the forums of the research about this error, but I do not understand what to do from here. I am writing a process that sends an e-mail when a value of the claim is made (or on a button click). Procedure is as follows:

    DECLARE
       l_body        clob;
       l_body_html   clob;
       l_subject    varchar2(100);
    
    BEGIN
      
    l_body := empty_clob();
    l_body_html := empty_clob();
    
    
    IF V('REQUEST') in ('SAVE_ME') AND :P32_PARENT_UPDATED_FL IS NOT NULL THEN
       l_subject :=  'Survey Job Request Updated'||utl_tcp.crlf||utl_tcp.crlf;
       l_body := 'Update'||utl_tcp.crlf;
    
       l_body_html := '<html>
          <head>
             <style type = "text/css">
                 /* Can add style attributes later */
             </style>
          </head>
          <body>'||utl_tcp.crlf;
       l_body_html := l_body_html ||'Survey Job Request has been updated.<br /><br />'||utl_tcp.crlf;
       l_body_html := l_body_html ||'Title: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_TITLE||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Request Category : '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_REQUEST_CATEGORY||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Update Date: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_UPDATE_DATE||utl_tcp.crlf;
       l_body_html := l_body_html ||'<br />Updated By: '||utl_tcp.crlf;
       l_body_html := l_body_html ||:P32_LAST_EDITED_BY_USERID||utl_tcp.crlf;
       l_body_html := l_body_html ||'</body></html>';
    
    
    
    
    
    END IF;
    
    :P32_CANCELLATION_REASON := l_body_html;
    
    apex_mail.send(
       p_to             =>  '[email protected]',
       p_from           =>  '[email protected]',
       p_body           =>  l_body_html,
       p_body_html      =>  l_body_html,
       p_subj           =>  l_subject);
    
    END;
    
    
    
    
    
    
    
    
    
    

    I added two lines to the code (lines 08 and 09) and when I run my program, I now get the error:

    • ORA-21560: 3 argument is null, invalid or out of range

    Without these two lines, I received the error:

    ORA-06502: PL/SQL: digital error or value: specified incorrect LOB Locator

    I'm not quite sure what is wrong or what I can change. There seems to be right, and in fact, it worked before. I have no idea why this error keeps popping up. Any help on that would be great. Thanks in advance.

    Hello

    NewApexCoder wrote:

    Hmmm... good point. I think that apex_mail.send must be called inside the IF block. But in the future, I added several conditional statements, won't I need to include the apex_mail.send function in each IF block? But at the same time, there is the case that if no conditional instructions are met? Tests, when none of the conditions are true (when I had a second IF block in the code), an email would not be defined, which is correct. Could that be causing a problem however. If the IF block is not filled could he always try to send an email about anything or the l_body_html and l_subject fields have in them the garbage that causing ORA error?

    If the call to the procedure of sending (it is a procedure, and not a function) many times is necessary or useful depends on exactly what you're trying to do.

    For example, you can write to Santa for

    • Submit a wish list
    • Change of address
    • Contradiction with your boss, who can you tell Santa you were mean

    or any combination of these grounds.  If you want to send a simple email whenever any of the conditions are met (and not send a when none are met), then you could do something like this:

    DECLARE

    need_to_send BOOLEAN: = FALSE;

    ...

    BEGIN

    ...

    IF wish_list IS NOT NULL

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF old_addresss <> new_address

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF boss_is_a_big_fat_liar

    THEN

    l_body: = l_body | ...

    need_to_send: = TRUE;

    END IF;

    IF need_to_send

    SO - It's the only call to send

    apex_mail. Send...

    In any case, the error message ' ORA-21560: argument 3 sucks...» "is pretty clear: If you have not given a value to everything you're passing as p_body, then you'd better call the procedure.

  • Exception ORA when accepting SQL Tuning Set

    Hello

    RDBMS version: 11.2.0.1.0 & 11.2.0.4.0

    OS: OEL 5 (64-bit)

    I am creating a SQL tuning set and get both to do exception below. Tried to search on the forums also with the exception of the ORA, but unable to get any resolution for this exception ORA.

    The following awards were made: -.

    GRANT CREATE ANY SQL PROFILE TO SCOTT;
    GRANT DROP ANY SQL PROFILE TO SCOTT;
    GRANT ALTER ANY SQL PROFILE TO SCOTT;
    GRANT ADVISOR TO SCOTT;
    GRANT ADMINISTER SQL MANAGEMENT OBJECT TO SCOTT;
    grant execute on dbms_spm to SCOTT;
    grant administer sql management object to SCOTT;
    
    

    DECLARE
      my_task_name VARCHAR2(30);
      my_sqltext CLOB;
      my_sqlprofile_name VARCHAR2(4000);
    BEGIN
      my_sqltext   := 'SELECT * FROM emp';
      my_task_name := DBMS_SQLTUNE.CREATE_TUNING_TASK(sql_text => my_sqltext, user_name => 'SCOTT', scope => 'COMPREHENSIVE', time_limit => 60, task_name => 'my_sql_tuning_task3', description => 'Demo Task to tune a query');
      DBMS_SQLTUNE.EXECUTE_TUNING_TASK( task_name => 'my_sql_tuning_task3');
      my_sqlprofile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE (task_name =>'my_sql_tuning_task3', name => 'my_sql_profile');   -- Culprit for the exception
      --dbms_output.put_line(my_sqlprofile_name);
    END;
    /
    
    Error report -
    ORA-13786: missing SQL text of statement object "1" for tuning task "my_sql_tuning_task3"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16255
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7133
    ORA-06512: at line 4
    13786. 00000 -  "missing SQL text of statement object \"%s\" for tuning task \"%s\""
    *Cause:    The user attempted to accept SQL profile for an object
               that has not a SQL text associated to it.
    *Action:   Check the identifier of the object and retry the operation.
    
    
    

    Would be really grateful if someone could point me in the right direction here.

    TIA...

    Personally, I wouldn't bother with a task of setting.

    If you are lucky who will recommend a sql profile based on adjustments of cardinality which may or may not be effective.

    I would just use either the COE_XFR_SQL_PROFILE. SQL script SQLT ( doc-id 1487302.1Support) or use SQL Plan baseline to apply the previous execution plan. The latter has the advantage of being able to make an evolution controlled all plans potentially better which would otherwise be generated.

    You can choose the older, better plan AWR in the same database or a different database, and then transport it.

  • ORA-06508: PL/SQL: called program unit is not found

    I found this error in a project and I was confused as the program unit is there, but the error indicates the program unit is not found. So I'm googling and find an answer here oracle - ORA-06508: PL/SQL: could not find program unit called - Stack Overflow where a packet can be stateless or stateful after recompilation. I wonder, the idea of the package is we can change the package body and compile without the need to compile the package specification if the specification is not changed. If I compile them both, it will be fine, no more error, but I need compile the client application - form of Oracle.

    My question is:

    1. as the variables, constants, and the sliders that declares a package create the State (as explained in the link above), when should I use?

    2. why the error information correctly? I mean why not... say something like... "the package is with State..."

    Thank you

    regard, ib

    1 use them when you need to use - that is what really you ask?

    2. like the other article says that you probably never gave us the last exception to a trace. What does "I found this error in a project" mean? You won't "find" exceptions - Oracle reports. If show details of how the code was executed and all of the exceptions as Oracle supplied ALL participate.

    Package plug most will include the constants and cursor statements. That rarely only functions/procedures will be declared. In General, do NOT recomiling/change packages in production environments.

    But if you do then you'll probably apps that do not as you describe. As doc says Oracle quotes will be implicitly recompile time code first (although still have reported that initial exception) so that the references are not lacking.

  • ORA-06502: PL/SQL: digital or value error: character string buffer too small in the functions

    Hi all

    FUNCTION to CREATE or REPLACE fnc_two (p_in_job IN VARCHAR2)

    RETURN VARCHAR2

    AS

    CUR CURSOR

    IS

    SELECT ename

    WCP

    WHERE job = p_in_job;

    v_first_name emp.ename%TYPE;

    BEGIN

    FOR my heart IN rec

    LOOP

    IF v_first_name IS NULL

    THEN

    v_first_name: = rec.ename;

    ON THE OTHER

    v_first_name: = v_first_name | ',' || Rec.Ename;

    END IF;

    END LOOP;

    RETURN v_first_name;

    END;

    SQL > SELECT fnc_two ('CLERK')

    2 FROM dual;

    SELECT fnc_two ('CLERK')

    *

    ERROR on line 1:

    ORA-06502: PL/SQL: digital or value error: character string buffer too small

    ORA-06512: at the 'APPS '. FNC_TWO', line 17

    SQL > select distinct work of emp

    2.

    JOB

    ---------

    CLERK

    SELLER

    PRESIDENT

    MANAGER

    ANALYST

    v_first_name: = v_first_name | ',' || Rec.Ename;

    The above statement is the original error. The value has been assinged to v_first_name is larger than the computer can handle.

    Increase the size of the variable v_first_name to avoid the error example

    v_first_name varchar2 (100);

  • Installed CC 30-day trial.  Getting the error "Lightroom can't create a catalog named"ightroom catalog on volume OC (c) because Lightroom can't save the changes to this place". Tried to "Choose a different catalog" same mistake several times.

    Installed CC 30-day trial.  Getting the error "Lightroom can't create a catalog named"ightroom catalog on volume OC (c) because Lightroom can't save the changes to this place". Tried to "Choose a different catalog" same mistake several times.

    Hello

    Try resetting preferences

    Note:-back up your Lightroom Catalog beforehand and save Photoshop preferences

    * Now reset preferences Hold Down CTRL + ALT + SHIFT (WIN) CMD + OPTION + SHIFT (MAC) while starting Lightroom. A dialog box appears prompting you to restore Preferences (LR)

    Once done open again Lightroom

    Make sure you have a lot of read/write of the location where you save the catalog... To create a folder on your desktop, confirm, then try to create the catalog again it

    I would like to know if there is a question...

    Thank you

    Assani

  • Text editor enriched ORA-06502: PL/SQL: digital or value error: character string buffer too small

    Hello

    I have apex user 4.2.3 with enterprise database edition 11, I page include RICH TEXT EDITOR, when I add data to this text and save it will record successfully and when I try to view this information in another page I see all the data, as expected, the problem when I try to go to the same page as RICH TEXT EDITOR error message apper ORA-06502 : PL/SQL: digital or value error: buffer string too small, I see this link https://forums.oracle.com/thread/2461151?tstart=0 but I don't know how it solve it, the problem is made data at the point of the rich text editor.


    Any suggestion?


    Thank you

    Thanks for the reply,

    Its standard form with text rich field, my question she same as link above I added before

Maybe you are looking for

  • Found.

    I found an iPod touch, but I can't access it because the deleted owner find my iCloud account, but I also have the serial number. Can identify the owner by Email Apple? Where can I get a reward?

  • Compaq CQ58-230SF: I forgot the password admin or bios for compaq CQ58

    I have a problem with my laptop. I do not remember the password bios compaq cq58-230SF. after heating 3 times enter theres a 63207873 code. Thank you for your help Bruno

  • Adding button autoscale

    Hello Im trying to add an AutoScale button at two scales X & Y of my chart. I know not on the scale of click right and x, y of thing... but I wang user to have the AutoScale button. I also try this: http://forums.NI.com/NI/board/message?board.ID=170&

  • Add the game app to OS window

    How could I add game Start Menu/games for the Windows operating system.  Who I should talk to him and what language should I use.  Its a game of cards like Solitaire and hearts.

  • The urge to Ultrabook 6 problem with recovery after failure of hard drive (out of warranty)

    Hello Please can someone tell me if it is true that to use HP factory recovery disks, hardware must be exactly the same as when purchased. After hours wasted trying to get the recovery disks to work, I find myself with the same "failed to retrieve @