query users to mulitple update block with different values

Hello

I need to write a SQL script to update the information of multiple users (400) in the database.

Here's the query I use to update a single user:

setting a day of usr set usr_login = "ROBERTAA_OLDx", USR_EMAIL = 'robertaa@abadrer_dellllx.com' where usr_login = 'ROBERTA ';

usr_login and usr_email must be different for each user.

What is the best way to achieve this?

Please suggest

Thank you

OK, I see.  Here is my version of update:

DROP TABLE usr;

CREATE TABLE usr
(
 usr_login VARCHAR2(20)
,usr_email VARCHAR2(50)
);

INSERT INTO usr VALUES ('PENUMALH', '[email protected]');
INSERT INTO usr VALUES ('IAMTEAM', '[email protected]');
INSERT INTO usr VALUES ('TESTSOA2', '[email protected]');
INSERT INTO usr VALUES ('TESTADF1', '[email protected]');
INSERT INTO usr VALUES ('IAMTESTIR2', '[email protected]');
INSERT INTO usr VALUES ('IAMPWDTT', '[email protected]');
INSERT INTO usr VALUES ('IAMPWDTI', '[email protected]');

COMMIT;

SET LINESIZE 80 PAGESIZE 20

COLUMN usr_login FORMAT A20
COLUMN usr_email FORMAT A50

SELECT *
  FROM usr;

UPDATE usr t1
   SET (t1.usr_login, t1.usr_email)
       =
       (SELECT t2.usr_login || 'OLD' || TO_CHAR(ROWNUM) AS usr_login
              ,SUBSTR(t2.usr_email, 1, INSTR(t2.usr_email, '.', -1, 1) - 1)
               || '_delxxxxasdf' ||
               SUBSTR(t2.usr_email, INSTR(t2.usr_email, '.', -1, 1)) AS usr_email
          FROM usr t2
         WHERE t2.usr_login = t1.usr_login);

COMMIT;

SELECT *
  FROM usr;

And the output:

Table dropped.
Elapsed: 00:00:00.05
Sequence dropped.
Elapsed: 00:00:00.03
Table created.
Elapsed: 00:00:00.03
Sequence created.
Elapsed: 00:00:00.03
1 row created.
Elapsed: 00:00:00.13
1 row created.
Elapsed: 00:00:00.04
1 row created.
Elapsed: 00:00:00.03
1 row created.
Elapsed: 00:00:00.03
1 row created.
Elapsed: 00:00:00.03
1 row created.
Elapsed: 00:00:00.03
1 row created.
Elapsed: 00:00:00.03
Commit complete.
Elapsed: 00:00:00.02

USR_LOGIN            USR_EMAIL
-------------------- --------------------------------------------------
PENUMALH             [email protected]
IAMTEAM              [email protected]
TESTSOA2             [email protected]
TESTADF1             [email protected]
IAMTESTIR2           [email protected]
IAMPWDTT             [email protected]
IAMPWDTI             [email protected]                                

7 rows selected.
Elapsed: 00:00:00.03
7 rows updated.
Elapsed: 00:00:00.04
Commit complete.
Elapsed: 00:00:00.02

USR_LOGIN            USR_EMAIL
-------------------- --------------------------------------------------
PENUMALHOLD1         Hari.Penumalli@abc_delxxxxasdf.com
IAMTEAMOLD1          iam.team@xyz_delxxxxasdf.com
TESTSOA2OLD1         test.soa2@gio_delxxxxasdf.com
TESTADF1OLD1         test.adf1@yu_delxxxxasdf.com
IAMTESTIR2OLD1       iam.testir@ou_delxxxxasdf.net
IAMPWDTTOLD1         iam.pwdtt@iuet_delxxxxasdf.in
IAMPWDTIOLD1         iam.pwdt@oiyoi_delxxxxasdf.com                    

7 rows selected.
Elapsed: 00:00:00.03

Tags: Database

