SQL Procedure doesn't work with "current of cursor" Oracle 11g

hi all
i have written a procedure which should update every row for a given column on a given table.
here is the code:
CREATE OR REPLACE PROCEDURE "xxx"."loop_update_autowert_x"
startwert number,
column_name VARCHAR2,
table_name varchar2
AS
stmt varchar2(2000);
stmt2 varchar2(2000);
zaehler number;
sum_gesamt number;
TYPE obj_ref_type IS REF CURSOR;
obj_cur obj_ref_type;
begin
stmt2:='select rownum , rowid from ' || table_name || ' for update';
OPEN obj_cur FOR stmt2;
dbms_output.enable(1000000);
dbms_output.put_line ('Startwert ist: ' ||startwert);
dbms_output.put_line ('Column Name ist: ' ||column_name);
dbms_output.put_line ('Table Name ist: ' ||table_name);
loop
fetch obj_cur into zaehler , my_rowid;
exit WHEN obj_cur%NOTFOUND;
sum_gesamt:=zaehler + startwert;
stmt:='update ' || table_name || ' set ' || column_name || ' = ' || sum_gesamt || ' WHERE current of obj_cur';
dbms_output.put_line (stmt);
execute immediate stmt;
end loop;
close obj_cur;
end;
the error i get is:
Anmeldung bei der Datenbank Oracle Test2.
ORA-03001: Funktion nicht implementiert
ORA-06512: in "xxx.loop_update_autowert_x", Zeile 29
ORA-06512: in Zeile 10
Startwert ist: 5
Column Name ist: a
Table Name ist: T
update T set a = 6 WHERE current of obj_cur
Prozess beendet.
Abmeldung von der Datenbank Oracle Test2.
have anybody an idea what is wrong or is this construction with the clause "open cursor for statement" not possible with where current of cursor
thx for helping
best regards
Hans-Peter

Hello
You're using rownum in your query so why not just use it in the update?
CREATE OR REPLACE PROCEDURE "xxx"."loop_update_autowert_x" (
   startwert      NUMBER,
   column_name    VARCHAR2,
   table_name     VARCHAR2)
AS
   stmt         VARCHAR2 (2000);
BEGIN
   DBMS_OUTPUT.enable (1000000);
   DBMS_OUTPUT.put_line ('Startwert ist: ' || startwert);
   DBMS_OUTPUT.put_line ('Column Name ist: ' || column_name);
   DBMS_OUTPUT.put_line ('Table Name ist: ' || table_name);
      stmt :=
            'update '
         || table_name
         || ' set '
         || column_name
         || ' = ROWNUM + :startwert'
      DBMS_OUTPUT.put_line (stmt);
      EXECUTE IMMEDIATE stmt USING startwert;
END;Wherever possible, I would suggest you try to avoid dynamic SQL as it hides dependencies and so can make maintenance more difficult.
Also, it's not a great idea to splatter your code with DBMS_OUTPUT all over the place. It's better to wrap it in something so you have a bit of control over when it is used - something like log4plsql would be an example...
HTH
David

