Helps the complex SQL update

Hello

I have a MyCounter table that is used to get the sequence numbers after N.
For purposes of simplicity, let's just table MyCounter has 2 fields - maxNumber and currentNumber.
maxNumber is the maximum sequence number that can be allocated.
currentNumber is the last (current) sequence number.

Assuming maxNumber is 1000, currentNumber is 500. If N is 10, the sequence should I get numbers: From = To = 510, 501

I am new to Oracle. I had a first blow of dagger to write the SQL to update, but I am not convinced that it works.
Can anyone give me suggestions please? Thank you...

---------

DECLARE
v_origValue NUMBER (10,0): = 0;
v_allocated NUMBER (10,0): = 0;
V_quantity NUMBER (10,0): = 0;

BEGIN
V_quantity: = 10; -assuming that 10 is a constant at this stage

UPDATE MyCounter
SET v_allocated = box
When (currentNumber + v_quantity < = maxNumber) then restart
else (maxNumber-currentNumber)
end,
v_origValue = (currentNumber),
currentNumber = (currentNumber + v_allocated)
WHERE the currentNumber < maxNumber;

SELECT v_origValue + 1 as 'from', v_origValue + v_allocated 'to '.
FROM DUAL;

END;

---------

Kind regards
Judy

Here is a small example of what you could do.

SQL> create table t(type varchar2(10),max_val number, curr_val number)
  2  /

Table created.

SQL> insert into t values('type1',100,0)
  2  /

1 row created.

SQL> insert into t values('type2',1000,500)
  2  /

1 row created.

SQL> create or replace type my_seq as table of number
  2  /

Type created.

SQL> create or replace procedure get_sequence(ptype in varchar2, pcount in number, pseq out my_seq)
  2  as
  3     lcurr_val t.curr_val%type;
  4     lmax_val t.max_val%type;
  5     max_seq_exception exception;
  6  begin
  7     update t
  8        set curr_val = curr_val + pcount
  9      where type = ptype
 10     returning curr_val, max_val into lcurr_val, lmax_val;
 11
 12     if lcurr_val > lmax_val
 13     then
 14             rollback;
 15             raise max_seq_exception;
 16     else
 17             select lcurr_val - (level-1)
 18               bulk collect into pseq
 19               from dual
 20            connect by level <= pcount
 21              order by level desc;
 22
 23             commit;
 24     end if;
 25  exception
 26     when max_seq_exception then
 27             raise_application_error(-20001,'Max sequence exceeded');
 28  end;
 29  /

Procedure created.

SQL> declare
  2     lseq my_seq;
  3  begin
  4     get_sequence('type1',10,lseq);
  5     for i in 1..lseq.count
  6     loop
  7             dbms_output.put_line(lseq(i));
  8     end loop;
  9  end;
 10  /
1
2
3
4
5
6
7
8
9
10

PL/SQL procedure successfully completed.

SQL> select * from t
  2  /

TYPE          MAX_VAL   CURR_VAL
---------- ---------- ----------
type1             100         10
type2            1000        500

SQL> declare
  2     lseq my_seq;
  3  begin
  4     get_sequence('type1',100,lseq);
  5     for i in 1..lseq.count
  6     loop
  7             dbms_output.put_line(lseq(i));
  8     end loop;
  9  end;
 10  /
declare
*
ERROR at line 1:
ORA-20001: Max sequence exceeded
ORA-06512: at "SYSADM.GET_SEQUENCE", line 27
ORA-06512: at line 4

But do not forget in a multiuser environment, there are many chances for you to get screwed!. Sequence is the best option in my opinion.

Published by: Karthick_Arp on November 30, 2008 21:14

Tags: Database