Similar Questions

  • Updated several lines with different values

    Hello!
    I have a problem. I need to update more than 1000 lines with different values. How can I do?
    For exsample I have table:
    ID; color, date,
    1 red
    2 green
    3 white

    I need to update the date field.

    Update table
    Set date = '01.02.03'
    where id = 1

    Update table
    Set date = '01.03.03'
    where id = 2


    Maybe it's how to update multiple rows in a single request?

    Sorry for my bad English.
    Thank you!

    Hello

    You can try this

    UPDATE TABLE SET DATE = CASE
                        WHEN ID = 1 THEN TO_DATE('01-02-03','DD-MM-RR')
                        WHEN ID = 2 THEN TO_DATE('01-03-03','DD-MM-RR')
                        END
    

    see you soon

    VT

  • reuse of filters with different values

    We have a usage scenario where the same filters will have to be applied several times with different values. Looking the javadocs, it seems like there is no way to change the values of pre-packaged filters (EqualsFilter, GreaterFilter etc.). Is that correct or is there a way to do it? I see that if we use CohQL, we can use bind variables to do this. However, the use cases we should rather just more complex extractors ReflectionFilters.

    In addition, there no performance impact by using CohQL against java constructs directly?

    Thank you
    Manju.

    Hi Manju,

    While it is true that you cannot change values in the built in filters, even if you could it wouldn't make you save a lot on the construction of a new filter every time. I guess that if you build a very large number of filters, then you're going to create more garbage, but that shouldn't be a problem either. Some of the more specialized filters also contain State so that you do not want to resuse them.

    The main performance issue I know with CohQL which is only creates extractors of reflection so won't enjoy all serialized POF values you have. If you have indexed each value you want to query on using the same extractors relflection then it would help, but again, this means that everything you deserialization of the values for the query or insert to update the index.

    Kind regards
    JK

  • DAQmx create track (I-current-Basic) 8 channels with different values of Shunt resistance

    Hello

    I want to measure 8 current channels with different values of Shunt resistance.

    Problem: The channel create DAQmx (HAVE current Basic) specifies that a value of Shunt resistance.

    How can I set the value of Shunt resistance for each channel individually?

    Concerning

    Marcel

    Hi Marcel_C,

    Take a look to get attached.

    Best regards

    Mencef

  • two rows of delete with different values

    Hello

    I wouldn't lines with the same id and have values of E and F 10258932.

    I would like the following data:
    A        B  C      D     E N
    -------- -- ------ ----- - -
    10258927 1  103,35 0
    10258929 3  284,85 89,52 E N
    10258929 4  323,85 89,52 E N
    10258930 5  478,80 91,53 E N
    10258931 6  436,67 78,09 E N
    But I have the following lines:
    SQL> with my_table as
      2  (
      3  select '10258927' a, '1'  b, '103,35'  c, '0'      d,   NULL  e from dual union all    
      4  select '10258928' a, '2'  b, '0'       c, '15,19'  d,  'E'    e from dual union all
      5  select '10258929' a, '3'  b, '284,85'  c, '89,52'  d,  'E'    e from dual union all
      6  select '10258929' a, '4'  b, '323,85'  c, '89,52'  d,  'E'    e from dual union all
      7  select '10258930' a, '5'  b, '478,80'  c, '91,53'  d,  'E'    e from dual union all
      8  select '10258931' a, '6'  b, '436,67'  c, '78,09'  d,  'E'    e from dual union all
      9  select '10258932' a, '7'  b, '784,88'  c, '23,19'  d,  'E'    e from dual union all
     10  select '10258932' a, '8'  b, '100,88'  c, '11,11'  d,  'E'    e from dual union all
     11  select '10258932' a, '9'  b, '300,88'  c, '22,22'  d,  'F'    e from dual union all
     12  select '10258932' a, '10' b, '468,25'  c, '78,33'  d,  'F'    e from dual)
     13  select a, b, c, d, e, no_ds from
     14  (
     15    select a, b, c, d, e,
     16           case when c > 0 and e != 'F'
     17                then 'N'
     18           end no_ds
     19    from my_table)
     20  where no_ds = 'N' or e is null
     21  order by 1
     22  /
    
    A        B  C      D     E N
    -------- -- ------ ----- - -
    10258927 1  103,35 0
    10258929 3  284,85 89,52 E N
    10258929 4  323,85 89,52 E N
    10258930 5  478,80 91,53 E N
    10258931 6  436,67 78,09 E N
    10258932 7  784,88 23,19 E N
    10258932 8  100,88 11,11 E N
    
    7 Zeilen ausgewählt.
    
    SQL> 
    Does anyone have an idea?

    Oh, I read the title again once: 'remove double lines with different values.
    If it means that he is not specifically E and F values, but only if there is more than one distinct value, then you can do the following:

    with my_table as
    (
    select '10258927' a, '1'  b, '103,35'  c, '0'      d,   NULL  e from dual union all
    select '10258928' a, '2'  b, '0'       c, '15,19'  d,  'E'    e from dual union all
    select '10258929' a, '3'  b, '284,85'  c, '89,52'  d,  'E'    e from dual union all
    select '10258929' a, '4'  b, '323,85'  c, '89,52'  d,  'E'    e from dual union all
    select '10258930' a, '5'  b, '478,80'  c, '91,53'  d,  'E'    e from dual union all
    select '10258931' a, '6'  b, '436,67'  c, '78,09'  d,  'E'    e from dual union all
    select '10258932' a, '7'  b, '784,88'  c, '23,19'  d,  'E'    e from dual union all
    select '10258932' a, '8'  b, '100,88'  c, '11,11'  d,  'E'    e from dual union all
    select '10258932' a, '9'  b, '300,88'  c, '22,22'  d,  'F'    e from dual union all
    select '10258932' a, '10' b, '468,25'  c, '78,33'  d,  'F'    e from dual
    )
    --
    -- end-of-test-data
    --
    select a, b, c, d, e,
           num_distinct_values
    from
    (
      select a, b, c, d, e,
             count(distinct e) over (partition by a) num_distinct_values
      from my_table)
    where num_distinct_values <= 1
    order by 1
    / 
    

    The county notes how the distinct non-null values in column e for each one.
    Where clause then selects those with count = 0 (this is where e = null) and count = 1.
    If the number is greater than 1, different values exist for this id.

    Choose what fits your condition ;-)

  • Return only the columns with different values.

    Hi all

    I am trying to solve a seemingly trivial problem but can't seem to get any clear answer anywhere in any forum. Consider a single table with 5 columns and only two lines:
    row_id           first_name         last_name        age            gender
    1                    John                  doe               27             M
    1                    Jane                  doe               27              F  
    Assume that there is no primary key or any other constraint. Also assume that there are only and only two lines of this table. So I need basically a query that, overall above lines, would return first name and sex, because they are only different columns in two lines, as well as their values. Even if I can get sort of column names that are different and that would be enough that I can easily access the values later. It is also important to remember that I may not know the names of the columns in the columns, so basically, somehow, I use user_tab_columns in the process.

    Any help appreciated.

    Published by: 894302 on May 1, 2013 10:35

    Hello

    894302 wrote:
    The exact release could be just a varchar variable that lists all the columns that have different values with each column name separated by commas. We'll call the query you want as a QUERY. So, if I do something like

    Select the REQUEST of double; Output should be: 'first_name, equality of the sexes. Is this possible?

    In this case:

    SELECT     RTRIM ( DECODE (a.row_id,     b.row_id,     NULL, 'row_id,')     ||
                    DECODE (a.first_name, b.first_name, NULL, 'first_name,') ||
              DECODE (a.last_name,  b.last_name,  NULL, 'last_name,')  ||
              DECODE (a.age,        b.age,          NULL, 'age,')      ||
              DECODE (a.gender,     b.gender,     NULL, 'gender,')
               , ','
               )          AS different_columns
    FROM     rhit_table_x  a
    JOIN     rhit_table_x  b  ON  a.ROWID     < b.ROWID
    ;
    

    Output:

    DIFFERENT_COLUMNS
    ---------------------------------------
    first_name,gender
    

    This assumes that you have really a table, then you can use ROWID to distinguish the lines, since there is no primary key.
    If this isn't the case, you first assign ROW_NUMBER in a subquery.

  • Problems updating default_where with date values

    Hello

    I want to update the attribute default_where with date values. the form is initialized, the attribute default_where = Lieferdatum > =: AB2.von AND Lieferdatum < =: AB2. BIS
    Then, I select the query.
    by fireing the trigger when-click of the mouse, I want to select only the witch value content items: Lieferdatum

    declare
    v_bestellnr varchar (200);
    test varchar (200);

    Start

    v_bestellnr: =: k_falschgeladen_vw. Lieferdatum;
    test: = 'LIEFERDATUM =' | v_bestellnr;
    Set_Block_Property ('K_FALSCHGELADEN_VW' test, DEFAULT_WHERE),
    EXECUTE_QUERY;

    end;

    I get the message FRM-40505 query could not be reached

    Paper copy of the formdeveloper http://www.neusob.de/~RobertKoch/dok1-Dateien/image002.jpg

    so, how can I get good value in the default_where attribute

    I hope that the: k_falschgeladen_vw. Lieferdatum is date data type. If so, try the following:

    Set_Block_Property('K_FALSCHGELADEN_VW', DEFAULT_WHERE, 'LIEFERDATUM=TO_DATE(''' || TO_CHAR(:k_falschgeladen_vw.Lieferdatum, 'DD.MM.YYYY') || ''', ''DD.MM.YYYY'')');
    EXECUTE_QUERY;
    
  • Two tables with different values of basic on an analysis filter

    Hi guys,.

    Let assume that I have an analysis with columns: group_id and sales.
    On this basis I would like to create two tables: table1 where group_id = 1 and table2 where group_id = 2.

    OBIEE is able to do?

    Kind regards
    Slavi

    Hi Slavi,

    You can do it in a single analysis, but you have to have the column with group_id twice.

    Bring, group_id_1, group_id_2 (same column), sale

    Now in table 1.

    bring group_id_1, sales

    Then in the selection steps for group_id_1-> select members-> Action choose keep only-> choose the value of the filter 1

    This will filter the table 1 with group_id 1

    In table2 group_id_2 porter, sales

    Then do the same step for group_id_2 with the value 2.

    You now have two reports with different filter in the same report.

    If you want you can keep the same name column for the two columns group_id, I just kept group_id_1, group_id_2 for easy reference.

  • Updated App with different DPS license

    Can someone advise me on the following scenario. I have a multi App edition, version 1.0 live in the Apple store using the DPS account [email protected]

    I then upgraded the application 2.0 on the Apple store, but the new version uses a different account DPS, [email protected]

    What happens in this scenario? Especially for users of the application who have purchased a subscription to the title of the version 1.0 (ie the other DPS account).

    Note: The 2 DPS accounts above are 2 different licenses DPS.

    You must first build the new application for a new account using the same certificates and using the same bundle id and include the same product id subscription in App Builder. Then you must republish the folios of account new account DPS application. Publish these older folios with the same product id. In this way, when you create and update using the new DPS account, all your subscribers would have access to download the previously titled folios.

  • Update of digital control with different values with array function

    Hello

    I have attached my code base. I want to execute the code for 2 sets of digital control with a gap between the two values, then pass it. Something like that

    ABC

    Initialize the P1 = 10; P2 = 20; P3 = 30; P4 = 40

    Run the code

    delay = 10ms

    Update of P1 = 150; P2 = 200; P3 = 350; P4 = 500

    Run the code

    jump to abc

    I am stuck how can I update the values of P1, P2, P3, P4? I thought about using a function table but couldn't go further.

    Thanks for the help,

    Ana

    Hello Ana,

    One way you might achieve what you are looking for is using property nodes. These property nodes will allow you to change the values of the block diagram control. You can set up a structure of case inside your loop that will change control through nodes of property value after a certain number of iterations. Here is a community sample that shows how to use the nodes property to change the Boolean controls:

    https://decibel.NI.com/content/docs/doc-22669

    -Erik S

  • Update records with different IDS

    Hello

    I am looking for the possibility to update some records using the new id with the column with a different id values

    example of

    the table contains some these documents:
    id    gross      net
    
    ========================
    7     0,1     0,0507749
    8     0,2     0,1015499
    9     0,5     0,2538748
    10     0,83     0,4214
    11     0,85     0,4315873
    12     1,99     1,010422
    13     2,44     1,2389094
    14     0     0
    15     2,59     1,3150719
    16     2,99     1,5181718
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    and I would like to insert the same gross and net of IDS 7-16 column values
    column with the ID of 40 to 49 in the same order.
    This is why I would like to get the result that I describe below:
    id    gross      net
    
    ========================
    7     0,1     0,0507749
    8     0,2     0,1015499
    9     0,5     0,2538748
    10     0,83     0,4214
    11     0,85     0,4315873
    12     1,99     1,010422
    13     2,44     1,2389094
    14     0     0
    15     2,59     1,3150719
    16     2,99     1,5181718
    40    0,1     0,0507749
    41    0,2     0,1015499
    42    0,5     0,2538748
    43    0,83     0,4214
    44    0,85     0,4315873
    45    1,99     1,010422
    46    2,44     1,2389094
    47    0     0
    48    2,59     1,3150719
    49    2,99     1,5181718
    Thanks in advance
    update  y1
    set (gross, net)=(select gross, net from  y2 where y2.id=y1.id-33)
    where y1.id between 40 and 49;
    

    You must replace with your real tablename.
    (not tested).

  • Remote Server Update Manager with different http port

    To put it simply, I think I might have some problems, but I installed the update on a remote server Manager (and not on the VC server) and since he also manages the WSUS updates, I couldn't use port 80 for the http port so I changed it to 81.  I have problems with the VC connection to Manager Update server.  I can't download the plugin to activate it.  Also, I noticed that there is a full installation of the 2.5u3 on our server of VC, which also included the Update Manager.  Should I uninstall that before the new one would connect upward?

    • Kyle

    I'm Tryin '

    I found something good again

    http://KB.VMware.com/kb/1006169

  • Update a field with different values of several tables

    Hello

    I have a table named AAA with 2 fields id and structure.
    And then I have other 3 tables with 2 fields id1 and structure1 id2, table1 and table2, id3 and structure3 to table3 organized.2.

    The number of AAA id is equal to the sum of the IDS of table1, table2, table3: #id = #id1 + id2 # + #id3).

    I want to update the structure of AAA table with values as well as field:
    where AAA.id = table1.id1-> AAA.structure = table1.structure1
    where AAA.id = table2.id2-> AAA.structure = table2.structure2
    where AAA.id = table3.id3-> AAA.structure = table3.structure3

    Can someone help me?

    I have Oracle11gR2.

    Thank you in advance.

    Oops...

    update  AAA
    set structure = (select structure1 from table1 where aaa.id = table1.id1)
    where aaa.id in (select id1 from table1)
    
  • loop to generate variables with different values

    A quiz, I have answers user saved in a table. At the end of the quiz, I need to extract individual responses to the different variables q1, q2, q3, etc.. The questionnaire can be of different questions so I need to adjust based on total questions inside. How can I use loop to create variables and values to capture?

    So, I would change the following:

    var q1:int = userAnswersArray [0];

    var q2:int = userAnswersArray [1];

    var q3:int = userAnswersArray [2];

    var q4:int = userAnswersArray [3];

    ...

    to the loop like the one below:

    for (i = 0; i < totalQuestion-1; i ++)

    {

    This ["var var q" + i] + ": int" = "userAnswersArray []" + this [i] + "]";

    }

    He probably has syntax errors that it does not work.

    Thanks for your help.

    If evidence of userAnswersArray are always aligned with issue numbers (say, question 1 answer is saved in 0, 2 - position 1, position etc.) maybe work the following:

    var urlreq:URLRequest = new URLRequest("subresultpage.asp");
    urlreq.method = URLRequestMethod.POST;
    var urlvars:URLVariables = new URLVariables();
    for(var i:int = 0; i < userAnswersArray.length; i++) {
      urlvars["q" + (i + 1)] = userAnswersArray[i];
    }
    
  • Report - Warning Message When the user clicks on the link with the value 0

    Hello

    I have a report with several areas, for example. Year, high priority project manager, County of medium priority project, project manager of low priority.
    I used column attributes to bind the data of the report on page 22.



    Now, some cells in the report have 0. Isn't it possible that when the user clicks on 0 binding doesn't to page 22, but see the window alert javascript indicating no data.


    Any help will be much appreciated.


    Kind regards
    Shijesh

    You can take a look at the following page

    http://HTMLDB.Oracle.com/pls/OTN/f?p=31517:228

    to see how this is possible.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for