Update of the declaration

Hi all

The query below
CURSOR for_update
        IS
                SELECT uarchst_cust_code, uarchst_prem_code,uarchst_deletion_cost
                FROM   UIMSMGR.UARCHST, UIMSMGR.UABSCON
                WHERE uarchst_scon_number = uabscon_number
                   AND  (uarchst_scon_number, uarchst_activity_date) IN
                         (SELECT   b.uarchst_scon_number, MAX (b.uarchst_activity_date)
                          FROM UIMSMGR.UARCHST b
                          WHERE b.uarchst_action_code NOT IN ('CANCNOW', 'CANCEND', 'REN', 'EXTEND')
                          GROUP BY b.uarchst_scon_number)
                   AND uarchst_deletion_cost != 0
                   AND uabscon.uabscon_status_ind = 'C'
                   AND uabscon.uabscon_end_date < '08-JAN-2009';
There will be 1,83,879 records in this slider after selection. So it also takes a lot of time for the UPDATE query.

Query update below:
FOR i in for_update
                LOOP
                UPDATE UIMSMGR.UABLETQ
                SET   uabletq_deletion_cost = i.uarchst_deletion_cost
                WHERE uabletq_cust_code=i.uarchst_cust_code
                AND   uabletq_prem_code=i.uarchst_prem_code
                AND   uabletq_activity_date = (SELECT max(uabletq_activity_date)   /****To select Cancellation quote ***/
                                               FROM UIMSMGR.UABLETQ
                                               WHERE uabletq_cust_code = i.uarchst_cust_code
                                               AND uabletq_prem_code   = i.uarchst_prem_code
                                               AND uabletq_user_id NOT IN('UBPWBAK2','UBPWBAK2_MIG'));
The query of update above he will have more time to update records based on the output of the cursor. Can rewrite us the update without the slightest impact statement in the existing features?

Rewrite in the form a single update statement instead of using a loop with many updates.

The use of loops is row by row (slow by slow) treatment while a single update statement will defintely improve performance.

Tags: Database

