Problem with Update Select in Stored procedure

I am using Oracle 8. I'm writing a StoredProcedure and Oracle doesn't like the statement:
update
Leave_Coverages
set
Rate_Monthly = Rate_Monthly + (select Rate_Monthly from Leave_coverages where Leave_Coverage_ID = 10800)
where
Leave_Coverage_ID = 10799;
When I run the above statement from the command line - I have no problem. This statement in the stored procedure works:
update
Leave_Coverages
set
Rate_Monthly = Rate_Monthly + 4
where
Leave_Coverage_ID = 10799;
So essentially, I'm having trouble using a select in an update statement, but only in a Stored Procedure.

Denis,
This question was answered on this forum in the last week or so but I wasn't quickly able to locate this post.
Basically Oracle prior to version 9 had an SQL parser and a separate PL/SQL parser. The PL/SQL parser had to be updated each time new features were added to the SQL parser; often it lagged behind so that there were things you could do in plain SQL but weren't supported when using the same SQL in a cursor or directly in PL/SQL (with an INTO clause or RETURNING ... INTO clause).
From Oracle 9 these two parsers have been rolled into one so that new features introduced into SQL automatically also become available when used from PL/SQL.
So the answer to your curiousity on whether it will work in 9 or 10 is: if it works in SQL it should work just fine from PL/SQL.
Cheerio,
Colin