Similar Messages

  • Form on a SQL Query - doesn't work with SELECT * - bug or feature ?

    When I do this,
    Create Page -> Page with Component -> Form -> Form on a SQL Query -> SELECT * FROM EMP
    I do not get any items displayed and it creates a simple HTML region / page. Do we have to necessarily specify the column names ?
    Iam looking at a way to see if any addition of columns in the table does not involve IT intervention in recreating the form.
    When we try to create with Form on a SQL Query, then shouldn't it be similar to the Report where the same thing works, if I give SELECT function_returning_columns() from DUAL even then the same thing happens where it creates an ITEM called functions_returning_columns() it creates HTML region
    I asked a related question with no answer :-( in
    Dynamic Creation of Items in Runtime through Application UI

    Hi Marc,
    Thanks. I just tried something like this. Taking the EMP table example, (it doesn't matter which table), I created a region based on a Pl/Sql function returning SQL query
    ( I selected the vertical report template including nulls to display it like a form ) :
    DECLARE
    v_sql VARCHAR2(3000) ;
    mn_idx NUMBER := 1 ;
    BEGIN
    v_sql := 'SELECT ' ;
    FOR recs IN (SELECT * FROM ALL_TAB_COLUMNS WHERE TABLE_NAME = 'EMP' ORDER BY COLUMN_ID)
    LOOP
    v_sql := v_sql || 'HTMLDB_ITEM.TEXT(' || mn_idx || ',' ||
    recs.column_name || ') ' || recs.column_name || ', ' ;
    mn_idx := mn_idx + 1 ;
    END LOOP ;
    v_sql := SUBSTR(v_sql, 1, LENGTH(v_sql) -2) ;
    v_sql := v_sql || ' FROM EMP WHERE EMPNO = 7369 ORDER BY 1 ' ;
    RETURN v_sql ;
    END ;
    This allowed me to do my updates etc.., Then I created a button called 'Apply' and a process called 'update_changes' on button click and defined this:
    DECLARE
    v_sql varchar2(1000) ;
    mn_ctr NUMBER := 1 ;
    BEGIN
    v_sql := 'BEGIN UPDATE EMP SET ' ;
    FOR recs IN (select COLUMN_ID, COLUMN_NAME, DATA_TYPE
    from all_tab_columns where table_name = 'EMP'
    ORDER BY COLUMN_ID) loop
    -- Make changes here if required- this is assuming 9 columns --
    v_sql := v_sql || recs.column_name || ' = HTMLDB_APPLICATION.G_F0' || mn_ctr || '(1),' ;
    mn_ctr := mn_ctr + 1;
    end loop ;
    v_sql := substr(v_sql, 1, length(v_sql) - 1) ;
    v_sql := v_sql || ' WHERE EMPNO = 7369; END ;' ;
    execute immediate (v_sql) ;
    END ;
    Since this is for example, I didn't include code for Checksum and hardcoded empno = condition and have provision for 9 columns. I made some changes and tried saving it and I was able to do it.
    I altered the table to add a column / drop a column and when I relogin, Iam able to see the changes.
    Can you tell me if there could be any drawbacks in this approach ?.

  • HTML DB 2.0 SQL Workshop doesn't work with Firefox

    I have installed version 2, and all is well in I.E, however if I use firefox (1.0.x, 1.4.x, 1.6.x) it is impossible to browse or create objects as the required fields and buttons do not appear.
    I have tried this on a number of v2 HTML DB installations and the behaviour is the same.
    I haven't noted many other posts on this so I am just wondering whether it is only me having the problem, or if everyone is still on 1.6

    Hi Carl,
    Yeah, the version numbering 1.4 and 1.6 are the alpha and beta builds of Firefox.
    After doing a complete clean re-install of FIrefox 1.07 (release version) and a new profile, I still get the same behaviour. However, testing on htmldb.oracle.com, I get the correct behaviour, so it appears to be a problem with the version 2 installations I have done. May be HTTP server version.

  • I have upgraded Acrobat Standard from version 8 through time until I am currently using version X, which doesn't work with Office 2013.  Can I upgrade to version Standard XI?

    Over the years I have upgraded Acrobat Standard from version 8 to currently working with version X.
    However, since getting a new laptop it doesn't work with Office 2013.
    Can I upgrade to Standard XI?

    Upgrade pricing now only applies to version 9 and X. So if you have a retail serial number for X, you should be able to upgrade. (Or consider subscription).

  • The DB tools doesn't work with Microsoft SQL

    I am tring to write series of waveforms to a database. The DB tools doesn't work with Microsoft SQL, but when i replace the SQL with Access, it works fine. I have to use SQL in the application.
    Any advice pls?
    longing for your reply.
    Attachments:
    test.vi ‏47 KB

    Right off hand I would say the problem is that you are connecting through ODBC. Try the native SQL Server driver, your connect string should define the provider as "SQLOLEDB.1".
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • The Bluetooth on my 2012 Lexus doesn't work with my iPhone 5.  My old android phone worked perfectly with my car.  Even the tech guy at Lexus couldn't get it to work.  What is apple doing to fix this.

    The Bluetooth on my 2012 Lexus doesn't work with my iPhone 5.  My old android worked perfectly with my car.  Even the tech specialist at Lexus couldn't get it to work.  Lexus said that other iPhone 5s were having the same problem.  What is apple doing to fix this?

    Going to the local Apple store this morning...
    My problem is not uncommon as the board is showing signs of this happening to many others as well. That is where I found the restore and reboot information to try to solve the issue of crashing apps.
    I understand that Apple will not "give away the cow", but letting iPhone users know that the problems they are having are being addressed by Apple is a little more comforting than nothing at all. Other wise, all the apps in world are useless and even more importantly worthless, if a person has to reset/reboot/reload just to get them to work.
    IF Apple can not address the basic problems with todays iPhone apps, why should one believe that the iPhone 3.0 OS is any better? Using a PC comparison, which is better, XP or Vista. If the current iPhone OS of 2.2. what ever is not working that well (as related to down loaded apps and iTunes), will OS 3.0 be any better?
    The waste of time I refer to is in going to the apps store and downloading the apps... Again why by apps if the free version does not work?

  • Media Encoder CS4 doesn't work with Premiere (pic related)

    Oh hai!
    I just got Adobe Master Collection CS4 and my Media Encoder doesn't work with Premiere CS4. When I try to export the file, Encoder starts normally. Then I click "Start queue" and Encoder starts loading. Loading takes almost five minutes, which is a long time, because my project is very simple. After that nothing happens, just a warning sign appears. When I click it open, some kind of log file open and it says:
    Encoding failed
    Could not read from the source. Please check if it has moved or been deleted.
    And I didn't deleted anything. So what does that mean? Why that "Source Name's" path is different than my project files path? Can this problem relate that somehow?
    I have also another problem with Premiere CS4, maybe there's a link between these two problems. I can't get Premiere projects linked to open in Premiere CS4. When I right-click the project icon, and click “Open with…”, I can't find Premiere from the list. When I click "Browse", I can find Premiere.exe from my computer, but if i doubel-clicked it, nothing happens. It won't appear to the list or anywhere else. Or have I missed something? So now the project files are linked to open in After Effects. Of course I can open projects from Premiere, but how do I get them open straight from file?
    I have long experience using Adobe Premiere and this is the first time I got this kind of problems. I have also downloaded new updates for Premiere and Encoder, this didn't help. Does that matter, that I didn't installed Premiere in C-drive? However it's in my computers internal drive, I have divided my hard drive for five parts, one part contains all of my softwares. My scratch disks are in different hard drive (external), does that matter? I tried different location, but that didn't help.
    Please help, I can't do any video editing, because of this problem. And sorry for my english, ask if you didn't understand something. =)

    Hello, this is terrible problem, which i found in CS 6 softwares ...
    solution i found only working, is uninstall and reinstall full package.. but it is not all,
    you need to do BRAND NEW admin account in windows, and install it there.
    that means, i could not export after repair from encoder in my original account never more (!!)   .. this is really terrible way how to repair this issue, because :
    1.by reinstalling of software, client WASTE HIS TIME
    2.by necessity to begin work in another windows profile you again WASTE YOUR TIME because of learning and migrating all other profile modifications, which i see really unaccpetable. Adobe means, this solution of repair is ok, and they did not do till today any steps of creating some "clever" solution.
    I ask everybody, who will meet this issue in future, guys, please, complain about this situation, give "BUG Report" to them, and write "feature request" to them , in the way of creating some repair tool, which check actual  "broken" connections between encoder and premiere, which refuses to "take material" from it and encode, and REPAIR it automatically..  
       I am not IT, but ..does it seems so hard to create this ? Adobe IT developers should know their systems, and should create such utility tool really easy.
    History of this problem and detailed description, HOW i did "repair" this. With wasting of app 2,5 days of my working time :
    1. after repairing "error 5" problem , i solved it by reinstalling the suite from the new admin user profile (profile B) . 
    I continued my work on my normal working windows profile . (profile A)
    Every cooperation (AE+Pr, export media via "queue" to Encoder) was working fine . . .
    2. suddenly it stop working (without knowing any possible reason - i did not do installations )
    and showed in error export log file :
    "Could not read from the source. Please check if it has moved or been deleted."
    3.repair via procedure(procedure "a"):
    i did this procedure on the profile B (profile from last time installation of repairing problem error 5)
    I did these steps :
    a-uninstall master coll suite
    b-i used Adobe cleaner tool (remove ALL)
    c-removed raw directories in locations
    •C:\Program Files\Adobe
    •C:\Program Files(x86)\Adobe
    •C:\Program Files\Common Files\Adobe
    •C:\Program Files(x86)\Common Files\Adobe
    •C:\ProgramData\Adobe
    d-removed these links from registry file
    •HKEY_LOCAL_MACHINE\SOFTWARE\Adobe
    •HKEY_CURRENT_USER\Software\Adobe
    •HKEY_LOCAL_MACH INE\SOFTWARE\Wow6432Node\Adobe
    •HKEY_CURRENT_USER \Software\Wow6432Node\Adobe
    e-restarted the PC
    f- newly installed the Master Coll CS6
    g-update the software
    result of repair of "3" : problem still exists
    4.Ok i find out after coordination with support, it should have been created  ANOTHER NEW admin account.
    4a:so i did the same procedure (uninstalling) in profile B
    4b: and then i created brand new admin profile (profile C)for INSTALLATION of software
    4c: restarted the pc (and did not updated it yet)
    result :
    ==exporting of any sequence/raw/AE link video material from premiere via "queue" (Encoder) (profile C) : export WORKS
    ==exporting of any sequence/raw/AE link video material from premiere via "queue" (Encoder) (profile B) : export WORKS
    ==exporting of any sequence/raw/AE link video material from premiere via "queue" (Encoder) (profile A) : export DOES NOT WORK ! ! !
    (in profile A, is possible to export some raw video material in encoder which is imported to it via "drag and drop)
    problem i see:, i have my basic profile A, which i am interested to work, because of all my directory modifications are in there..
    this issue should be some "broken" connections between encoder and premiere, which refuses to "take material" from it and encode.
    what i expect :
    to get from Adobe some repair tool, which automatically checks these connections and repair if necessary, without necessity of founding the new profile and reinstallation of whole software.. this is madness !
    what i do NOT expect from Adobe:
    to get from Adobe advice of kind : you have to reinstall full software in new admin profile. sorry , we do not know the solution, because we do not know, how do behave our software.

  • Numbers 3.2 has changed too much, it doesn't work with my project anymore. How do I revert back to the previous version I was using?

    Numbers 3.2 has changed too much, it doesn't work with my project anymore. 1) The sheet panels used to be on the left hand side and easily reviewable and searchable, but now they are on the top and it's harder to find a specific folder without scrolling (too time consuming), 2) I used to be able to duplicate a folder within my sheet panel window by simply clicking on a folder and hitting Command D, but that doesn't work now so it looks like I'll have to spend even more time to recreate the same tables that used to be easily duplicated, and 3) I can't choose fill colors that matched my project anymore because there are only limited choices available now. And these are only the changes that I'm aware of. I am very disappointed and frustrated. Whatever the motivation was to limit Numbers 3.2, I want the previous version back. How do I revert back to the previous version I was using?

    The sheet panels used to be on the left hand side and easily reviewable and searchable, but now they are on the top and it's harder to find a specific folder without scrolling (too time consuming),
    You can scroll more quickly between sheets if you don't use the left-right triangles, but instead move the cursor up into the bands with the "tabs" and drag right or left.
    Also, if you have a lot if sheets for which you want a quick vertical list, then you can try the following have something like this pop up (showing your sheet names automatically) whenever you hit a keyboard shortcut (in my case shift-command-j):
    This is done via a Jump to Sheet Automator Service (Dropbox download).  To install just doubleclick the .workflow package and (if needed) click 'Download Anyway' in System Preferences > Privacy & Security.
    This will cause a new item to appear in your Numbers > Services menu.  Then, if you want a keyboard shortcut, go here in System Preferences and add one:
    You can rename or remove the service by holding down the option key in Finder and choosing Go > Library > Services. You can also view the AppleScript contaned within the service by opening the .workflow package in Automator.
    This particular service jumps to the first cell of the first table of the sheet you choose from an automatically generated list of all sheets in the current document.
    SG

  • IPhone original doesn't work with Belkin TuneBase FM after 2.0.1 update

    iPhone original doesn't work with Belkin TuneBase FM after 2.0.1 update

    Firstly, XE 10.2.0.1 isn't the same as 10gR2 10.2.0.1
    It was released a bit later and had some fixes that were in later 10.2.0.x patchsets (and also had some different security settings). Maybe they should have gone with 10.2.1.1.
    Second, the embedded PL/SQL gateway was okay for XE, but isn't supported for Apex on the Standard/Enterprise Edition until 11g. It doesn't mean it never works, but it does mean that you shouldn't rely on it.
    That said, there are other issues with 10.2.0.1 so I'd recommend going for the latest patchset anyway.
    Thirdly, if you get the XDB login dialog box, something has gone wrong. For the embedded PL/SQL gateway, XDB is acting as a virtual webserver. Generally what should happen is you connect to the webserver (XDB) and request a page (the APEX login page) and XDB should give it to you, no questions asked.
    If it asks you to login then the XDB webserver is running but is trying to get authorisation before it gives you the page. [By the way, if it does prompt for a username/password, it is expecting a database username/password, not an apex one or an O/S one] I'd suspect something is wrong with the setup.
    What happens if you ask for a simple image like
    http://URAN:8080/i/bottom_left.gif

  • SQL query doesn't work in VB program

    Hi:
    The following SQL query doesn't work into a VB program, I'm using Oracle OLEDB to established connection to the DB, ... the query returns 0 rows ...
    When I run this same query from any SQL Plus, works well (returning me something like 119 rows) ...
    Any clue or hint ??
    Thanks in advanced
    Angel Castro
    SELECT OPERADOR, ID_ALIMENTADOR, RB_FSC, NUM_CTROL, COND_OPERA, TRANSITORIO, PENDIENTES, ANORMAL, EDO_REAL, IDENTIFICADOR, CAUSA
    FROM HISTORICO_OPERACION
    WHERE (FECHA BETWEEN '20-AUG-2004' AND '5-NOV-2004')
    AND (HORA BETWEEN '10:00:00' AND '16:00:00')
    ORDER BY ID_ALIMENTADOR ASC;

    Is the column FECHA of datatype DATE?
    Are you running the query with the constant date looking like strings ('20-AUG-2004' in your post, for example) as-is from the VB program?
    If not, are you binding the parameters correctly?
    What is the setting of your NLS_DATE_FORMAT parameter?
    What happens if you do a
    ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'from your VB program before running the query?

  • Lexmark scanner doesn't work with mac os x

    I have a problem with my scanner lexmark p4330. For two weeks now it doesn't work with my imac. I have the imac os x 10.7.5.
    When I try to scan, my printer displays "the all in one driver did not respond" and in Image Capture it displays "lexmark language error".
    I updated my softwares, there's one for lexmark but I can't install it and I don't know why!
    Can someone help me please?

    Mmm. Not sure what's going on. Has scanning ever worked with the OS you are currently running?
    A couple of suggestions (my last two I think as I'm running out of ideas ). I realise that your problems are only with scanning, but sometimes resetting the printing system resloves printing problems. I wonder whether it will help with the scanning issue given that Print & Scan are lumped together in System Preferences. To do it go to:
    System Preferences>Print & Scan, Control+Click or Right Click on the printer on the left and select 'reset printing system'. All printers will be deleted and need to be added again using the '+' button.
    If that doesn't help my last suggestion is to download the paid for app VueScan (which you can run in demo mode for free) to see whether it works or not. VueScan is very good and driving numerous types of scanners:
    http://www.hamrick.com

  • What apple email program works with OSX 10.6.7?  I have Apple mail 4.4, but it doesn't work with OSX 10.6.7?

    What apple email program works with OSX 10.6.7?  I have Apple mail 4.4, but it doesn't work with OSX 10.6.7?

    The reason you're seeing this is that you have somehow gotten an outdated copy of Mail on your system.  One possible reason is that you moved Mail out of the Applications folder (or into a sub-folder inside the Applications folder), in the process preventing it from being updated.  You'll want to put Mail back directly in the Applications folder if this is the case.  The other possibility is that you have somehow installed, restored or copied an old copy of Mail on your machine.
    In either case, as long as Mail is in the right place, applying the combo updater will update Mail to the current version.  Software Update cannot do that because Software Update sees that you are using the current version of the OS and believes there is no need to update, while the combo updater "forces" installation of all updated files.

  • Seconds_between doesn't work with variables in SQLScript

    There is a sample procedure:
    create procedure testproc
    language SQLSCRIPT
    as
    l_curtime timestamp;
    l_timedelta integer;
    begin
      select systimestamp into l_curtime from dual;
      select seconds_between(:l_curtime, systimestamp) into l_timedelta from dual;
    end;
    It should return seconds between 2 timestamp values.
    The code returns an error:
    Could not execute 'create procedure testproc language SQLSCRIPT as l_curtime timestamp; l_timedelta integer; begin ...'
    SAP DBTech JDBC: (at 160): inconsistent datatype: line 8 col 10 (at pos 160)
    With «time» and «date» datatypes that's the same. So, seconds_between doesn't work with SQLScript variable (in this example, l_curtime). Is it a normal behaviour or supposed to be a bug?

    Hello,
    I can confirm same behavior - using variable inside seconds_between function leads to error. If you put there static string it is ok.
    Of course you can always create "dummy" table (having 1 row with 1 column) where you will store the result of first call and then you will reference in second. But of course it is not that clean and it will be slower (especially if called many times).
    But I would suggest to wait few more days - there should be SP03 released and everything can be different.
    Tomas

  • Google toolbar doesn't work with Firefox. How to Fix?

    The Google toolbar doesn't work with my current version of Firefox. When I went to update, the Google toolbar was removed and I can't get it back. How do I fix this so I can still use Firefox?

    Google needs to update the Google Toolbar program for Firefox 5.0.
    The Google Toolbar '''7.1.20110512W''' version does work pretty good in Firefox 5.0 by using the Compatibility Reporter extension. But not every feature works 100%.<br />
    https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/
    http://googlesystem.blogspot.com/2011/06/enable-google-toolbar-in-firefox-5.html

  • Trying to load illustrator 6cs onto new mac and the old activation code for my ill cs doesn't work with it

    Trying to load a downloaded version of illustrator 6cs onto new mac and the old activation code for my illustrator cs doesn't work with it.  Do I need a new code or am I missing something?  Same goes for my Photoshop cs.

    you need your serial number.
    if you purchased from or registered with adobe check your account, https://www.adobe.com/account.html

Maybe you are looking for

  • Satellite C855D-S5237 Laptop HDMI Output Not Working

    Hi, I have a Toshiba Satellite C855D-S5237 Laptop and the HDMI Output is no longer working on my Toshiba TV. The TV does not recognize that anything is connected and the laptop doesn't recognize the TV as a display option. I have used this laptop man

  • [SOLVED] OpenBox with XP in VirtualBox

    Hi All I'm hoping someone has an answer to this one. I'm in the process of switching from Gnome 3 to OpenBox. I'm almost there except for getting VirtualBox to work correctly in seamless mode. If I login to Gnome 3 then seamless virtualbox works bril

  • Can you use anchors with tabbed panels???

    Im trying to use anchors with tabbed panels but they dont seem to work.  I need to be able to link to specific tabs and specific areas within those tabs, but I haven't been able to find a way to do this.  Does anyone know or have a work around?

  • Help! wifi constantly dropping and (looking for network)

    I attempted to updated my Macbook air via MacBookAirUpdate.pkg. I was prompted (this is not supported on your system). I am having a major problem with my wifi constantly dropping and searching (looking for network) I was told this update have the fi

  • FM Transmitter - Griffin iTrip AutoPilot - Compatible?

    Hello: I just purchased a Nano 6th Gen for my wife. She has to have an FM transmitter and her old school original iTrip obviously does not fot the Nano. I have purchased but not opened the iTrip AutoPilot from Griffin. Before trying, I thought I'd fi