Cursor FOR UPDATE OF when querying multiple tables.

When I run the below code I am able to update the required table:
DECLARE
    CURSOR cur_get_recs1 IS
        SELECT *
          FROM ncotestaging os
         WHERE os.ote_status = 1
           AND os.action_type = 'A'
           FOR UPDATE OF ote_status;
BEGIN
    FOR recOTEstage IN cur_get_recs2
    LOOP
       dbms_output.put_line('Updating Row from ' || recOTEstage.ote_status || ' to: 2');
        UPDATE ncotestaging
           SET ote_status = 2
         WHERE CURRENT OF cur_get_recs2;
    END LOOP;
END;
/Results as expected on my 5 rows...
SQL> @test.sql
Updating Row from 1 to: 2
Updating Row from 1 to: 2
Updating Row from 1 to: 2
Updating Row from 1 to: 2
Updating Row from 1 to: 2However, when I update the Cursor to the following....
    CURSOR cur_get_recs1 IS
        SELECT os.*, ces.customer_ref, ces.product_code
          FROM ncotestaging os,
                   custRefSource ces
         WHERE os.ote_status = 1
           AND os.action_type = 'A'
           AND ces.ref_source = os.service_code
           FOR UPDATE OF ncotestaging.ote_status;I get the following error...
SQL> @test.sql
           FOR UPDATE OF ncotestaging.ote_status;
ERROR at line 18:
ORA-06550: line 18, column 26:
PL/SQL: ORA-00904: "NCOTESTAGING"."OTE_STATUS": invalid identifier
ORA-06550: line 12, column 9:
PL/SQL: SQL Statement ignored
ORA-06550: line 25, column 54:
PLS-00364: loop index variable 'RECOTESTAGE' use is invalid
ORA-06550: line 25, column 9:
PL/SQL: Statement ignoredI don't know why the FOR UPDATE statement reports an invalid identifier. I seem to have the syntax correct according to the PL/SQL documentation. Any pointers gratefully received.

CURSOR cur_get_recs1 IS> SELECT os.*, ces.customer_ref, ces.product_code
> FROM ncotestaging os,
> custRefSource ces
> WHERE os.ote_status = 1
> AND os.action_type = 'A'
>AND ces.ref_source = os.service_code
>FOR UPDATE OF ncotestaging.ote_status;
the problem iis u have the alias for the table 'ncotestaging' as os that's y it's throwing the error