Similar Questions

  • Update of the declaration - which escapes me?

    Hi all

    I have the following select statement
    (select l.li_id, o.pwsql_value_2, q.sub_minor
     from dvnrpt.QBYTE_PROJECT_CODING_STAGING q
            , outgoing_xref_values o
            , line_items_supplement l
    where q.PO_NUMBER = o.DEST_VALUE_1
           and q.PO_LINE_NUMBER = o.DEST_VALUE_2     
           and l2.LI_ID = q.LI_ID  
           and q.UPDATE_TYPE = 'UPDATE') 
    It returns 34 records, with unique l.li_id

    I want to update these 34 records in the line_items_supplement table. I am trying this:
    update line_items_supplement l2  
    set (l2.alternate_gl_code, l2.env_code) = (select o.pwsql_value_2, q.sub_minor
                                           from  QBYTE_PROJECT_CODING_STAGING q
                                               , outgoing_xref_values o
                                           where q.PO_NUMBER = o.DEST_VALUE_1
                                                 and q.PO_LINE_NUMBER = o.DEST_VALUE_2     
                                                 and l2.LI_ID = q.LI_ID  
                                                 and q.UPDATE_TYPE = 'UPDATE') 
    It is rather the 34 files updated, it is saying all the lines (232 000) have been updated.

    As far as I can tell the lines expected 34 actually updated with the correct o.pwsql_value_2, q.sub_minor. However, we have a trigger of last_updated_date on the table - for the rest of the lines that the field last_updated_date is getting updated with the date of the update took place - that seems to be the only field updated. Obviously I don't want this.

    Someone at - it ideas? I probably need some kind of place where clause outside the set statement. I got it works, but it's not very pretty.
    update pwsql.line_items_supplement l2  
    set (l2.alternate_gl_code, l2.env_code) = (select o.pwsql_value_2, q.sub_minor
                                           from QBYTE_PROJECT_CODING_STAGING q
                                              , outgoing_xref_values o
                                           where q.PO_NUMBER = o.DEST_VALUE_1
                                                and q.PO_LINE_NUMBER = o.DEST_VALUE_2     
                                                and l2.LI_ID = q.LI_ID  
                                               and q.UPDATE_TYPE = 'UPDATE') 
    where l2.li_id = (select q.li_id
                   from QBYTE_PROJECT_CODING_STAGING q
                       , outgoing_xref_values o
                   where q.PO_NUMBER = o.DEST_VALUE_1
                       and q.PO_LINE_NUMBER = o.DEST_VALUE_2     
                       and l2.LI_ID = q.LI_ID  
                       and q.UPDATE_TYPE = 'UPDATE')      
    Thank you.

    Published by: dgouin on June 23, 2010 09:49

    Published by: dgouin on June 23, 2010 09:50

    Try this:

    Update .line_items_supplement l2
    package (l2.alternate_gl_code, l2.env_code) = (select o.pwsql_value_2, q.sub_minor
    of QBYTE_PROJECT_CODING_STAGING q
    outgoing_xref_values o
    where q.PO_NUMBER = o.DEST_VALUE_1
    and q.PO_LINE_NUMBER = o.DEST_VALUE_2
    and l2. LI_ID = q.LI_ID
    and q.UPDATE_TYPE = 'UPDATE')
    where exists (select 'x' from dvnrpt. QBYTE_PROJECT_CODING_STAGING q
    outgoing_xref_values o
    where q.PO_NUMBER = o.DEST_VALUE_1
    and q.PO_LINE_NUMBER = o.DEST_VALUE_2
    and l2. LI_ID = q.LI_ID
    and q.UPDATE_TYPE = 'UPDATE')

  • update of the declaration... problem

    + 1 select id, substr (name, 1, 10), deptid, dept, join_date +.
    + 2 * student +.
    SQL > /.

    ID NAME DEPTID DEPT JOIN_DATE
    ---------- ---------- ----------    ----------      ----------
    A101 abc 23 20 October 09
    A102 ijk 5 20 October 09
    A103 diaby 3 20 October 09
    A104 werr 5 20 October 09
    A105 asd
    A106 LEMAITRE 4
    A107 mno 4


    SQL > select * from the Department;

    DEPTID DEPTNAME
    ---------- --------------------
    + 1 mines +.
    + 2 systems.
    + excavation 3 +.
    + 4 civil +.
    + mechanical 5 +.
    + CIVIL 6 +.
    + DFG 23 +.


    I want to update the dept on student... table column using a query... all lines are updated according to where deptid (average student.deptid = department.deptid)... * with using the merge or procedure statement *...

    Like this?

    update student s
                   set s.dept =
                     (select deptname
                              from department
                             where deptid=s.deptid)
    

    But, why do you do this? You have not PK, FK relationships with your students the departments table?

    Arun-

  • BLOCK and BEFORE the DECLARATION of triggers UPDATES

    Hello

    In 10g, where I'm doing an update block:

    for example

    FORALL i IN the FIRST departments... FIU LAST
    UPDATE emp SET sal = sal * 1.10 WHERE deptno = depts (i);


    If I have a FRONT STATEMENT trigger on emp, he should fire for each row updated? I think it is and I know not to do.

    Thank you

    Kevin

    Hey Kevin,

    The front trigger statement should shoot, you run update statements, you do not run 1 UPDATE statement.
    If this UPDATE statement also has one for each row trigger, this trigger fires several times because there are lines updated.
    The question is however you have the UPDATE instructions, a statement for each pass of the loop.
    Your hope is so incorrect.

    HTH

    --
    Sybrand Bakker
    Senior Oracle DBA

  • Last update makes the material useless?

    Fortunately I was with my Thinkpad T60 last night when the final update notification skipped upward. There were some updates available (the usual kind) so I let it install and went about my business. After you install the updates, a reboot was required, so I let the laptop restarts.

    To my surprise and shock, the keyboard and pointer are now unusable. According to Device Manager, the devices are error code 37 - "Windows cannot initialize the device drivers.

    The pilots have no 'dismantling' and have always worked very well until this update, and now Microsoft does not support the operating system.

    Microsoft had the intention to make the unusable material in the hope of forcing hardware upgrades to the equipment running Windows 8? It's like manufacturers cars turning off the engines in their older cars to force people to buy new ones.

    Unacceptable.

    http://i159.Photobucket.com/albums/T135/got2bjoester/DSCF2025.jpg - screenshot of my Device Manager showing the issue

    Microsoft Tech was "Bruno" and I contacted Microsoft Chat due to the error immediately after installation of Windows Update...

    Now - this start...

    I booted up the laptop, and of course, pointer and keyboard do not work. Tried several keyboards USB, NO WORK. Each of them indicate that the driver cannot be initialized, and these were borrowed from running systems.

    Then I see this unfamiliar popup informing me that there is some important updates of windows available... at like 16:15 Eastern... 09/04/2014 on my XP based machine.

    Synaptics update via windows update. Installation and restart required.

    Restarted and I'm back in business. I'm quite certain that Microsoft had to receive a lot of complaints of "dead" computer for them to release another update after the "end of support" declared.

    At least they fixed, and I hope that all of you who have experienced the same is back running.

    Joe

    Oh, and Lenovo offers only the drivers for the trackpoint. I was about to give a go when the popup appeared.

  • How update us the odometer readings

    Hi gurus,

    One of my requirement is to update the last reading of the odometer of an asset by using the Eam_MeterReading_PUB.create_meter_reading API when it is run, it does not update. The new meter reading ID is null and I see that the meter reading is not updated in the definition of the meter or the information on the last Service (EAM) windows

    The example script is the following:

    DECLARE

    v_return_status VARCHAR2 (40);

    v_msg_count NUMBER;

    v_msg_data VARCHAR2 (4000);

    v_reset_value NUMBER: = NULL;

    v_new_meter_reading_id NUMBER: = NULL;

    v_meter_reading_rec Eam_MeterReading_PUB.meter_reading_Rec_Type;

    BEGIN

    fnd_global.apps_initialize (user_id = > theuseridresp_id = > respidresp_appl_id = > respapplnid);

    V_METER_READING_REC. METER_ID: = 412408; -derived eam_asset_meters_v for active TR402

    V_METER_READING_REC. CURRENT_READING: = 1378; -odometer reading random - current reading in the definition of the metre is 722

    "v_meter_reading_rec.current_reading_date: = March 3, 2014;

    NULL;

    () EAM_MeterReading_PUB.create_meter_reading

    p_api_version = > 1.0,

    p_init_msg_list = > FND_API. G_FALSE,

    p_commit = > FND_API. G_FALSE,

    x_msg_count = > v_msg_count,

    x_msg_data = > v_msg_data,

    x_return_status = > v_return_status,

    p_meter_reading_rec = > v_meter_reading_rec,

    p_value_before_reset = > v_reset_value,

    x_meter_reading_id = > v_new_meter_reading_id

    );

    dbms_output.put_line ('New ID: ' | v_new_meter_reading_id);

    -IF v_return_status <>fnd_api.g_ret_sts_success THEN

    dbms_output.put_line (v_msg_count |) » '|| v_return_status | » '|| ( SQLERRM) ;

    dbms_output.put_line ('API Err: ' | v_msg_data);

    -END IF;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    dbms_output.put_line ('Err: ' |) SQLERRM);

    END;

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

    The output:

    New ID:

    ORA-0000 S: normal end successfully

    Error API:

    The approach is good. No need to spend the reset_flag, unless it is necessary to reset odometer on a value less than the current reading in the system. A reason should be made available. Reset_flag is a field in the meter_reading_rec of the var, which is an Eam_MeterReading_PUB.meter_reading_Rec_Type. Please see SR 3-10403510631

    Thank you

  • date of update of the article page field

    Hi all

    I'm trying to update a date field in a table. It looks like something that should be very simple, but apparently it does not work for me.

    It's trying to do: go look for a date on a DATE element (by using the date picker), add 30 days to that date and then update a date_field on my_table with the new date.

    I tried a lot of different things, but I keep getting a NULL value or an error during the processing of the page.

    Things I've tried:

    declare

    date date1: =: P2_MYDATE + 30;

    Start

    -Update my_table set date_field = date1 where ROW_ID =: P2_ROW_ID;

    -Update my_table set date_field = to_date(date1,'dd-mm-yy') where ROW_ID =: P2_ROW_ID;

    -Update my_table set date_field = to_date (to_char(date1,'dd-mm-yy'), 'dd-mm-yy') where ROW_ID =: P2_ROW_ID;

    None of the above works so obviously I must be missing something

    Any help is appreciated.

    I guess the question is at the entrance that you pass. To debug you can change your code as shown below. In the code below, I assumed the P2_ROW_ID input is an INTEGER data type. If his thing then please change the declaration of the variable input_rowid as a result.

    declare
      input_date    date;
      input_rowid   integer;
      invalid_input exception;
      error_message varchar2(4000);
    begin
      input_date  := :P2_MYDATE;
      input_rowid := :P2_ROW_ID;
      if input_date is null or input_rowid is null then
         raise invalid_input;
      else
         update my_table
            set date_field = input_date + 30
          where row_id = input_rowid;
      end if
    exception
      when invalid_input then
        error_message := 'User input is invalid' || chr(10);
        if input_date is null then
           error_message := error_message || 'P2_MYDATE is NULL' || chr(10);
        end if;
        if input_rowid is null then
           error_message := error_message || 'P2_ROW_ID is NULL' || chr(10);
        end if;
        raise_application_error(-20001, error_message);
    end;
    /
    
  • update of the input xml without using the table

    Hello

    I am new to oracle xml I entered below.this came from front end.

    < employees >

    < employee >

    < > 7369 empno < / empno >

    < ename > SMITH < / ename >

    < deptno > 20 < / deptno >

    < sal > 1000 < / sal >

    < job > CLERK < / job >

    < / employee >

    < employee >

    < > 7499 empno < / empno >

    < ename > ALLEN < / ename >

    < deptno > 30 < / deptno >

    < sal > 1000 < / sal >

    < job > SELLER < / job >

    < / employee >

    < employee >

    < > 7521 empno < / empno >

    < ename > WARD < / ename >

    < deptno > 30 < / deptno >

    < sal > 1000 < / sal >

    < job > SELLER < / job >

    < / employee >

    < employee >

    < > 7566 empno < / empno >

    < ename > JONES < / ename >

    < deptno > 20 < / deptno >

    < sal > 1000 < / sal >

    < job > MANAGER < / job >

    < / employee >

    < employee >

    < > 7654 empno < / empno >

    < ename > MARTIN < / ename >

    < deptno > 30 < / deptno >

    < sal > 1000 < / sal >

    < job > SELLER < / job >

    < / employee >

    < employee >

    < > 7698 empno < / empno >

    < ename > BLAKE < / ename >

    < deptno > 30 < / deptno >

    < sal > 1000 < / sal >

    < job > MANAGER < / job >

    < / employee >

    < employee >

    < > 7782 empno < / empno >

    < ename > CLARK < / ename >

    < deptno > 10 < / deptno >

    < sal > 1000 < / sal >

    < job > MANAGER < / job >

    < / employee >

    < employee >

    < > 7788 empno < / empno >

    < ename > SCOTT < / ename >

    < deptno > 20 < / deptno >

    < sal > 1000 < / sal >

    < job > ANALYST < / job >

    < / employee >

    < employee >

    < > 7839 empno < / empno >

    < ename > KING < / ename >

    < deptno > 10 < / deptno >

    < sal > 1000 < / sal >

    < job > PRESIDENT < / job >

    < / employee >

    < employee >

    < > 7844 empno < / empno >

    < ename > TURNER < / ename >

    < deptno > 30 < / deptno >

    < sal > 1000 < / sal >

    < job > SELLER < / job >

    < / employee >

    < employee >

    < > 7876 empno < / empno >

    < ename > ADAMS < / ename >

    < deptno > 20 < / deptno >

    < sal > 1000 < / sal >

    < job > CLERK < / job >

    < / employee >

    < employee >

    < > 7900 empno < / empno >

    < ename > JAMES < / ename >

    < deptno > 30 < / deptno >

    < sal > 1000 < / sal >

    < job > CLERK < / job >

    < / employee >

    < employee >

    < > 7902 empno < / empno >

    < ename > FORD < / ename >

    < deptno > 20 < / deptno >

    < sal > 1000 < / sal >

    < job > ANALYST < / job >

    < / employee >

    < employee >

    < > 7934 empno < / empno >

    < ename > MILLER < / ename >

    < deptno > 10 < / deptno >

    < sal > 1000 < / sal >

    < job > CLERK < / job >

    < / employee >

    < / employees >

    In I want to update only the sal smith to 999. is it possible in sql and plsql.

    Note:-l' entry above is from front end only no table.

    Please help in this.

    Thank you

    SQL > DECLARE

    2

    3 xmldoc xmltype: = xmltype)

    4'

    5

    6 7369

    7 SMITH

    8        20

    9 1000

    10 REGISTRAR

    11

    12

    13 7499

    14 ALLEN

    15        30

    16 1000

    17 SELLER

    18

    19 ');

    20

    BEGIN 21

    22

    23 select xmlquery)

    24 ' copy $d: =.

    25 edit)

    26 replace the value of the node $d/employees/employee [empno = $empno] / sal

    27 with $new_sal

    28              )

    29 return $from

    30 passage xmldoc

    31, 7369 as 'empno '.

    32, 999 as 'new_sal '.

    33 contents of return

    34           )

    35 in xmldoc

    36 double;

    37

    38 dbms_output.put_line(xmldoc.extract('/').getclobval);

    39

    END 40;

    41.

    7369

    SMITH

    20

    999

    CLERK

    7499

    ALLEN

    30

    1000

    SELLER

    PL/SQL procedure successfully completed

  • Shuttle - update of the agenda

    Hey all,.
    I have a shuttle with the following query:
    select ATT_NAME display_value, ATT_ID return_value 
    from ATTRIBUTES
    where comp_p='Y'
    order by 1
    and the rest of the update process:
    declare
        tab apex_application_global.vc_arr2;
    begin
        
        tab := apex_util.string_to_table (:P310_X);
        for i in 1..tab.count loop
        
        update Attributes
        set 
        
        ATT_ID = tab(i),
        comp_position=i
        where comp_p='Y';
        end loop;
        end;
    I want only to achieve savings in the order of all the attributes with comp_p = 'Y'. I get no error sql or something.
    But the process does not work. In the database, it is not all the values update...
    Any ideas?

    Create a hidden page element: p310_message and edit your PL/SQL block update for:

    DECLARE
       tab   apex_application_global.vc_arr2;
    BEGIN
       tab := apex_util.string_to_table (:p310_x);
       :p310_message := :p310;
       :p310_message := :p310_message || ' / ' || tab.COUNT;
    
       FOR i IN 1 .. tab.COUNT
       LOOP
          UPDATE ATTRIBUTES
             SET comp_position = i
           WHERE att_id = tab (i);
       END LOOP;
    END;
    

    Put the string

    & P310_MESSAGE.

    in the process success Message and see what you get. Make sure that the branching has the option 'include the success of process message' the checked value.

    Your original PL/SQL block is not supposed. You are in loop x times and defining each

        ATT_ID = tab(i)
    

    and

        comp_position=i
    

    for all the comp_p where

        comp_p='Y'
    

    !?

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Update of the collection based on (wwv_flow.g_f01) report

    Hi all
    I have a page in my application that contains 3 standard reports based in a collection. There is a main report and from there you explore the other report, and from there you can go down to another (3rd report) that I'm trying to update a member of the collection based on an lov. I don't know how to insert the value from the lov in the 3rd report.


    Select seq_id
    IN CURR_SEQ_ID
    of apex_collections
    where collection_name = "ARGYLL_INVOICES."
    and c001 | C002 =: P12_EPSB_JE_HEAD_LINE_NUM;

    apex_collection.update_member_attribute (p_collection_name = > 'ARGYLL_INVOICES',)
    p_seq = > CURR_SEQ_ID p_attr_number = > 17, p_attr_value = > "EDMO");

    It works fine, but of course, it is hard coded. I would use the api wwv_flow.g_f01 but I can't make it work with my rudimentary understanding of this api call.

    apex_collection.update_member_attribute (p_collection_name = > 'ARGYLL_INVOICES',)
    p_seq = > CURR_SEQ_ID p_attr_number = > 17, p_attr_value = > wwv_flow.g_f01 (a few references here);


    Any guidance would be most appreciated.

    Thank you

    Here is an excerpt from a quick tutorial on the use of collections. I'm including the section of the report you can see the corresponding values:

    SELECT rownum, apex_item.hidden(1, c001),  --Key ID
         apex_item.text(2, c002, 8, 8) VALUE1,
         apex_item.text(3, c003, 3, 3) VALUE2,
         apex_item.text(4, c004, 8, 8) VALUE3,
         apex_item.date_popup(5, null,c005,'MMDDYYYY',10,10) MY_DATE
    FROM APEX_COLLECTIONS
    WHERE COLLECTION_NAME = 'MY_COLLECTION'
    

    It will be a report as a SQL report - you are just pulling the data from the collection. You can always ask the nice formatting, naming, sorting, etc. of a standard report. In the report, the user will have 3 values 'text' and a Date with the date picker. You can change the format, make sure just to change all four procedures.

    What is critical to note here are the numbers that come just before the column names. These numbers become identifier in the table used to capture data. What is APEX is creates an array of up to 50 items designated as F01 - F50. The F is static, but the number that follows, it matches the number on your tax report above, IE, F01 will contain the primary key value, F02 will contain the first numeric value, etc.. Although not strictly necessary, it is advisable to assign these values so you don't have to guess.

    A note more: I try to align c00x values in the column with the values of F0X collection in the table to stand straight, but they are values that do NOT have to match. If you have a request that you think could get developed, you can leave gaps where you want. Remember, however, that you have only 50 columns of table to use for the data entry. It is the limit of F0X table even if a collection can have up to 1000 values.

    Now, you need a way to capture the user input. I like to create this as a PRELIMINARY procedure CALCULATIONS/VALIDATIONS in this way the user can see what they changed (even if it is false). Use Validations to intercept errors.

    declare
      j pls_integer := 0;
    begin
    for j1 in (
      select seq_id from apex_collections
      where collection_name = 'MY_COLLECTION'
      order by seq_id) loop
      j := j+1;
      --VAL1 (number)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>2,p_attr_value=>wwv_flow.g_f02(j));
      --VAL2 (number)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>3,p_attr_value=>wwv_flow.g_f03(j));
      --VAL3 (text)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>4,p_attr_value=>wwv_flow.g_f04(j));
      --VAL4 (Date)
      apex_collection.update_member_attribute (p_collection_name=> 'MY_COLLECTION',
          p_seq=> j1.seq_id,p_attr_number =>5,p_attr_value=>wwv_flow.g_f05(j));
    end loop;
    end;
    

    Clear as mud? Walk slowly through it. The syntax tells APEX Collection (p_collection_name) (p_seq) line, then what attribute/column (p_attr_number) updated with the value (wwv_flow.g_f0X (j)). The number of the attribute is the column number of the collection without the 'c' on the front (IE c004 in the collection = attribute 4).

    See if this helps answer the question. You'll notice that I'm grabbing values SEQ_ID of the collection and a loop through them one at a time and using them to find the index of the JavaScript array holding the corresponding value, I need to use in the update part.

  • Problem with instructions to update within the if statement

    Hello

    I have the following PL/SQL script. It was written in a way so it can be run several times, without worrying about if she has previously run means that it should only perform the update and edit, if it has not already been done.

    DECLARE
    CNT NUMBER;

    BEGIN
    -Rename column
    COUNT (*) of SELECT INTO cnt FROM user_tab_columns WHERE TABLE_NAME = 'WELL_TEST_DATA_QUERIES' AND COLUMN_NAME = 'PRIMARY ';

    IF (cnt = 1)
    THEN
    UPDATE WELL_TEST_DATA_QUERIES
    THE PRIMARY VALUE = 0
    WHERE PRIMARY = 1;

    RUN IMMEDIATELY 'ALTER TABLE WELL_TEST_DATA_QUERIES RENAME COLUMN PRIMARY TO WELL_TEST_TYPE;


    END IF;
    END;

    However, when it is executed several times, it seems to execute the body of the if statement each time, despite the fact that the select statement must return a count of 0 (and I checked that this is the case).

    If I change the script and put the UPDATE statement in an EXECUTE IMMEDIATE, it works fine:

    DECLARE
    CNT NUMBER;

    BEGIN
    -Rename column
    COUNT (*) of SELECT INTO cnt FROM user_tab_columns WHERE TABLE_NAME = 'WELL_TEST_DATA_QUERIES' AND COLUMN_NAME = 'PRIMARY ';

    IF (cnt = 1)
    THEN
    IMMEDIATE EXECUTION
    ' UPDATE WELL_TEST_DATA_QUERIES
    THE PRIMARY VALUE = 0
    WHERE PRIMARY = 1';

    RUN IMMEDIATELY 'ALTER TABLE WELL_TEST_DATA_QUERIES RENAME COLUMN PRIMARY TO WELL_TEST_TYPE;


    END IF;
    END;

    Can someone give me an indication of what is happening here?

    Thank you
    Kathryn

    user10855910 wrote:
    Hello

    I have the following PL/SQL script. It was written in a way so it can be run several times, without worrying about if she has previously run means that it should only perform the update and edit, if it has not already been done.

    Are you referring to getting this:

    SQL> create table well_test_data_queries (primary number);
    
    Table created.
    
    SQL> insert into well_test_data_queries values (1);
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  DECLARE
      2    cnt NUMBER;
      3  BEGIN
      4    -- Rename column
      5    SELECT COUNT(*) INTO cnt FROM user_tab_columns WHERE TABLE_NAME = 'WELL_TEST_DATA_QUERIES' AND COLUMN_NAME = 'PRIMARY';
      6    IF cnt = 1 THEN
      7      UPDATE WELL_TEST_DATA_QUERIES
      8      SET PRIMARY = 0
      9      WHERE PRIMARY = 1;
     10      EXECUTE IMMEDIATE 'ALTER TABLE WELL_TEST_DATA_QUERIES RENAME COLUMN PRIMARY TO WELL_TEST_TYPE';
     11    END IF;
     12* END;
    SQL> /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from well_test_data_queries;
    
    WELL_TEST_TYPE
    --------------
                 0
    
    SQL> DECLARE
      2    cnt NUMBER;
      3  BEGIN
      4    -- Rename column
      5    SELECT COUNT(*) INTO cnt FROM user_tab_columns WHERE TABLE_NAME = 'WELL_TEST_DATA_QUERIES' AND COLUMN_NAME = 'PRIMARY';
      6    IF cnt = 1 THEN
      7      UPDATE WELL_TEST_DATA_QUERIES
      8      SET PRIMARY = 0
      9      WHERE PRIMARY = 1;
     10      EXECUTE IMMEDIATE 'ALTER TABLE WELL_TEST_DATA_QUERIES RENAME COLUMN PRIMARY TO WELL_TEST_TYPE';
     11    END IF;
     12  END;
     13  /
        WHERE PRIMARY = 1;
              *
    ERROR at line 9:
    ORA-06550: line 9, column 11:
    PL/SQL: ORA-00904: "PRIMARY": invalid identifier
    ORA-06550: line 7, column 5:
    PL/SQL: SQL Statement ignored
    
    SQL>
    

    The problem is not because the IF statement entered the swiped m the cnt = 1, but because, when the code is compiled the PRIMARY column does not exist. The code should compile properly against the database, and all verified database object references, until the code is actually running.

    As you have discovered, when you do the dynamic update to help to run immediately, you will not get this problem, because execute immediate statements are strings that can not be validated at compile time and so the code will compile ok and then run.

  • Canon MG7100 prints but will not scan after update of the iMac? How to fix?

    Canon MG7100 worked very well with the iMac - scanning and printing. After doing the updates of the iMac and installation Siri scanning does not work. Always printing. The printer/scanner Canon said - Set PC to start scanning - I have MG7100 added on the iMac. I opened (and re-locked) firewall to let in the Canon UJ utility. I deleted the all-in-one Hi - and added MG7100.

    http://support-Asia.Canon-Asia.com/contents/Asia/en/0100535401.html

    doesn't look like canon has a printer that takes in charge the newer versions of Mac OS x, if I were you I would take contact them to see if they plan on support of new versions, apple made no drivers for the hardware they don't and if hardware manufacturers does not provide a working driver head can group with the new version of Mac OS x We have to rely on manufacturing to have a download on their page

  • The closed display mode is no longer works after update of the Sierra on my MBPro. Known bug?

    I use a vertical dock for awhile, so my MBPro retina works in closed with external display, KB and mouse display mode.

    But since I installed the update of the Sierra, the external display not Mac OS desktop.

    It only works when I open the built-in screen...

    The bug is known? Or y at - it a setting to adjust on the Sierra?

    Thank you in advance

    Hi darklemon,

    I understand that, since the update to Mac OS Sierra, you've been unable to use your MacBook Pro in closed view. I know it's important to use your computer in a way that suits you, then I'm happy to help you.

    Let's start by resetting your memory NVRAM and SMC which can often help with system display and related issues:

    How to reset the NVRAM on your Mac - Apple Support
    Reset the management system (SCM) controller on your Mac - Apple Support

    Once you have done this, follow the steps here to set up the closed display mode:

    Use your Mac laptop to view closed with an external display - Apple Support

    Thank you for using communities Support from Apple. See you soon!

  • Update of the bad experience of typing after Sierra

    After the update of the Sierra the typing experience is sub par.  He lags on the screen and sometimes the AutoCorrect intervenes before you finish typing, "correcting" the word after that I typed it correctly.  It sorts of predicted what I'm typing and corrects until I finished typing so that the end result is something like "unbelievablele" or "correcteded."

    Anyone with the same problem?

    You can disable the automatic correction of spelling and grammar until you are done typing and then allow him to do these things on your work completed. What you have described is Pages doing all this while you type. On the Edit menu.

    Uncheck all the features in the submenu, as I've shown here:

    When you are finished typing, then display spelling and grammar.

  • cannot select the disk to install the update of the Sierra (Macbook Pro 13 inch, late 2011)

    I downloaded the update of the Sierra and proceeded with the installation. However, I noticed that even if I could move the pointer autour, I couldn't make selections on tapping the trackpad. I managed to get past the first steps by using the 'tab' key (keyboard) to make selections and 'space' to make the confirmations. However, arriving at step 'select the disk where you want to install Mac OS', the 'Tab' and 'Space' technical has stopped working. Now I'm stuck here. Can someone tell me please how to go beyond this?

    Looks like it's a problem of trackpad? Or in any case a trackpad issue connected with installation of Sierra? I would take the MBP for a Genius Bar...

Maybe you are looking for

  • With the new update version 29,0 gmail does not work?

    Whenever I try to open gmail, this gives: The page is not redirecting properly Firefox has detected that the server redirects the request for this address in a way that will never end. This problem can sometimes be caused by disabling or refusing to

  • Leader of left is no longer present

    I have two documents on my screen, one is a model I created and use all the time - a 4 page document. Top and left leaders show. I opened a new document and only shows Senior Executive.  No leader on the left. I clicked HIDE sovereign, then see THE l

  • Satellite A660 does not illuminate

    My laptop came in the mail a week ago and it lights immediately. After leaving it plugged for 2 minutes, we tried again and it still doesn't work. We removed the battery and after about 7 minutes, it not light.Today, I went to turn on my laptop (firs

  • How can I fix a system32\bxrifwe.dll

    Whenever my computer starts up, it gives me this error (c:\WINDOWS\system32\bxrjfwe.dll). Why this is happening and I do this with difficulty to spend money? I tried a google search and bing on this error message specific and you can find another thi

  • Firesight URL filtering - shows do not block page for https sites

    Hi all I configured to block certain pages of URL filtering. I configured the decrypting ssl as well. But I noticed that when a website https is blocked firesight does not display the block page. When the Web http site is blocked the block page shows