Similar Questions

  • Complex SQL update

    Oracle Version: 10g

    I'm writing an update statement, based on the string of elements. The table contains around 2 M disks. Any help build this SQL is appreciated. Thank you!

    The elements in the array will not be in order. Just use this as an example...

    ItemNo1 changed to ItemNo2
    ItemNo4 changed to ItemNo3
    ItemNo5 changed to ItemNo2
    ItemNo6 changed to ItemNo7
    ItemNo7 changed to ItemNo8
    ItemNo2 changed to ItemNo3

    1, 2, 3, 6 documents should be updated as string agroalimentaire1 and documents 4 and 5 must be updated Chain2.

    Please see the scripts and the sample data below.
      CREATE TABLE "AVLTSB_SUB" 
       (     "CHAIN_ID" NUMBER NOT NULL ENABLE, 
         "ITM_NO" VARCHAR2(30 BYTE) NOT NULL ENABLE, 
         "SUB_ITM_NO" VARCHAR2(30 BYTE) NOT NULL ENABLE, 
         "UPD_TS" TIMESTAMP (6) DEFAULT SYSTIMESTAMP NOT NULL ENABLE, 
         "ORD_IND" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE, 
         "EFF_DT" DATE NOT NULL ENABLE, 
         "ONE_WY_IND" NUMBER(*,0) DEFAULT 0 NOT NULL ENABLE
       ) 
    
    
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-120','009009PM-121',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-121','009009PM-122',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),0);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-123','009009PM-122',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-124','009009PM-125',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-125','009009PM-126',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-126','009009PM-127',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),0);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-127','009009PM-128',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-128','009009PM-129',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-130','009009PM-131',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),0);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-131','009009PM-132',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-132','009009PM-133',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'009009PM-134','009009PM-135',to_timestamp('28-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('28-JUL-10','DD-MON-RR'),1);
    Insert into AVLTSB_SUB (CHAIN_ID,ITM_NO,SUB_ITM_NO,UPD_TS,EFF_DT,ONE_WY_IND) values (0,'0030033-8602','0030033-8604',to_timestamp('22-JUL-10 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_date('22-JUL-10','DD-MON-RR'),1);
    
    Expected Output after updating the Chain_ID:
    
    select chain_id, itm_no, sub_itm_no from avltsb_sub
    
    1     009009PM-120     009009PM-121
    1     009009PM-121     009009PM-122
    1     009009PM-123     009009PM-122
    2     009009PM-124     009009PM-125
    2     009009PM-125     009009PM-126
    2     009009PM-126     009009PM-127
    2     009009PM-127     009009PM-128
    2     009009PM-128     009009PM-129
    4     009009PM-130     009009PM-131
    4     009009PM-131     009009PM-132
    4     009009PM-132     009009PM-133
    5     009009PM-134     009009PM-135
    6     0030033-8602     0030033-8604

    user13143312 wrote:
    There is a problem with documents where if a new item goes back to one of the old elements in the chain, he sees a new chain.

    OK, I've arranged ;-)

    select RootITM_NO,RootSUB_ITM_NO,
    dense_rank() over(order by min(ITM_NO),min(SUB_ITM_NO)) as rn
    from (select ITM_NO,SUB_ITM_NO,
          connect_by_root ITM_NO as RootITM_NO,
          connect_by_root SUB_ITM_NO as RootSUB_ITM_NO
            from "AVLTSB_SUB" a
          connect by nocycle prior SUB_ITM_NO in(ITM_NO,SUB_ITM_NO)
                          or prior ITM_NO     in(ITM_NO,SUB_ITM_NO))
    group by RootITM_NO,RootSUB_ITM_NO
    order by RootITM_NO,RootSUB_ITM_NO;
    
    ROOTITM_NO    ROOTSUB_ITM_NO  RN
    ------------  --------------  --
    0030033-8602  0030033-8604     1
    009009PM-120  009009PM-121     2
    009009PM-121  009009PM-122     2
    009009PM-123  009009PM-122     2
    009009PM-124  009009PM-125     3
    009009PM-125  009009PM-126     3
    009009PM-126  009009PM-127     3
    009009PM-127  009009PM-128     3
    009009PM-128  009009PM-129     3
    009009PM-130  009009PM-131     4
    009009PM-131  009009PM-132     4
    009009PM-132  009009PM-133     4
    009009PM-134  009009PM-135     5
    
  • Updates using the single SQL Update statement.

    Hi guys,.

    I got an interview... and was not able to answer a question.

    In view of the table emp... need to update the salary with the following requirement by using an SQL statement.

    1 update salary + 1000 for employees who receive pay between 500 and 1000
    2 update salary + 500 for employees who receive wages between 1001 and 1500

    The two above the requirement should be made using only a SQL update statement... can someone tell me how to do?
    update emp
      set salary   = case when salary between 500 and 1000
                                then salary + 1000
                                when salary between 1001 and 1500
                                then salary + 500
                          end;
    

    Concerning
    Arun

  • Helps the a security update for Microsoft XML Core Services 4.0 Service Pack 2 (KB954430) necessary

    Help, I downloaded this upgradeand inswtalled but it keeps appearing on the update is ready and must have been instlled about 20 times now, what can I do to stop this

    Hi Stanislaus21,

    Welcome to the Microsoft Vista answers Forum!

    This question has already been answered on another thread. Please check the solution provided and let us know if this helps.

    http://social.answers.Microsoft.com/forums/en-us/vistawu/thread/a1d6490a-21d1-4210-9dd6-b42463370255

    Mohan

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Helps the Adobe Flash update

    I can't update my Adobe's Flash Player.  I created an account, I know that my username and password (I just put it), but I can not connect to complete the download.  Help!

    Hello

    Link below might be useful:

    Re: No password for the update of Flash Player

    It's the OS, not Flash Player to ask for the password, as such, it is one you use (with administrator permissions) to connect to your system.  See what userid & password I need to install Flash Player?  For more information

    Adobe - Flash Player

    Flash Player Help

  • Helps the complex expression to Group By

    Hi all
    I use a BPM opensource to store variables in a Workflow process. Variables are stored in an Oracle 10 database and can be retrieved using the native Api of BPM (Java) or by using Sql. For performance reasons, I use simple SQL to collect a list filtered workflow variables.

    Here is a simplified version of the BPM_INSTANCE Table:

    [NAME] [VALUE] [PROCESS_INSTANCE]
    =====================================
    AREA IN ADDITION TO 1 125
    ACME CUSTOMER 125
    ID_WO 500 125

    2 200 FIELD
    200 TEST CLIENT
    ID_WO 501 200

    1 225 FIELD
    CUSTOMER MODEL 225
    ID_WO 502 225

    Each PROCESS_INSTANCE has a set of variables that have a NAME and a VALUE.

    My need is to collect the list of all (500,501,502) ID_WO, PROCESS_INSTANCE belongs to a DOMAIN (ex. 1) and one client (e.g. ACME)

    I started coding the SQL:

    Select VALUE from BPM_INSTANCE where NAME = 'ID_WO' and PROCESS_INSTANCE in
    (select PROCESS_INSTANCE from BPM_INSTANCE, whose NAME = "CUSTOMER" and VALUE = "ACME"
    )
    However, I am not able to meet several conditions (for example I need also the PROCESS_INSTANCE also contains an AREA = 1).
    Can someone help me?
    Thank you
    Frank

    Hello

    Would this work:

    with data as (
     select 'AREA' as name, '1' as value, '125' as pi from dual union all
     select 'CLIENT' , 'ACME', '125' from dual union all
     select 'ID_WO', '500', '125' from dual union all
     select 'AREA', '2', '200' from dual union all
     select 'CLIENT', 'TEST', '200' from dual union all
     select 'ID_WO', '501', '200' from dual union all
     select 'AREA', '1', '225' from dual union all
     select 'CLIENT', 'DUMMY', '225' from dual union all
     select 'ID_WO', '502', '225' from dual)
    select o.value, i.value, ii.value from data o
     inner join data i on ( o.pi = i.pi )
     inner join data ii on ( o.pi = ii.pi ) where o.name = 'ID_WO' and i.name = 'AREA' and ii.name = 'CLIENT'; 
    

    HtH
    Johan

  • helps the pl sql procedure

    Hi guys I have 4 tables, I have a table bills, lineitem and a stock table, I need to write a procedure to add an item to an invoice created previously, I am having a lot of problems to do this together, any help will be appreciated.
    assuming that my invoice table looks like this, inv_id (pk)
    cust_id
    in_amount
    and lineitem,
    item_id (PK)
    item_desc
    inv_id (fk)
    stock_id (FK),

    Table of actions
    stock_id (pk)
    st_name
    st_qoh
    st_pmin

    How can I go about it, I can also add atrigger fire when the stock is low. any help will be appreciated to greattly

    Trigger won't work for records which will be inserted after a trigger is created.
    It will not work for files that are already in the table.

  • Need to check delays in update of 1000 lines using the PL/SQL procedure.

    Hi all

    I'm new to PL/SQL. I need your help to build a procedure that executes the following statement and follows the time of update of 1000 rows. This is to check the performance of the database. I need to print the timestamp of start before the update and end timestamp after update. I need to do for the 1000 lines. The statement that will be used in the procedure is:

    SELECT

    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').

    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').

    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').

    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').

    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | NVL (TO_CHAR (START_TS), 'NULL').

    ', END_TS =' | NVL (TO_CHAR (END_TS), 'NULL') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').

    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').

    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').

    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | NVL (TO_CHAR (LAST_UPD), 'NULL') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').

    "', W_INSERT_DT = ' | NVL (TO_CHAR (W_INSERT_DT), 'NULL') |', W_UPDATE_DT = ' | NVL (TO_CHAR (W_UPDATE_DT), 'NULL').

    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |

    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; »  OF XXAFL_MON_FACTS_F;

    The above query creates instructions of update that must be executed 1000 times and the time required to update the 1000 lines should be followed.

    Thanks in advance!

    Code horribly wrong!

    Why this approach?

    Dynamic SQL is almost NEVER needed in PL/SQL. And if you think it's necessary and taking into account what is displayed as being problems here, you have a 99% chance of being wrong.

    This 1% where dynamic SQL is necessary, he will WITH bind variables to create shareable SQL, decrease memory requests, decrease the likelihood of a fragmented shared reel and decrease the burning CPU cycles on hard analysis.

    An example below. Your approach is the 1st. One that is slower than the correct approach to 37 (x_!) ...

    SQL> create table t ( n number );
    
    Table created.
    
    SQL>
    SQL> var ITERATIONS number;
    SQL> exec :ITERATIONS := 100000;
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL>
    SQL> TIMING START "INSERTs using Hard Parsing"
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  execute immediate 'insert into t values ('||i||')';
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using Hard Parsing
    Elapsed: 00:02:00.33
    SQL>
    SQL> TIMING START "INSERTs using Soft Parsing"
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  execute immediate 'insert into t values ( :1 )' using i;
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using Soft Parsing
    Elapsed: 00:00:06.06
    SQL> drop table t;
    
    Table dropped.
    
    SQL> create table t( n number );
    
    Table created.
    
    SQL>
    SQL>
    SQL> TIMING START "INSERTs using a single parse and repeatable statement handle "
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  insert into t values ( i );
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using a single parse and repeatable statement handle
    Elapsed: 00:00:04.81
    SQL>
    
  • Cannot display the results to the database during "Update": SQL statement

    Hello

    I get this error trying to update a VO via the UI or BCBrowser.

    Cannot display the results to the database during "Update": SQL statement

    This is a default single front & right THAT VO creates on the object of the entity (Database Table)

    On the same table and with the same credentials of DB, I could update the record.

    Any guess on what went wrong?

    Thanks in advance for any help.

    p.s Jdev 11.1.1.6

    Journal:

    oracle.jbo.DMLException: Houston-26041: could not publish data from database in "Update": SQL statement "START the CAR UPDATED CarEO SET SEL_ITEM =: 1 WHERE TXN_NO =: 2 AND LOGID =: AND SEQNO = 3: 4 POLL DELIVERY_MODE, CERTIFICATION_REQ, SOFT_COPY_IND, SELITEM IN: 5,: 6,: 7,: 8; END; ».

    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:583)

    at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:8575)

    at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6816)

    at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3290)

    at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3093)

    at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2097)

    at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2378)

    at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1615)

    at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1417)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1437)

    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)

    at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)

    at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)

    at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:111)

    to oracle.jbo.uicli.controls.JUNavigationBar$ NavButton.actionPerformed (JUNavigationBar.java:118)

    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)

    in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)

    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)

    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)

    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)

    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)

    at java.awt.Component.processMouseEvent(Component.java:6289)

    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)

    at java.awt.Component.processEvent(Component.java:6054)

    at java.awt.Container.processEvent(Container.java:2041)

    at java.awt.Component.dispatchEventImpl(Component.java:4652)

    at java.awt.Container.dispatchEventImpl(Container.java:2099)

    at java.awt.Component.dispatchEvent(Component.java:4482)

    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)

    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)

    at java.awt.Container.dispatchEventImpl(Container.java:2085)

    at java.awt.Window.dispatchEventImpl(Window.java:2478)

    at java.awt.Component.dispatchEvent(Component.java:4482)

    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)

    to java.awt.EventQueue.access$ 000 (EventQueue.java:85)

    in java.awt.EventQueue$ 1.run(EventQueue.java:603)

    in java.awt.EventQueue$ 1.run(EventQueue.java:601)

    at java.security.AccessController.doPrivileged (Native Method)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:98)

    in java.awt.EventQueue$ 2.run(EventQueue.java:617)

    in java.awt.EventQueue$ 2.run(EventQueue.java:615)

    at java.security.AccessController.doPrivileged (Native Method)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)

    at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)

    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)

    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    Caused by: java.sql.SQLException: invalid column type

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:150)

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:399)

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:581)

    at oracle.jdbc.driver.OracleCallableStatementWrapper.registerOutParameter(OracleCallableStatementWrapper.java:1765)

    at oracle.jbo.server.OracleSQLBuilderImpl.bindUpdateStatement(OracleSQLBuilderImpl.java:2243)

    at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:10524)

    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:412)

    ... 52 more

    The problem is solved now.

    new columns added to the database table, after the creation of the entity object. Those changes were not picked up in the entity object.

    I found this difference after object entity with the DB Table comparison.

    And when I added these new columns to EO & VO, I don't get this error more.

    Thanks to all who tried to help

  • How to convert the next update of FORALL to run the SQL UPDATE statement

    I have a FORALL loop for updating a table. It takes too much time. I want to rewrite the code to a direct sql UPDATE. Also of other tips or tricks that can help to run the fastest proc?
    CURSOR cur_bst_tm IS
    SELECT listagg(tm, ' ') WITHIN GROUP(ORDER BY con_addr_id) best_time,
           con_addr_id
       FROM   (select Trim(Upper(con_addr_id)) con_addr_id,
                      '&'
                      ||decode(Initcap(start_day), 
                                      'Monday', 'm',
                                    'Tuesday', 'tu',
                                    'Wednesday', 'w',
                                    'Thursday', 'th',
                                    'Friday', 'f',
                                     Initcap(start_day))
                      ||'='
                      ||trunc(( ( TO_DATE(start_tm,'HH12:MI:SS PM') - trunc(TO_DATE(start_tm,'HH12:MI:SS PM')) ) * 24 * 60 ))
                      ||','
                      ||trunc(( ( TO_DATE(end_tm,'HH12:MI:SS PM') - trunc(TO_DATE(end_tm,'HH12:MI:SS PM')) ) * 24 * 60 )) tm
               FROM   (SELECT DISTINCT * FROM ODS_IDL_EDGE_OFFC_BST_TM)
                 WHERE con_addr_id is not null)
      GROUP  BY con_addr_id
      ORDER BY con_addr_id;
    
    TYPE ARRAY IS TABLE OF cur_bst_tm%ROWTYPE;
    l_data ARRAY;
    
    
    BEGIN
    
     OPEN cur_bst_tm;
        
         LOOP
        FETCH cur_bst_tm BULK COLLECT INTO l_data LIMIT 1000;
    
        FORALL i IN 1..l_data.COUNT
      
          UPDATE ODS_CONTACTS_ADDR tgt
          SET best_times = l_data(i).best_time,
          ODW_UPD_BY = 'IDL - MASS MARKET',
           ODW_UPD_DT = SYSDATE,
          ODW_UPD_BATCH_ID = '0'
          WHERE Upper(edge_id) = l_data(i).con_addr_id
           AND EXISTS (SELECT 1 FROM ods_idl_edge_cont_xref src
                       WHERE tgt.contacts_odw_id = src.contacts_odw_id
                          AND src.pc_flg='Y')   
           ;       
    
        EXIT WHEN cur_bst_tm%NOTFOUND;
        END LOOP;
         
      CLOSE cur_bst_tm;
    Record count: -.

    Select count (*) from
    ODS_IDL_EDGE_OFFC_BST_TM;
    140 000

    SELECT count (*)
    Ods_idl_edge_cont_xref SRC
    WHERE src.pc_flg = 'Y';
    118 000

    SELECT count (*)
    OF ODS_CONTACTS_ADDR;
    671 925

    Version of database 11g.

    Execution plan for update:
    Operation object name lines cost/output PStart PStop object node bytes

    Mode of UPDATE STATEMENT Optimizer = ALL_ROWS 6 K 8120
    UPDATE ODW_OWN2. ODS_CONTACTS_ADDR
    SEMI 6 K 256 K 8120 HASH JOIN
    TABLE ACCESS FULL ODW_OWN2. ODS_CONTACTS_ADDR 6 K 203 K 7181
    TABLE ACCESS FULL ODW_OWN2. ODS_IDL_EDGE_CONT_XREF K 118 922 K 938

    Edited by: user10566312 May 14, 2012 01:07
  • sql Update query after matching with the string

    I am trying to reach the query that updates a table column with the value of the other table, after that he finds an exact match.

    So here's the table data and sample to create.
    create table code1 
    (
        codeid number,
        codedesc varchar2(60)
    );
    
    Insert into code1 values ( 1,'R1 CONTRACTS');
    
    Insert into code1 values ( 2,'R2 CONTRACTS');
    
    Insert into code1 values ( 3,'R3 CONTRACTS');
    
    Insert into code1 values ( 4,'R5 CONTRACTS');
    
    Insert into code1 values ( 5,'R9 CONTRACTS');
    
    Insert into code1 values ( 6,'R10 CONTRACTS');
    
    create table table1 
    (   
        tablekey number,
        prefix  varchar2(25),
        codedesc    varchar2(60)
    );
    
    Insert into table1(tablekey,prefix) values (1,'1001PAC');
    
    Insert into table1(tablekey,prefix) values (2,'1001MXT');
    
    Insert into table1(tablekey,prefix) values (3,'1002PAE');
    
    Insert into table1(tablekey,prefix) values (4,'1003PCS');
    
    Insert into table1(tablekey,prefix) values (5,'1004BDX');
    
    Insert into table1(tablekey,prefix) values (6,'1005PAC');
    
    Insert into table1(tablekey,prefix) values (7,'1006PAC');
    
    Insert into table1(tablekey,prefix) values (8,'1007LDR');
    
    Insert into table1(tablekey,prefix) values (9,'1009LCR');
    
    Insert into table1(tablekey,prefix) values (10,'1010LBR');
    
    Insert into table1(tablekey,prefix) values (11,'ABCDEF');
    I'm writing a query that would update the value of column - codedesc (currently Null) of the table1 table: after it is a string of column - table code1 codedesc.

    The logic for the match is, - take - 2nd column of table-codedesc code value and get 2 characters. For example, when the string is - R1 CONTRACTS, the string will be 1. (Select substr ("R1 CONTRACTS, 2, 2) of the double). -Output will be 1.

    Now,.
    Look in table 1 for the 3rd position of the prefix that corresponds to the string returned by the query above. So, if the prefix is '1001PAC', it should look for 2 value of figures from the 3rd position. So, in this case it will be 01. Digitally 01 and 1 are equal, then the match is found for this line in the table1 table, so we will need to update the value of the column codedesc with the "contracts of R1.
        tablekey,    prefix            codedesc    
    ---------- ------------------------------------------------------------
    
          1               1001PAC     R1 CONTRACTS    -- Needs to be update with this value. 
          2               1001MXT     R1 CONTRACTS
          3               1002PAE      R2 CONTRACTS
    ...
          11             ABCDEF                                --Null ( No Need to update when no match found).
    SQL> select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Release 10.2.0.4.0 - 64bit Production
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    Appreciate your help.

    Hello

    You want to avoid TO_NUMBER, given that will cause an error if even a line has a number no (except space) in the wrong place.
    Use RTRIM to remove extra spaces at the end of the match_key and LPAD to add '0', if necessary, at the beginning:

    MERGE INTO     table1          dst
    USING   (
              SELECT  LPAD ( RTRIM ( SUBSTR ( codedesc
                                     , 2
                                   , 2
                                   )
                              )
                         , 2
                         , '0'
                         )          AS match_key
              ,     codedesc
              FROM     code1
         )               src
    ON     (src.match_key     = SUBSTR ( dst.prefix
                           , 3
                         , 2
                         )
         )
    WHEN MATCHED THEN UPDATE
         SET     dst.codedesc     = src.codedesc
    ;
    

    Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

  • SQL update the context field to table oe_order_lines_all

    Hello

    Can update us the context field on the order line table using sql update. Can someone please let me know, what would this cause.

    I use the same context values that are defined in the form of DFF, but one of the value is missing from the FDF form. What is the next step?

    Example:

    Update oe_order_lines_all
    Set frame = (select...), attribut1 = 'test '.
    where header_id = 1101

    Hello

    Consult the following document and see if it helps.

    Note: 746787.1 - process of PLC control in the management of order- UPDATE operation
    https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=746787.1

    Kind regards
    Hussein

  • Speed/performance of my mac mini (mid-2010) is very slow. Need help, consolidate the files, software updates, etc. in order to improve the speed and performance.

    My mac mini (mid-2010) speed/performance is very slow - think of it as a result of letting my kids do "whatever" about it in recent years.  Need help, consolidate the files, software updates, etc. in order to improve the speed and performance.  You will also need to get data out of old PowerBook G4.

    < object edited by host >

    We are users like you.  Search locally by using something like Yelp or similar

    http://www.Yelp.com/search?find_desc=Apple+repair & find_loc = Chicago, + IT & start = 0 & ortby = rating s

    or read a few links which may be relevant on this forum about the slow mac mini

    http://BFY.tw/5C63

  • I can't Live Update my Max Total Security that I get the message "DB update failed download!» Max Support also did not help at all. Disappointing. What should do?

    I can't Live Update my Max Total Security that I get the message "DB update failed download!» Max Support also did not help at all. Disappointing. What should do?

    Do yourself a favor and remove the application.  Mac do not need AV applications and at best, they will be not hard (but not good either) and at worst will corrupt your system / OSX's built in protection.  Your concerns are malicious software that requires the cooperation of the user to install, not the virus.

    For more information, please read this:

    http://www.thesafemac.com/

    Ciao.

  • I received an error code 800b0100 update. I just installed windows 7 student disc and my computer guard stop. I me trying to get the updates that might help the closing of the bottom.

    I received an error code 800b0100 update. I just installed windows 7 student disc and my computer guard stop. I me trying to get the updates that might help the closing of the bottom.

    Hi Happyrockgeek,

    Welcome to Microsoft Windows 7 answers Forum!

    This problem occurs if the Windows security .dll files are incorrectly registered.

    To resolve this problem, you can perform the two methods of troubleshooting, check if the problem is resolved.
    Method 1:
    Run (Checksur.exe) system update readiness tool.
    To do this, follow these steps:
    1. download and run the system update readiness tool. This tool runs an ad hoc analysis of inconsistencies that might prevent future maintenance operations. For more information about how to download and run the Checksur.exe tool, click on the number below to view the article in the Microsoft Knowledge Base:
    http://support.Microsoft.com/default.aspx/KB/947821
    2. try to install the updates again.
     
    Methods 2.
    Reset the Windows Update components.
    1. to reset the Windows Update components automatically, click the fix button in the link below.
    http://support.Microsoft.com/kb/971058 
    2. click run in the file download dialog box and follow the steps described in the fix it Wizard.

    I also suggest you to install the latest version of Windows Installer 4.5.
    Follow the link below to download:
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en
    and you can also try to install after you turn off the firewall.
     
     
    It will be useful.
     
    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum.

Maybe you are looking for

  • Motorcycle G Dual Sim KitKat 4.4.4 (low WIFI signals)

    Hello Got the Kitkat 4.4.4 update 3 days back. After updating the device is delay and then more slowly before. And the main question for me atleast is the WIFI signals which are now LOW and SIM network loss. anyway to get around this? I read on anoth

  • Computer Vista will not format DVD RW drives more

    I have problems with my DVD disc burning, windows formateront is no longer my DVD - RW discs but will format my DVD-R discs, what can I do as I don't like having to use disposable DVD discs all the time? I'm just a learner so im very confused, please

  • Updates failed. Do not configure.

    Download updates and it asks me to restart my computer. When my computer starts up again, it says configure step 3 of 3 0% complete. It takes forever and says he does not finish and restore the changes. He has done many times. The summary of the upda

  • Windows Remote Desktop connection

    Good day, the team Please, I have 2 computers, COM A [Windows 7] and COM B [Windows 8.1]. I would like to have remote desktop connection Windows on both computers with the B COM is the controller and the COM has being the controlled. If please be inf

  • error in import csv to oracle tables

    Hello good evening everyone,When I try to import the csv file, I got following error can someone please help mefirst I created the table looks like SQL > names desc; Name                                      Null?    Type ----------------------------