Similar Messages

  • Strange explain plan when query SYS tables

    Oracle Version 9.2.0.7
    We have an application that runs the following query on Oracle 9.2.0.7
    SELECT T1.TABLE_NAME,T1.COLUMN_NAME, T1.SRID, T2.SDO_UB, T2.SDO_LB, T1.OWNER FROM ALL_SDO_GEOM_METADATA T1, TABLE(T1.DIMINFO) T2 WHERE T1.OWNER=UPPER(:"SYS_B_0") AND T1.TABLE_NAME=UPPER(:"SYS_B_1")
    Without the self join the query is fine, but with the self join on our customers database the explain plan is doing full table scans and Hash Joins on SYS tables and takes 2 minutes.
    Rows Row Source Operation
    2 FILTER
    2 NESTED LOOPS
    1 TABLE ACCESS FULL SDO_GEOM_METADATA_TABLE
    2 COLLECTION ITERATOR PICKLER FETCH
    1 UNION-ALL
    0 FILTER
    0 NESTED LOOPS OUTER
    0 HASH JOIN
    37 TABLE ACCESS FULL TS$
    0 HASH JOIN OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS FULL USER$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    0 FILTER
    0 NESTED LOOPS OUTER
    0 HASH JOIN
    54 TABLE ACCESS FULL USER$
    0 HASH JOIN
    29447 TABLE ACCESS FULL OBJ$
    0 HASH JOIN OUTER
    0 HASH JOIN OUTER
    0 HASH JOIN OUTER
    0 NESTED LOOPS
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS CLUSTER TS$
    0 INDEX UNIQUE SCAN I_TS# (object id 7)
    0 TABLE ACCESS CLUSTER COL$
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER COLTYPE$
    0 TABLE ACCESS FULL USER$
    0 TABLE ACCESS FULL OBJ$
    0 TABLE ACCESS FULL USER$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    1 FILTER
    1 NESTED LOOPS
    1 NESTED LOOPS OUTER
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 INDEX UNIQUE SCAN I_TYPED_VIEW1 (object id 105)
    1 INDEX UNIQUE SCAN I_VIEW1 (object id 104)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    On our development database it takes 0.07 sec with no full table scans and no hash joins.
    Rows Row Source Operation
    2 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE
    1 INDEX RANGE SCAN SDO_GEOM_IDX (object id 36753)
    1 UNION-ALL
    0 FILTER
    0 NESTED LOOPS
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS CLUSTER TS$
    0 INDEX UNIQUE SCAN I_TS# (object id 7)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    0 FILTER
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS OUTER
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    0 NESTED LOOPS
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 TABLE ACCESS CLUSTER TAB$
    1 INDEX UNIQUE SCAN I_OBJ# (object id 3)
    0 TABLE ACCESS CLUSTER TS$
    0 INDEX UNIQUE SCAN I_TS# (object id 7)
    0 TABLE ACCESS CLUSTER COL$
    0 TABLE ACCESS CLUSTER COLTYPE$
    0 TABLE ACCESS CLUSTER SEG$
    0 INDEX UNIQUE SCAN I_FILE#_BLOCK# (object id 9)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 INDEX UNIQUE SCAN I_OBJ1 (object id 36)
    0 TABLE ACCESS BY INDEX ROWID OBJ$
    0 INDEX RANGE SCAN I_OBJ3 (object id 38)
    0 TABLE ACCESS CLUSTER USER$
    0 INDEX UNIQUE SCAN I_USER# (object id 11)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    1 FILTER
    1 NESTED LOOPS
    1 NESTED LOOPS OUTER
    1 NESTED LOOPS
    1 TABLE ACCESS BY INDEX ROWID USER$
    1 INDEX UNIQUE SCAN I_USER1 (object id 44)
    1 TABLE ACCESS BY INDEX ROWID OBJ$
    1 INDEX RANGE SCAN I_OBJ2 (object id 37)
    0 INDEX UNIQUE SCAN I_TYPED_VIEW1 (object id 105)
    1 INDEX UNIQUE SCAN I_VIEW1 (object id 104)
    0 NESTED LOOPS
    0 FIXED TABLE FULL X$KZSRO
    0 INDEX RANGE SCAN I_OBJAUTH2 (object id 109)
    0 FIXED TABLE FULL X$KZSPR
    2 COLLECTION ITERATOR PICKLER FETCH
    ALL_SDO_GEOM_METADATA is a view in the MDSYS schema (generated by Oracle ).
    SELECT SDO_OWNER OWNER,
    SDO_TABLE_NAME TABLE_NAME,
    SDO_COLUMN_NAME COLUMN_NAME,
    SDO_DIMINFO DIMINFO,
    SDO_SRID SRID
    FROM SDO_GEOM_METADATA_TABLE
    WHERE
    (exists
    (select table_name from all_tables
    where table_name=sdo_table_name
    and owner = sdo_owner
    union all
    select table_name from all_object_tables
    where table_name=sdo_table_name
    and owner = sdo_owner
    union all
    select view_name table_name from all_views
    where view_name=sdo_table_name
    and owner = sdo_owner))
    Statistics have been gathered for the MDSYS user.
    If this had not been SYS schema I would have immediately concluded that fresh statistics are required. The SYS objects concerend are valid with all indexes
    From my understanding you are not meant to gather stats for the SYS schema in Oracle 9 as Data Dictionary queries still uses RBO?
    Any ideas as to why Oracle is doing full table scans when querying SYS tables? The optimizer_mode is set to FIRST_ROWS.
    Any ideas greatly recevied.
    Thanks

    Maybe I'm missing something but this:
    INDEX FULL SCAN     SISESTAT     I0_ESTRUTURA_COMERCIALindicates that one of those indexes is being used.
    This:
    T_ESTRUTURA_COMERCIALIs nowhere to be found in your Explain Plan. It appears that either you have posted the wrong plan
    or Oracle is doing a query rewrite to a materialized view.

  • Avoiding WITH clause when querying Multiple Facts

    OBIEE 10.1.3.4
    We have a report which requires that we query multiple facts, which share the same Item dimension.
    When we run the report, the BI Server generates a query using the WITH clause -
    WITH SAWITH0 ( SELECT.............)
    SAWITH1( SELECT .............)
    SELECT .........
    FROM SAWITH0 FULL OUTER JOIN SAWITH1
    The above query errors out with ORA-918 Column Ambiguously Defined. I cannot find any issue in the query that has been generated.
    The query does fail from SQL Plus with the same ORA error. But each of the select statements executed properly and the complete statement executes when I replace the FULL OUTER JOIN with INNER JOIN.
    I can only assume that this is a bug in Oracle Database.
    Now at times I have seen OBIEE generate separate queries when querying multiple facts and then combine the data together in memory.
    Is there a way that I can force OBIEE to avoid using WITH clause and run separate SELECT statements ? How does the BI Server choose between using a WITH clause or running separate queries ?
    Any help would be appreciated.

    I do not have a multi-dimensional data source.
    My connection pool seems fine to me, I am not sure I need to do anything with the connection pool.
    Hi Turribeach,
    I understand that BI Server uses WITH clause for multiple facts. But I have also seen it issue separate queries against the database.
    So what I am looking to understand under what situation does it issue separate queries i.e. No WITH clause ?
    Thanks

  • I tried for update but when i saw the screen its showing an arrow with a USB cable towards itunes icon, and now i'm not able to do anything, i also tried to connect ipad through my laptop but no use

    i tried for update but when i saw the screen its showing an arrow with a USB cable towards itunes icon, and now i'm not able to do anything, i also tried to connect ipad through my laptop but no use

    That message means that you have to restore the iPad now. There was a problem with the update. So connect the iPad to your computer and restore your iPad.
    You can read bout it here.
    http://support.apple.com/kb/ht1414
    If that does not work you will need recovery mode. You can read about it here.
    http://support.apple.com/kb/ht4097
    Or you can follow these Recovery Mode Instructions
    Disconnect the USB cable from the iPad, but leave the other end of the cable connected to your computer's USB port.
    Turn off iPad: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for iPad to turn off.
    If you cannot turn off iPad using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the iPad turns off, release the Sleep/Wake and Home buttons.
    While pressing and holding the Home button, reconnect the USB cable to iPad. When you reconnect the USB cable, iPad should power on.
    Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears you can release the Home button.
    If necessary, open iTunes. You should see the recovery mode alert that iTunes has detected an iPad in recovery mode.
    Use iTunes to restore iPad.

  • What's the best way to insert/update thousands records in multiple tables

    Can anyone give an example of how to insert/update thousands records in multiple tables on performance wise? or what should I do to improve the performance?
    Thanks
    jim

    You can see a set of sample applications in various scenarious available at
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html

  • ORA-00604 ORA-00904 When query partitioned table with partitioned indexes

    Got ORA-00604 ORA-00904 When query partitioned table with partitioned indexes in the data warehouse environment.
    Query runs fine when query the partitioned table without partitioned indexes.
    Here is the query.
    SELECT al2.vdc_name, al7.model_series_name, COUNT (DISTINCT (al1.vin)),
    al27.accessory_code
    FROM vlc.veh_vdc_accessorization_fact al1,
    vlc.vdc_dim al2,
    vlc.model_attribute_dim al7,
    vlc.ppo_list_dim al18,
    vlc.ppo_list_indiv_type_dim al23,
    vlc.accy_type_dim al27
    WHERE ( al2.vdc_id = al1.vdc_location_id
    AND al7.model_attribute_id = al1.model_attribute_id
    AND al18.mydppolist_id = al1.ppo_list_id
    AND al23.mydppolist_id = al18.mydppolist_id
    AND al23.mydaccytyp_id = al27.mydaccytyp_id
    AND ( al7.model_series_name IN ('SCION TC', 'SCION XA', 'SCION XB')
    AND al2.vdc_name IN
    ('PORT OF BALTIMORE',
    'PORT OF JACKSONVILLE - LEXUS',
    'PORT OF LONG BEACH',
    'PORT OF NEWARK',
    'PORT OF PORTLAND'
    AND al27.accessory_code IN ('42', '43', '44', '45')
    GROUP BY al2.vdc_name, al7.model_series_name, al27.accessory_code

    I would recommend that you post this at the following OTN forum:
    Database - General
    General Database Discussions
    and perhaps at:
    Oracle Warehouse Builder
    Warehouse Builder
    The Oracle OLAP forum typically does not cover general data warehousing topics.

  • HT204266 Trying to check for updates but when I hit updates I keep getting the message  cannot connect to iTunes. I'm signed in in my settings so not sure what else to do?

    I'm trying to connect to the app store to check for updates but when I go to the update tab I keep getting the message cannot connect to iTunes store. I am signed into iTunes in my settings so not sure what to do!

    You should not get that message if you are simply trying to load the shuffle with songs from your iTunes library.  If iTunes is trying to Update or Restore the shuffle, and you get that message, try the suggestions in this article
    http://support.apple.com/kb/TS1814

  • My IPad asks for updating. When I try shows me it cannot be installed be cause its requires at least 1.9 Gb available.

    My IPad asks for updating. When I try shows me it cannot be installed be cause its requires at least 1.9 Gb available.

    See the following page:
    Update the iOS software on your iPhone, iPad, and iPod touch - Apple Support
    Scroll down to the "Update your device using iTunes" section.

  • Problem with Business Component when joining multiple tables

    I have a table that contains foreign keys from 4 other tables. When I view the table in the Business Component Browser it only returns one record. But when i run the same query in toad it returns the correct number of records. I'm I missing something or is there a bug in the application module?

    Could you be more specific?
    Supply the query and tables' definitions.
    Is it right that you have created a compound view from all of the five tables?
    Base Table
    -> FK_Table1
    -> FK_Table2
    If so, check, whether the wizard correctly generated the associations info in this VO's XML file.
    Actually, you recognize this as soon as he generates the query : the where clause should show appropriate fields being connected.
    Another question is if you want to use inner or outer joins to the referencing FK tables.
    You may also be interested in seeing my earlier post:
    "BC4J; VO Wizard & References for multiple usage of one table".
    Petr
    null

  • My cursor for update doesn't work:(

    hi, i have code:
    create or replace procedure szkodowosc_STMT_WC is
         date_do    varchar2(8);
         v_data_b1              szkod_wc_blokady_Wc_07.Data_Przetw%TYPE;
         v_data_b2              szkod_wc_blokady_Wc_07.Data_Przetw%TYPE;
         v_data_b3              szkod_wc_blokady_Wc_07.Data_Przetw%TYPE;
         v_brak_blokady         szkod_wc_blokady_Wc_07.Szkodowosc_Procent%TYPE;
         v_blokada_all          szkod_wc_blokady_Wc_07.Szkodowosc_Procent%TYPE;
         v_blokada_za_miesiac   szkod_wc_blokady_Wc_07.Szkodowosc_Procent%TYPE;
         CURSOR cur_szkod_brak_blokady IS
                select data_przetw, szkodowosc_procent
                from szkod_wc_blokady_Wc_07
                where grupa_porownanie = 'brak blokady'
                order by data_przetw;
         CURSOR cur_szkod_blokada_all IS
                select data_przetw, szkodowosc_procent
                from szkod_wc_blokady_Wc_07
                where grupa_porownanie = 'blokada all'  -- blokada od pierwszego stmt
                order by data_przetw;
         CURSOR cur_szkod_blokada_za_miesiac IS
                select data_przetw, szkodowosc_procent
                from szkod_wc_blokady_Wc_07
                where grupa_porownanie = 'blokada za miesiac'    -- blokada od drugiego stmt
                order by data_przetw;
         CURSOR cur_update IS
                select data_przetw, blokada_all
                from SZKOD_WC_BLOKADY_WC_07_results
                for update of blokada_all NOWAIT;    
    begin
    -- select * from szkod_wc_blokady_Wc_07
    delete from SZKOD_WC_BLOKADY_WC_07_results;
    commit;
    -- przetwarzanie, brak blokady
    OPEN cur_szkod_brak_blokady;
       LOOP
          FETCH cur_szkod_brak_blokady INTO v_data_b1, v_brak_blokady;
          EXIT WHEN cur_szkod_brak_blokady%NOTFOUND;
          INSERT INTO SZKOD_WC_BLOKADY_WC_07_results (data_przetw, Brak_Blokady) VALUES (v_data_b1, v_brak_blokady);
       END LOOP;
       COMMIT;
       EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.PUT_LINE(SQLERRM);             -- dodac wyrzucanie logow do pliku txt
          ROLLBACK;
    CLOSE cur_szkod_brak_blokady;
    OPEN cur_szkod_blokada_all;
    OPEN cur_update;
       LOOP
          FETCH cur_szkod_blokada_all INTO v_data_b2, v_blokada_all;
          EXIT WHEN cur_szkod_blokada_all%NOTFOUND;
          FOR rec IN cur_update
          LOOP
              IF rec.data_przetw = v_data_b2
              THEN
                  UPDATE SZKOD_WC_BLOKADY_WC_07_results
                  SET blokada_all = v_blokada_all
                  WHERE CURRENT OF cur_update;
              END IF;   
          END LOOP;     
          COMMIT;
       END LOOP;
    CLOSE cur_update;
    CLOSE cur_szkod_blokada_all;
    -- select * from SZKOD_WC_BLOKADY_WC_07_results
    end;my cur_update should update column blokada_all in SZKOD_WC_BLOKADY_WC_07_results table, but i have still NULLs here, why?
    my table after update looks like:
    DATA_PRZETW     BRAK_BLOKADY     BLOKADA_ALL     BLOKADA_ZA_MIESIAC
    2009-08-14     0,362          
    2009-08-21     0,406          
    2009-08-28     0,462          
    2009-09-04     0,509          
    2009-09-11     0,573          
    2009-09-18     0,608          
    2009-09-25     0,645          
    2009-10-02     0,68          
    2009-10-09     0,763          
    2009-10-16     0,852          
    2009-10-23     0,935          
    2009-10-30     1,059          
    2009-11-06     1,148          
    2009-11-13     1,343          
    2009-11-20     1,442          
    2009-11-27     1,554          
    2009-12-04     1,583          
    2009-12-11     1,707          
    2009-12-18     1,807          
    2009-12-25     1,878          
    2010-01-01     1,955          
    2010-01-08     2,086          
    2010-01-15     2,136          
    2010-01-22     2,361          
    2010-01-29     2,469          
    2010-02-05     2,549

    looking at your code (it's quite hard to follow with these table name - probably because I don't understand them), your procedure might look like
    create or replace procedure szkodowosc_STMT_WC is
    begin
       INSERT INTO SZKOD_WC_BLOKADY_WC_07_results
       select data_przetw, szkodowosc_procent
                from szkod_wc_blokady_Wc_07
                where grupa_porownanie = 'brak blokady'
                order by data_przetw;
        UPDATE SZKOD_WC_BLOKADY_WC_07_results r
                  SET blokada_all = (select szkodowosc_procent
                from szkod_wc_blokady_Wc_07 b
                where grupa_porownanie = 'blokada all'
                and b.data_przetw = r.data_przetw
    end;But it probably can be condensed even further by removing the UPDATE, hope you get the gist. :)

  • Cursor for update get stuck while running the program

    Dear
    i am using below mention program but work and get stuck. please any idea how can reslove this.
    declare
    l_segment1 VARCHAR (100);
    CURSOR req_number_cur
    IS
    SELECT TO_CHAR (current_max_unique_identifier + 1)
    FROM po_unique_identifier_control
    WHERE table_name = 'PO_REQUISITION_HEADERS'
    FOR UPDATE OF current_max_unique_identifier;
    BEGIN
    fnd_client_info.set_org_context (101);
    mo_global.set_policy_context ('S', 101);
    dbms_output.put_line('testing');
    begin
    OPEN req_number_cur;
    FETCH req_number_cur
    INTO l_segment1;
    IF req_number_cur%NOTFOUND
    THEN
    --do something
    NULL;
    --insert statement
    UPDATE po_unique_identifier_control
    SET current_max_unique_identifier = current_max_unique_identifier + 1
    WHERE CURRENT OF req_number_cur;
    END IF;
    CLOSE req_number_cur;
    end;
    END;
    ---thanks
    appreciate you help.

    Do you realise that this is a flawed approach?
    Performance in a multi-user and multi-process database system is about the ability to do things simultaneously.
    Simple analogy. You have a McDonalds. You have a 100 customers wanting to be serviced. What will be better? Having the customer all queuing in a single long queue to be serviced by a single cashier?
    Or 10 cashiers, 10 queues, and the ability to service 10 customers at the same time?
    It should be very obvious that the ability to service 10 customers at the same time is a lot better than only servicing a single customer at a time.
    Likewise, Oracle can service 1000's of different sessions all inserting data.
    Now you want to create a single queue for all insert transactions - and give each one a unique and sequential identifier. This will literally kill performance. It will turn a 32 CPU server into a 1 CPU desktop as all that extra CPU power can never be used as all the sessions need to get into a single queue and be serviced one at a time.
    Also consider the functionality of your approach. Session 1 gets a 5 unique identifiers as it wants to insert 5 rows. Session 2 gets the next 3 sequence numbers. Session 1 aborts and rolls back its transaction (numerous practical reasons exist for why this can and do happen).
    What is the status now in the database table? 5 numbers are now "missing".
    So despite your severely flawed attempt to enforce serialisation and sequential numbering, it will fail. So why then even contemplate turning the Oracle database from being able to service multiple concurrent sessions at the same time, to a slow single-user/single-process database that can only service a single request at a time?
    The CORRECT approach in Oracle is to use a sequence generator (see the CREATE SEQUENCE command in the <i>SQL Reference Guide</i>). Use it. Do not try a flawed approach that WILL fail and that WILL have a very severe performance impact.

  • Error when querying a table through the Query Window

    I am running a query on the following table in the ODT Query window - for some reason I get the error below when trying to retrieve the data - I can query the table just fine through SQL Plus - it errors out whether I use grid or text window
    ERROR
    Arithmetic operation resulted in an overflow.
    CREATE TABLE "RF3_PROD_1"."F_EXTRACTMETRICS" ("EXTRACT_NAME" VARCHAR2(50) NOT NULL,"RUN_START_DATE" DATE NOT NULL,"RUN_END_DATE" DATE NOT NULL,"DURATION" NUMBER DEFAULT 0 NOT NULL,"EXTRACT_START_DATE" DATE NULL,"EXTRACT_END_DATE" DATE NULL,"NUM_RECS_ADDED" NUMBER DEFAULT 0 NOT NULL,"NUM_RECS_DELETED" NUMBER DEFAULT 0 NOT NULL,"STATUS" VARCHAR2(50) NOT NULL,"COMMENTS" VARCHAR2(500) NULL) TABLESPACE "EXTRACT_TAB_01_TS" PCTFREE 15 PCTUSED 75 INITRANS 1 MAXTRANS 255 STORAGE ( FREELISTS 1 FREELIST GROUPS 1 INITIAL 8388608 NEXT 516096 MAXEXTENTS 2147483645 MINEXTENTS 1 PCTINCREASE 0 )
    I would have formatted it nicer - but that is the way that ODT created it :)

    Christian,
    I found that this happens when trying to query number fields that are reals with a large decimal value (26 decimal values and above seem to be the magic number). What is strange is that I don't get this problem when I retrieve data from the same table using the Retrieve data option (versus a query for all the data in the Query Window) so they don't seem to be utilizing the same basic code to grab and then display the data interestingly enough (I am sure you knew that). Does this allow you to replicate the issue?
    Thanks,
    Bryan

  • BAPI for updation of  Profit center in table VBRP

    Hello Friends,
    I have to Update the Field 'PRCTR' in the table VBRP. Is there some BAPI available for updating VBRP .
    I tried FM 'RV_INVOICE_ITEM_MAINTAIN'.
            FM RV_INVOICE_DOCUMENT_UPDATE
    But fields are  not getting updated
    Could you please help me, It is  urgent.
    Thanks & Regards,
    Anju N

    RV_INVOICE_DOCUMENT_UPDATE is used to buffer header updates, i don't think you need this. what you most likely need is RV_INVOICE_DOCUMENT_ADD to process the buffered item updates. but its highly recommended to have complete sequence 1. RV_INVOICE_REFRESH 2. RV_INVOICE_DOCUMENT_READ 3. series of RV_INVOICE_ITEM_MAINTAIN, if multiple line update 4.  RV_INVOICE_DOCUMENT_ADD

  • T-SQL - Using Column Name in where condition without any references when having multiple tables that are engaged using multiple joins.

    Hi All,
    I am a newbie for T-Sql, I came across a SP where multiple tables are engaged using multiple joins but the where clause contain  a column field without any table reference  and assigned  for an incoming variable,like 
    where 'UserId = @UserId'
    instead -  no table reference like 'a.UserId = @Userid'   ............ Can any please do refer to me any material that clears my mind regarding such issue................... help is appreciated.
    Thank You.

    As suggested above, use table alias with columns for unique referencing and to make the code easier to read.
    BOL example for table aliasing:
    USE AdventureWorks;
    GO
    SELECT S.CustomerID, S.Name AS Store, A.City, SP.Name AS State, CR.Name
    AS CountryRegion
    FROM Sales.Store AS S
    JOIN Sales.CustomerAddress AS CA ON CA.CustomerID = S.CustomerID
    JOIN Person.Address AS A ON A.AddressID = CA.AddressID
    JOIN Person.StateProvince SP ON
    SP.StateProvinceID = A.StateProvinceID
    JOIN Person.CountryRegion CR ON
    CR.CountryRegionCode = SP.CountryRegionCode
    ORDER BY S.CustomerID ;
    GO
    GO
    LINK:
    http://technet.microsoft.com/en-us/library/ms124824(v=sql.100).aspx
    Check the use of TABLE ALIASes and COLUMN ALIASes in the following blog:
    http://www.sqlusa.com/bestpractices2005/organizationtree/
    Without the use of aliases the code would become unreadable.
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Access for update only one column in table?

    Hi all,
    My need is to grant access for update only one column c1 in table t1.
    I guess I should use view, could you please give me some example? Maybe other ideas?

    Hi,
    You can grant privileges on individual columns.
    GRANT   UPDATE (c1)
    ON      t1
    TO      grantee_name;Look up GRANT in the SQL language manual. Annoyingly, in recent editions of the manual, GRANT is not indexed, but it's in alphabetic order with all the other statements:
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9013.htm#i2155015

Maybe you are looking for

  • Message when Invoice vendor is different from PO vendor

    Hi, Last week, in MIRO, when i would like to change the vendor (taken from the order), a system message appears to let me know that this vendor was different from the PO vendor. But it was just a warning message and i changed it to an Error message.

  • IPad IOS6 problems?

    iPad wifi problems with IOS6

  • GPS Conversion ETSI LIP

    I am writing a program where I am receiving an ETSI LIP string and need to convert it to decimal. I currently don't understand how it is converted. I receive the following in HEX, which coverted to binary for ease, but can't figure out the conversion

  • Airport Extreme Dual-Band Base Station Is excessively slow

    Let me start off by stating this is my first apple support discussion and I have no experience in these forums but rather forums elsewhere. My Airport Extreme Dual-Band Base Station is completely updated as of DEC. 30, 2012 running version 7.6.1 and

  • Recover database with datafile and logfile

    Hi Export, we have one maxdb database. For some reasons, we have no backup and lost the programs binaries. Is it possble to recover the database with datafile and logfile? and how? thanks a lot. Rongfeng