Similar Messages

  • IE problem with img tag calling stored procedure

    I have an img tag in my JSP which looks like this (it has a very long src value):
    <img src="http://www.enetrix.com/cores/net_charts.display_temp_chart?vChartDef_in=ChartType%20=%20DIALCHART;Chart
    . . . and so on and so on . . .
    26,%2075.0);&vChartType_in=PNG&vChartURL_in=http://333.333.33.333/j2ee/servlet/chart"/>
    In short, the img calls a stored procedure and passes it a servlet among many other things. The procedure passes back an image to the browser.
    The image shows up in Firefox but not IE 7. I don't think its an issue with the stored procedure but I can't understand why IE doesn't show the image. Is there something I'm missing? I've tried both jpeg and png.
    Thanks
    Eric

    As the related posts suggest, you will need to use direct JDBC code for this.
    Also I'm not sure JDBC supports the RECORD type, so you may need to wrap your stored functions with ones that either flatten the record out, or take OBJECT types.

  • Problem with teporary table in stored procedure

    Hi,
    I have to execute a stored procedure in java , where the stored procedure has refcursor as out parameter and within the procedure the refcursor out parameter is populated from a temporary table
    when iam trying to get the resultset in my program iam getting object is no longer in use.
    I think this is becos the temporary table object is not available to my program
    can any one please help me

    I don't understand this part.
    Your procedure has "argSchemaName" as input parameter. Why do you have hardcoded owner name here in the cursor?
    >>
    CURSOR csrEligTables IS
    SELECT
    object_name
    FROM
    all_objects
    WHERE
    Owner = 'HI0XXX001'
    AND
    >>
    The anonymous block that you are running also has same owner name.

  • Problem with temporary table in stored procedure

    Hi,
    I have to execute a stored procedure in java , where the stored procedure has refcursor as out parameter and within the procedure the refcursor out parameter is populated from a temporary table
    when iam trying to get the resultset in my program iam getting the oracle error: ora-08103 object is no longer in use.
    I think this is becos the temporary table object is not available to my program
    can any one please help me

    I don't understand this part.
    Your procedure has "argSchemaName" as input parameter. Why do you have hardcoded owner name here in the cursor?
    >>
    CURSOR csrEligTables IS
    SELECT
    object_name
    FROM
    all_objects
    WHERE
    Owner = 'HI0XXX001'
    AND
    >>
    The anonymous block that you are running also has same owner name.

  • Problem with calling a oracle stored procedure

    Hi,
    I am using the following callable statement to invoke a oracle stored procedure/function.
    String myCallableStmt="{?=call IB_DDL.CREATE_DATASET(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
    But I am getting the following errors which do not make sense to me
    Exception in thread "main" java.lang.NullPointerException
         at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:870)
         at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:956)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1159)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3284)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3389)
         at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4222)
         at org.jtdemo.CreateDataSet.callCreateDatasetProcedure(CreateDataSet.java:246)
         at org.jtdemo.Main.main(Main.java:29)
    Can anyone help me here.
    Thanks in advance
    Kalyan

    May be I have used the word "procedure" loosely. Its infact a oracle function which returns a message of type Varchar2. Hence "{?=.....} here is used for registering the return value from the function. The remaining statement CREATE_DATASET(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), here the first 14 are input parameters whereas the last one is the OUT parameter of the function. Hope this helps. Anways I am pasting my code below...
    CallableStatement cstmt = null;
              String myCallableStmt="{?=call IB_DDL.CREATE_DATASET(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
              try {
                   System.out.print("Creating DataSet.......\n");
                   cstmt = targetCon.prepareCall(myCallableStmt);
                   cstmt.setObject("USER_ID_IN",this.USER_ID_IN);
                   cstmt.setObject("TABLE_NAME_IN",this.TABLE_NAME_IN);
                   cstmt.setObject("LAYOUT_IN",this.layoutCollection);
                   cstmt.setObject("DATA_TABLESPACE_IN",this.DATA_TABLESPACE_IN);
                   cstmt.setObject("INDEX_TABLESPACE_IN",this.INDEX_TABLESPACE_IN);
                   cstmt.setObject("STRING_POOL_NAME_IN",this.STRING_POOL_NAME_IN);
                   cstmt.setObject("NUMBER_POOL_NAME_IN",this.NUMBER_POOL_NAME_IN);
                   cstmt.setObject("DATE_POOL_NAME_IN",this.DATE_POOL_NAME_IN);
                   cstmt.setObject("LINK_POOL_NAME_IN",this.LINK_POOL_NAME_IN);
                   cstmt.setObject("DATASET_LEVEL_CONSTR_TYPE",this.DATASET_LEVEL_CONSTR_TYPE);
                   cstmt.setObject("DATASET_LEVEL_CONSTR_BODY",this.DATASET_LEVEL_CONSTR_BODY);
                   cstmt.setObject("POOLING_IN",this.POOLING_IN);
                   cstmt.setObject("SEGMENTATION_IN",this.SEGMENTATION_IN);
                   cstmt.setObject("DATASET_PARTITIONING_IN",this.DATASET_PARTITIONING_IN);
                   cstmt.registerOutParameter("DATASET_ID_OUT",OracleTypes.INTEGER);
                   cstmt.registerOutParameter("RETURN_MESSAGE",OracleTypes.VARCHAR);
                   cstmt.execute();
                   String returnMessage = (String)cstmt.getObject("RETURN_MESSAGE");
                   System.out.print(returnMessage);
              }catch(SQLException e) {
                   e.printStackTrace();
              }

  • Problem with parameter type in stored procedure

    Hi,
    create or replace TYPE NUMTABLE AS TABLE OF INTEGER;
    SELECT group_id, value_id, parent, sort_order
    INTO v_groupid, v_valueid, v_parent, v_sortord
    FROM req_details
    WHERE detail_id = parent_in(i);
    I'm trying to pass v_valueId, v_parent, v_sortOrd into testcase_add(valueId, parentIn sortOrder);
    but the parameters in the testcase_add procedure are of NUMTABLE type.
    How can these values be passed into the testcase_add procedure.
    Thanks in advance.

    Oracle version number is?
    Post the results of the following query:
    SELECT position, argument_name, data_type, type_name, type_subname, in_out
    FROM all_arguments
    WHERE object_name = 'TESTCASE_ADD'
    ORDER BY 1;I am not sure, from your example, I understand precisely what you are asking.

  • Delete and update records in Stored procedures

    I AM NOW STUDYING A STORED PROCEDURE ,AND I ENCOUNTER SOME PROBLEM WITH
    UPDATE AND DELETE SOME RECORD WHICH ONE IS UPDATED OR DELETED,
    THIS IS MY CODE:
    PACKAGE table_of_array IS
    type emp_rec is record(
         empno emp.empno%type,
         ename emp.ename%type,
         sal          emp.sal%type,
         deptno emp.deptno%type
    type arr is table of emp_rec
    index by binary_integer;
    procedure get_data(a in out table_of_array.arr);
    procedure do_insert(a in out table_of_array.arr);
    procedure do_update(a in out table_of_array.arr);
    procedure do_delete(a in out table_of_array.arr);
    END;
    PACKAGE BODY table_of_array IS
    procedure get_data(a in out table_of_array.arr)
    is
    i number:=0;
    begin
         for cur in (select empno,ename,sal,deptno from emp) loop
              a(i):=cur;
              i:=i+1;     
         end loop;
    end;
    procedure do_insert(a in out table_of_array.arr)
    is
         i number:=0;
         cnt number:=a.count;
    begin
         for i in 1..cnt loop
              insert into emp(empno,ename,sal,deptno)
              values(a(i).empno,a(i).ename,a(i).sal,a(i).deptno);
         end loop;
    end;
    procedure do_update(a in out table_of_array.arr)
    is
    begin
         /* WHICH RECORD AND ITEM HAD BEEN UPDATED */
    end;
         procedure do_delete(a in out table_of_array.arr)
         is
         begin
         /* WHICH RECORD HAD BEEN DELETED */      
         end;
    END;

    when you want to update, delete or insert records with a stored procedure you have to provide a procedure that locks the records
    i'll send you an example of an update procedure and a lock procedure
    PROCEDURE p_upd_devices ( resultset IN devtab) IS
    BEGIN
    FOR i IN 1..resultset.COUNT LOOP
              IF resultset(i).zone <> resultset(i).zone_ref THEN
              p_update_zone(resultset(i).zone, resultset(i).mdv_seq);
              END IF;
         END LOOP;
    EXCEPTION WHEN OTHERS THEN
    mecoms_general.logging(0, sqlerrm, 'pck$fill_error_devices.p_upd_devices');
    END; -- p_upd_devices
    PROCEDURE p_update_zone (pi_zone in metering_devices.zne_code%type, pi_device in metering_devices.seq%type) IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
              UPDATE metering_devices
                   SET zne_code = pi_zone
                   WHERE seq = pi_device;
                   commit;
    EXCEPTION WHEN OTHERS THEN
    mecoms_general.logging(0, sqlerrm, 'pck$fill_error_devices.p_update_zone');
    END;
    PROCEDURE p_lock_devices( resultset IN OUT devtab) IS
    BEGIN
    null;
    END;

  • I am having problem with updates CS5

    Hi,
    I am having problems with updating my CS5. I keep getting an error message "There was an error downloading this update. Please quit and try again later"
    Can you please help?
    Thank you
    Eli B

    See if doing it manually works
    All updates start here and select product, read to see if you need to install updates in number order, or if the updates are cumulative for the individual product http://www.adobe.com/downloads/updates/

  • Y510p and problem with Update Nvidia Driver

    Hi everyonei have problem with updating my y510p lenovo laptop nvidia driver ,my current nvidia driver version is 327.62 which i download from lenovo website,Now for better performance in new games like gta v and witcher3 ,i decide to updating nvidia driver,first remove my nvidia graphic driver from add or remove then download nvidia ver 350 from nvidia official web site , which nvidia website confirm it support my graphic card which is Gt755m , then i install new ver and during install i check clean install , after successful install , restart laptop , then there was problem . when i try to open nvidia control panel it wont running and an error showed up and said "You are not currently using a display attached to an NVIDIA GPU" .i try to open a game , game running in really low fps and i find out game run on hd graphic of my laptop and my nvidia graphic wont run .The only way to repair was i install my last nvidia driver 327.62 and run a system restore .guys what is your suggestion and how i can update my y510p nvidia driver ?Thanks   

    Hi Y510Man,
         The video graphics installation order is important. You need to install the Intel Graphics first, and then do the Nvidia. IIRC you should un-install the Nvidia driver, then re-install (or upgrade) the Intel HD Graphics driver. Reboot, and install the new Nvidia driver.
         I don't know why, but every time I upgraded my Y470 Nvidia driver, I had to use this procedure. First install, or re-install, the Intel driver, then install the Nvidia. You can't just upgrade the Nvidia driver without a re-install of the Intel. I think it has to do with the Optimus setting, and the automatic switching.
        Let us know how it goes.
    Cheers
    DragonRider

  • Problem with updating the PC Updater software

    Good evening (from Germany). I have a problem with updating my Nokia Software Updater. I can download the setup and I can execute this. But when the installation starts (0%) a error message appears. It's a problem with Windows Installer but I don't know how to solve the problem. Here is a picture with the exactly error message:
    http://img-up.net/?up=Nokia_probES8HJXXg.jpg
    I hope somebody knows the anser with this software...
    Greetings
    OS: Windows XP SP2
    Phone: Nokia 3110 classic Firmware: V 5.50
    Message Edited by dernamenlose on 24-Apr-2008 08:56 PM

    Good morning (from Denmark).
    I hve the same problem.
    OS: WinXP SP2
    Phone: N73.
    Greetings.

  • Problems with updating files in the cloud

    problems with updating files in the cloud

    What kind of problems?
    Have you recently upgraded to iCloud Drive on your iOS devices with iOS 8?
    Be aware, be careful, be prepared for iCloud Drive | TUAW: Apple news, reviews and how-tos since 2004

  • HT201210 nowadays have many user have problem with update to ios7 and need active with apple id maybe in the future in order escape from these problems must be stop use these products else. Because of simple user don't know about this technology and somet

    nowadays have many user have problem with update to ios7 and need active with apple id maybe in the future in order escape from these problems must be stop use these products else. Because of simple user don't know about this technology and sometime just hear from other user that it 's difficult to use then force they change phone that use to handle to another.

    It is a feature to discourage the theft of iPhones by making them useless if resold. It's not going anywhere. It's simple: just don't buy a phone until you make sure that the activation lock has been disabled.

  • Adobe Photoshop Elements Problem with update 9.0.3

    Problem with updates Elements 9.0.3
    Message title was edited by: Brett N

    Then follow the rest of the directions here:
    Error "Patch cannot be applied" | Photoshop Elements 9.0.3 update | Windows
    http://helpx.adobe.com/photoshop-elements/kb/error-patch-cannot-applied-photoshop.html

  • Problem with update Photoshop, Illustrator and Indesign CS6

    Hi all. I have problem with update Photoshop, Illustrator and Indesign CS6 on OSx 10.8.4. Application are OK but update (bug fixies) not working. Update failed. (U44M1P7)

    Hi El Gondo,
    The following might explain and help solve the problem...
    U44M1P7 - Updates :
    http://helpx.adobe.com/creative-suite/kb/error-u44m1p7-installing-upda tes-ccm.html
    U44M1P7, U44M2P7 - Creative Cloud Help / Can't apply Extension Manager update 6.0.2 | Mac OS :
    http://helpx.adobe.com/creative-suite/kb/unable-apply-extension-manage r-update.html
    Thanks!
    Ankit

  • Problem with update MUSE CC 2014.2 (october 6). after upgrading to the new version of Muse crashes very often (out without notice).

    Problem with update MUSE CC 2014.2 (october 6). after upgrading to the new version of Muse crashes very often (out without notice).

    HELP! i can't get ANYTHING done in the new muse - keeps closing.  once it crashes - i can't get the file back open!
    i've lost all my work!
    from my desktop - when it stared happening was with the updated version:
    Logging in build 2014.2.1.10 started at: Mon Nov 03 13:36:38 2014
    ========================================
    [00:00:42.416] Opening file '\\D-LAPTOP\_websites\dsbees muse\dsbees.muse' with status:success size:9797632 mod Date:Tue Sep 23 15:51:42 GMT-0500 2014 highestUID: 3548
    [00:01:03.898] Preparing to Save As over "\\D-LAPTOP\_websites\dsbeesTWO\dsbeesTWO.muse" exists: true
    [00:01:17.516] SaveAs complete for file '\\D-LAPTOP\_websites\dsbeesTWO\dsbeesTWO.muse' file size:9830400 mod Date:Mon Nov 3 13:37:51 GMT-0600 2014 highest UID:3551
    Build 232: Mon Nov 3 19:41:03 2014 UTC: Error: CSI: OOBE: Serial Number: Error Code: O-10 Error Message: Unable to retrieve the serial number (Note: this may not be an error)
    Build 232: Mon Nov 3 19:41:03 2014 UTC: Error: CSI: OOBE: Serial Number: Error Code: O-10 Error Message: Unable to retrieve the serial number (Note: this may not be an error)
    Build 232: Mon Nov 3 19:41:07 2014 UTC: Error: CSI: OOBE: Serial Number: Error Code: O-10 Error Message: Unable to retrieve the serial number (Note: this may not be an error)
    Build 232: Mon Nov 3 19:41:21 2014 UTC: Error: CSI: IMS: Connect: Error Code: I-200 Error Message: No Account
    Build 232: Mon Nov 3 19:41:21 2014 UTC: Unknown IMS error 'SHARED_NOACCT_ERROR' has occurred when retrieving IMS token.
    Build 232: Mon Nov 3 19:41:57 2014 UTC: Opening file '\\D-LAPTOP\_websites\dsbees muse\dsbees.muse' with status:This Adobe Muse site file requires a newer version of Adobe Muse. Please update to the latest version. size:9797632 mod Date:Tue Sep 23 15:51:42 GMT-0500 2014
    Build 232: Mon Nov 3 19:41:57 2014 UTC: This Adobe Muse site file requires a newer version of Adobe Muse. Please update to the latest version.
    Logging in build 2014.2.1.10 started at: Mon Nov 03 13:43:17 2014
    ========================================
    [00:00:21.481] Opening file '\\D-LAPTOP\_websites\dsbeesTWO\dsbeesTWO.muse' with status:success size:9830400 mod Date:Mon Nov 3 13:37:51 GMT-0600 2014 highestUID: 3551
    [00:00:30.373] AssertInDebug: Unable to run recovery. User file remains locked after 5 second pause.-assertInDebugOnly+DataBase/recover+MuseSite$/recover+MethodInfo-2886+DataBase$/run Recovery+apply+UIComponent/callLaterDispatcher2+UIComponent/callLaterDispatcher+end stack
    [00:00:30.404] Failed to recover file:\\D-LAPTOP\_websites\dsbeesTWO\dsbeesTWO.muse
    [00:00:30.420] Calling openConnection for file that doesn't exist? C:\Users\Owner\AppData\Roaming\com.adobe.AdobeMuseCC.2014.2\Local Store\Recovery\JXRoDn335LE0UosOdoStnQ Parent folder exists.
    [00:00:34.429] open of SQL connection failed for C:\Users\Owner\AppData\Roaming\com.adobe.AdobeMuseCC.2014.2\Local Store\Recovery\JXRoDn335LE0UosOdoStnQ
    [00:00:34.429] Failed to open mini-save connection B "C:\Users\Owner\AppData\Roaming\com.adobe.AdobeMuseCC.2014.2\Local Store\Recovery\JXRoDn335LE0UosOdoStnQ" Doesn't exist. Folder exists. error:SQLError: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'
    [00:00:34.429] EXCEPTION:[SQLC/internalOpen] SQLError: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'-SQLConnection/internalOpen+SQLConnection/open+DataBaseConnectionWrapper/o penConnection+MethodInfo-28954+EventDispatcher/dispatchEventFunction+EventDispatcher/dispa tchEvent+MethodInfo-28938+end stack
    [00:00:34.445] AlertAndExit because of: [SQLC/internalOpen] SQLError: 'Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'

Maybe you are looking for

  • Cannot delete icon services cache from trash.

    Hi everyone, I have a 15" macbook 2014 running yosemite. I was having trouble with a download that was stuck on pause so I thought I would empty the cache for the mac store. I trashed a file named com.apple.iconservices.store. That was fine I reboote

  • Is there a way to slice up a text box or box in general?

    I was trying to slice up a text box in order to have part of the box reveal the background I can make two separate text boxes and/or color boxes however I want a semi-transparent background color so I am afraid of things not aligning properly or ther

  • Reading attachments from CFolders(SRM) to ECC(PO)

    Hi All, I have a requirement where i need to read the attachments from SRM to ECC. When the bidders bid, they attach files in SRM, these files are saved in the C-Folders in SRM Box.(No DMS) Now, when the PO is created from the RFx, the attached files

  • JEditorPane parsing HTML

    Hi all, I am using JEditorPane and it's ability to parse HTML, which although is relatively old and crusty is certainly all I need for the job. Now, I understand there is a chain of classes involved in taking my .html file and turning popping into a

  • My battery drains in Mavericks instead of being boosted! Can anyone help?

    I thought in Mavericks your battery life was supposed to last longer. Now that I have downloaded Mavericks, my battery drains considerably fast. I appreciate everyone's help, THANK YOU!