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

Tags: Database

Similar Questions

  • 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.
    
  • 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.

  • Firefox does not start - claims that it is already open

    Firefox does not start. He claims to be already running, but that doesn't seem to be the case.

    I tried to create a new user profile, but when I try to open Firefox now, the menu "choose user profile". I tried the new profile and they old, and both give the same error message. "Firefox is unable to use the"Default user"profile because it is in use. To continue, close the Runspace of Firefox or choose a different profile. »

    There is an entry for firefox.exe in the menu of "details" to my task manager and nowhere else. When I try to put an end to this task, I get the following error: "the operation could not be performed - access denied."

    Due to some troubleshooting research, I tried to delete the parent.lock my profile folder, but I get this error: "the action cannot be completed because the file is opened in Firefox."

    I tried to transfer my bookmarks and preferences from Firefox to Chrome, but I had a similar error suggesting that Firefox was already open and I have to close first.

    I also turned off my computer and uninstalled and reinstalled Firefox several times.

    I'd really rather not lose all my bookmarks Firefox, modules, and preferences. I also prefer to use Firefox for Chrome, so if anyone can help me I would really appreciate it. I don't know what else to try.

    My PC runs Windows 10, incidentally.

    Try to delete the parent.lock file in the Firefox profile folder.

    See:

    What security software do you have?

    Try to create a new shortcut on the desktop Firefox and maybe to reinstall Firefox via a clean reinstall (i.e. remove the Firefox program folder).

    If you cannot remove the Firefox program folder and then try to rename this file to "Mozilla Firefox.old".

    • (Windows 64 bit) "C:\Program Files (x 86) \Mozilla.
    • (32-bit Windows) "C:\Program Files\Mozilla Firefox\"

    Start the computer in Mode safe mode with network support Windows (on the startup screen, press F8) to see if that helps.

  • None of my icons in Firefox will open Firefox today. And when I try to reinstall it, the message said that Firefox is already open. But I'm not.

    Every morning, I click on the Firefox icon and it opens. Today, that he will not. I try to reinstall it, a message that Firefox is already open. But I'm not. Of course I can use Chrome or Internet Explorer (as I do), but I do like Firefox. And I also want to know what the problem is... in case something serious is wrong with my computer.

    Hello

    • Go to your task manager (right-click your taskbar, and then select "Start Task Manager" - http://www.howtogeek.com/108742/how-to-use-the-new-task-manager-in-windows-8/)
    • Make sure that Firefox is on this list. In this case - select this option and end task.
    • Try to open Firefox again; If it still doesn't after some time, repeat the two steps above, and then try the Firefox Safe Mode
      • On Windows: Hold down the SHIFT key when you open the desktop Firefox or shortcut in the start menu.
      • When the Firefox Safe Mode window appears, select "start mode safe."

    When find you what is causing your problems, please let us know. This might help others with the same problem.

  • I get an error message that "a copy of Firefox is already open. Only one copy of Firefox can be open at a time"and I have no open copy.

    I get an error message that "a copy of Firefox is already open. Only one copy of Firefox can be open at a time"and I have no open copy. How can I fix this problem? I like firefox because it runs many technical programs on the web that do not work with safari. I have FireFox installed on my PowerBook MacPro OS X 10.7.5 32.0.1 version. My activity monitor shows all activity of FireFox, so don't know not what he sees

    Check out these links;
    http://www.bing.com/search?q=Firefox%20not%20Close%20mac

  • I can only open a new tab by clicking on an element to an already open tab and choose open in a new tab

    I can only open a new tab by clicking on an element to an already open tab and choose open in a new tab. Nothing else works for example file, new tab or by clicking the new tab to the right of the last tab.

    Uninstall the Ask Toolbar. It can cause this problem.

    If this does not resolve the problem:

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • I tried to uninstall and reinstall Firefox several times. Whenever I try to open Firefox I get an error message saying "Close Firefox","a copy of Firefox is already open. Only one copy of Firefox can be open at a time. »

    I uninstall Firefox, and then reinstall Firefox, try to open Firefox and get an error message in a box indicating popup.

    "Closing of Firefox.

    "A copy of Firefox is already open. Only one copy of Firefox can be open at a time. »

    Create a new profile as a test to see if your profile is the source of the problems.

    See "basic troubleshooting: a new profile:

    If this new profile works then you can transfer files from the old profile to the new profile, but make sure not to copy corrupted files.

    See:

  • Firefox does not open. Cannot update or delete. Says it is already open and I can't find how to close it.

    Firefox shows that it is already open and must be closed in order to update or delete. I can't locate a place to complete the process. It's probably something very simple, but I'm not a computer genius. Thank you!

    Have you tried you look for firefox.exe in the Task Manager process tab (you can get to that by using Ctrl-Alt-Delete, usually)? If you click firefox.exe in the list and then click on end process, it should close Firefox, even if Firefox does not seem to be running (sometimes the process takes a little longer to close the main window). If all else fails, maybe a reboot?

  • When I drop to the bottom of recent history how can I open a second a site already open tab without having to go to "switch to tab"?

    I often have several tabs in the same open site, but using the dropdown won't let me switch to the already open tab. Is there an easy way to do it without having to re - enter the site for each new tab? Disable the option "switch to tab"?

    There is an add-on that can disable this, go to the tab no more - https://addons.mozilla.org/firefox/addon/switch-to-tab-no-more

  • Error closing firefox message appears at the start of the application and indicates that the copy of firefox is already open. How can I find the copy open and close all the time?

    When I consider my daughter and you try to start Firefox (she was previously using Safari) an error message is displayed stating to "close Firefox: a copy of Firefox is already open." Only one copy of Firefox can be open at a time. "Except that I don't see a free application copy, unless it is somehow launched during the connection, a framework I am not either. Firefox works fine on other user accounts.

    Is there still a current default profile folder?

    • < User > /users//Library/Application Support / Firefox/Profiles/< profile >.

    If not, then delete the file profiles.ini

    Which will cause Firefox to create a new default profile.

  • Then, Firefox crashes when I try to reopen, I get a message saying that it is already open and must be closed. It is not open and I can't shut it down and have to restart. It is very annoying, as often happens.

    Firefox closes unexpectedly so when I try to open it I get a message saying that it is already open and I first need to close. I can't find it anywhere open and then I have to restart to open Firefox again.

    See "hang out":

    See also:

  • When you try to start Firefox I get a message saying "a copy of Firefox is already open. Only one copy of Firefox can be open at a time. "I started a new profile, but the Profile Manager always tells me that by default it is still in use.

    When you try to start Firefox, even once, I got a message saying "close Firefox. A copy of Firefox is already open. Only one copy of Firefox can be open at a time. "This issue is addressed in Mozillazine but nothing I've tried there seems to work. I started a new profile in the profile manager that gets at least upwards and the functioning, but strangely enough the Manager also told me the old (default) profile is still underway, although I can't find a way to close it. Also, I can't find the default profile in my Profile Manager. can anyone help?

    This has happened

    Just once or twice

    == I thought that I had left Firefox and he was new.

    I get the same problem from time to time. It is not a solution but I go into Task Manager (select by right clicking on an empty area of the start bar) and under the research process and, invariably, there is a 'hidden' version to use the FF. I selects & close via Task Manager and then am able to restart FF.

  • Read excel cell when excel is already open

    Hello

    I want to read a specific cell of a spreadsheet with excel already open. LabVIEW has only to read the cell and can't open excel.

    I have several examples that show:

    1. Labvview open excel

    2. Select excel file

    3. Select the workbook

    4. Select Sheet

    5. Select the cell

    6. read the cell

    7. close the workbook

    8. close excel

    In my vi I only need 3 to 6 step

    Thanks for your help

    Djamel

    The joint vi (LabVIEW 2012) will return the value in cell "A1" "Sheet1" of the already opened excel workbook "Book1".

    Change the values for your specific names in the workbook and worksheet and of cells needed.

    The value returned is a Variant needs to be converted with 'Variant to data' according to the type of data

    Ken

  • delete the file or ignore if it is already open

    I have a piece of code that dates back to the time of LabVIEW 7.1 who should write an ascii text file to a server once every 30 minutes.  Each half hour file is the previously published, to which is added another 30 minutes of data and 4 contains more data than does three 30 minutes so I iterate through a file number, 2, 3, 4, etc. and so on...  I write each new file I attempt to remove his predesessor such that in an ideal case there is only a single file sitting there at all times...  However, I want people to be able to open files on this server remotely any time they want to... In LabVIEW 7.1, if I tried to delete a file that was already open, it did NOT generate a stop error show but just went...  I could manually later then go start the file here or there that someone would open during the attempt to delete was made...

    But now I'm running in LabVIEW 2011 there is no the same luxury...  If I try to delete a file that is already open, the code generates an error and wait...  It is bad because nobody is there to answer...  I read another post on the search to see if the temporary files exist, but I don't know exactly what to look for so that people can use one of a slew of programs, reading from Excel to Matlab to WordPad to open these ascii text files...  Surely, there must be an attribute of a file that I can watch that will tell me it is currently open and if so, I can just ignore this deletion and move...

    Bottom line, it is how can I tell that a file on a server is opened by an unknown application on some Office far away?

    Thanks bob...

    Most likely, you are running in wiich auto error handling is enabled by default in new versions of LabVIEW (it did not exist in older versions). Whenever a function returns an error, but the error is not wired, it will appear an error message.

    Make sure that you manage the error in not leaving the error disconnected. (for example just Ingore by wiring up to a limit of structure) so it appears an automatic error dialog box.

Maybe you are looking for