Format a field using update statement

Hello,
What I am trying to do is update a field by using values from two fields from the same table. When I entered the following query, I got the error message ORA-00903: invalid table name. Any suggestions?
Update [Select Reg1.State _Field, Reg1.Route, Reg1.County
From Reg1
Where Reg1.State _Field Is Null]
Set Reg1.State_Field=
Reg1.Route &Reg1.County;

[Select Reg1.State
Are you using SQL server or Oracle?

Similar Messages

  • Updating data without using update statement

    Hi,
    A quick question...
    Can any table data could be updated without using update statement from backend.
    Just wanted to make sure.
    Thanks in advance.

    Hi,
    What is your definition of Update?
    Since your question is vague and you dont explain what exactly you mean.
    here are my thoughts
    1) A record can be deleted and isnerted with new values.Where the nes values have only few columns changed from previous ones.
    2) I use pl/sql developer.If i need to update i can write select.. for update.Change the values (as in notepad)Commit.
         This is infact a update but with nice UI
    3) even your application can update data in your tables, if you code it and give correct privileges to the userRegards,
    Bhushan

  • How to use Update Statement in ODI Procedure

    Hi,
    How can I use an update statement inside an ODI procedure.
    Thanks

    Hi,
    You do not need the BEGIN and END. ODI procedures are free text, so you can simply write your update statement, as you would in toad/sql developer etc etc. Just make sure you set the Technology and the logical schema. It is how ever best practice to also use the API:
    <%=odiRef.getSchemaName("YOUR_LOGICAL_SCHEMA_NAME", "D")%>. to prefix tables. This way, you select data from different schema's in the same instance (as long a your user has the correct privs).
    Cheers
    Bos
    Edited by: Bos on Jun 22, 2011 3:09 PM

  • How to lock a row before update using UPDATE statement ?

    I want to lock a row before updating using the UPDATE statement! is there any "reserved word" that I can append to an update statement so, that the row get locked!, also, will the lock gets released automatically once the update is done or do I have to explicitly release the lock?
    how can I do this ?
    any help is greatly appreciated.
    Thanks,
    Srini.

    For detail information, see http://otn.oracle.com/doc/server.815/a67779/ch4l.htm#10900
    The lock will be released by "commit".
    FOR UPDATE Examples
    The following statement locks rows in the EMP table with clerks located in New York and locks rows in the DEPT table with departments in New York that have clerks:
    SELECT empno, sal, comm
    FROM emp, dept
    WHERE job = 'CLERK'
    AND emp.deptno = dept.deptno
    AND loc = 'NEW YORK'
    FOR UPDATE;
    The following statement locks only those rows in the EMP table with clerks located in New York. No rows are locked in the DEPT table:
    SELECT empno, sal, comm
    FROM emp, dept
    WHERE job = 'CLERK'
    AND emp.deptno = dept.deptno
    AND loc = 'NEW YORK'
    FOR UPDATE OF emp.sal;

  • JDBC and using update statements

    I have a program that connects to a microsoft access DB using JDBC-ODBC Bridge, but i dnt know how to write a correct update statement. I use servlets & it should call a function that retrieves a specific value, adds 1 to that integer value and updates the DB,but it didn't work. i also need to know how to delete all records in a DB.
    Thanks in advance

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    public class first_count extends HttpServlet {
       private Statement statement = null;
       private Connection connection = null;
       private String URL = "jdbc:odbc:rjdemo";
       public void init( ServletConfig config )
          throws ServletException
          super.init( config );
          try {
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
          connection =DriverManager.getConnection( URL, "", "" );
            }//try
           catch ( Exception e )
             e.printStackTrace();
             connection = null;
          }//catch
       public void doPost( HttpServletRequest req,
                           HttpServletResponse res )
          throws ServletException, IOException
          String cnt;
          cnt = req.getParameter( "big" );
    //takes the parameter of a radio button in a form
         PrintWriter out = res.getWriter();
          res.setContentType( "text/html" );
         if ( cnt.equals("big1"))
    //if the value of the radio button equals big1
             int i=0;
             out.println("The number retrieved = " + big_counter(i));
                      }//if
            out.close();
    int big_counter(int i)
          try {
             i=0;
             statement = connection.createStatement();
             ResultSet r= statement.executeQuery("select beg_count from User");
             r.first();
             i=r.getInt("beg_count");
    //the name of column is beg_count it's a number
             i++;
             statement.executeUpdate("UPDATE User SET beg_count="+i);
             statement.close();
          }//try
          catch ( Exception e )
          }//catch
    return i;
       public void destroy()
          try {
             connection.close();
          catch( Exception e ) {

  • Copy records of one table into another using Update statement

    Supposing I have 2 tables test and test1.
    Test has columns col1 and col2. and test1 has only one table col1.
    select * from test returns:
    COL1 COL2
    a
    b
    c
    d
    e
    select * from test1 returns
    COL1
    p
    q
    r
    s
    t
    Suppose i want to copy values of test1.col1 to test.col2 so tht final result of
    select * from test should be
    COL1 COL2
    a p
    b q
    c r
    d s
    e t
    I found a query in the OCP introduction book:
    update test set col2=(select col1 from test11)
    this works fine only when we have a single record in test1 table but fails otherwise.
    how can this be achieved using the update statement ?

    SQL> desc test
    Name Null? Type
    COL1 VARCHAR2(10)
    COL2 VARCHAR2(30)
    SQL> desc test1
    Name Null? Type
    COL1 VARCHAR2(10)
    SQL> insert into test values ('a','');
    1 row created.
    SQL> insert into test values ('b','');
    1 row created.
    SQL> insert into test values ('c','');
    1 row created.
    SQL> insert into test values ('d','');
    1 row created.
    SQL> insert into test1 values ('e');
    1 row created.
    SQL> insert into test1 values ('f');
    1 row created.
    SQL> insert into test1 values ('g');
    1 row created.
    SQL> insert into test1 values ('h');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> ed
    Wrote file afiedt.buf
    1 select a.col1, b.col1, a.rn from
    2 (select row_number() over (order by col1) rn, col1 from test) a,
    3 (select row_number() over (order by col1) rn, col1 from test1) b
    4* where a.rn = b.rn
    SQL> /
    COL1 COL1 RN
    a e 1
    b f 2
    c g 3
    d h 4
    SQL> ed
    Wrote file afiedt.buf
    1 update test set col1 =
    2 (
    3 select forupd from (
    4 select a.col1, b.col1 test1col, a.col1||' '||b.col1 forupd, a.rn from
    5 (select row_number() over (order by col1) rn, col1 from test) a,
    6 (select row_number() over (order by col1) rn, col1 from test1) b
    7 where a.rn = b.rn
    8* ) z where z.col1 = test.col1)
    SQL> /
    4 rows updated.
    SQL> commit;
    Commit complete.
    SQL> select * from test;
    COL1 COL2
    a e
    b f
    c g
    d h
    SQL>
    This will work only if you have the same number of lines in COL1 in both tables. If you have different number of lines, then you need to code more at join (outer, inner).
    But for complicated cases, please post sample data.
    Michael
    PS: And supossing that the values are distinct in TEST table. Else update will fail, because more rows will be retrived.
    If more values in TEST table in COL1, then you need to assign a row number on TEST also, and in WHERE of query you need to place one more join condition:
    something like:
    8* ) z where z.col1 = test.col1
    and z.rn = test.rn)
    SQL> /
    But as i said, get more specifications.
    Message was edited by:
    kjt
    Added the PS.

  • Assigning values to 2 fields using sql statement

    db11g , apex 4.0 and firefox 24 ,
    hi all ,
    i am trying to follow this tutorial to assign values to 2 items on a page using sql statement ,
    and i am using the same sql statement the tutorial uses
    select d.loc location, count(e.empno) num_employees from dept d, emp e where d.deptno = e.deptno(+) and d.deptno = :P3_DEPTNO group by d.loc -- btw , what does the "+" sign mean?
    after the e.deptno in the where condition .
    but i am facing this error
    1 error has occurred
    Wrong number of columns selected in the SQL query. See Help of attribute for details.
    and it does not work with two columns in the select statement under any conditions , i tried to remove the group function and the group clause ,
    it does not work unless i use only one column in the select statement ??
    thanks

    Pars
    And how exactly is this rewrite of the sql statement resolving the OP's issue.
    You are still using more than 1 column which will still result in the error message:
    Wrong number of columns selected in the SQL query.
    As mentioned in my earlier post APEX 4.0 (the version the OP is using) does not handle a sql statement with multiple columns for the dynamic action Set Value.
    Which means the fastest  and simplest solution is splitting up the dynamic action in multiple Set Value actions.
    Using this plugin or upgrade to a newer apex version would also be a possibility.
    Nicolette

  • * Commit work on table  using UPDATE statement.*

    HI,
       This is Anil . I have problem regarding Commit work and Wait up to 2 seconds.
    I am using Commit work on one Update table statement but it is not working . While doing debugging it is working
    (means it is updating Table.) but while running the transaction directly it is not updating the table.
    Check the statements :
    Commit work.
    Some Select stmt on <table>.
    IF <condition.>
    Update  <table > statement.
    if sy-subrc EQ 0.
        Commit work . ( This is not working while running transaction mean it is not updating table. While debuggint it it updating table.)
         wait up to 2 seconds.
    endif.
    endif.
    Will that above Commit work causing any problem or  what is the reason it is not updating table.
    Please give some suggestion in this case.
    Regards,
    Anilreddy.

    Hi
    the below code with commit work is working finr for me.
    only thing i suggest is to check sy-subrc value.
    commit work.
    update spfli set test = '1234' where carrid = 'AA'.
    if sy-subrc eq 0.
    commit work.
    wait up to 2 seconds.
    endif.
    write: / sy-subrc.

  • Update statement in Internal Table

    Plz tell me the syntax and e.g. of update statement in Internal Table program
    Moderator message: Welcome to SCN, please research yourself before asking basic questions.
    Edited by: Thomas Zloch on Feb 25, 2010 12:47 PM

    Hi,
    Use UPDATE statement , check below description from SAP help.
    UPDATE dbtab FROM TABLE itab. or UPDATE (dbtabname) FROM TABLE itab.
    Effect
    Mass update of several lines in a database table.Here, the primary key for identifying the lines tobe updated and the values to be changed are taken from the lines of theinternal table itab. 
    The system field SY-DBCNT contains the number of updated lines,i.e. the number of lines in the internal table itab which havekey values corresponding to lines in the database table.
    Regards
    L Appana

  • Problem regarding Update-Statement on se11 table

    Hello I tried to update a dataset in a se11 table using UPDATE Statement.
    It doesn't work and I get a sy-subrc = 4.
    That is my code:
    TABLES ZTDM_SAPOUTPUT.
    * Arbeitsbereich definieren
    DATA:
    wa_ZTDM_SAPOUTPUT LIKE ZTDM_SAPOUTPUT.
    wa_ZTDM_SAPOUTPUT-PK = '1'.
    wa_ZTDM_SAPOUTPUT-FNCODE = '3'.
    wa_ZTDM_SAPOUTPUT-MATNR = '3'.
    wa_ZTDM_SAPOUTPUT-MAKTX = '3'.
    wa_ZTDM_SAPOUTPUT-ZEINR = '3'.
    wa_ZTDM_SAPOUTPUT-MATKL = '3'.
    wa_ZTDM_SAPOUTPUT-STATE = '1'.
    UPDATE ZTDM_SAPOUTPUT FROM wa_ZTDM_SAPOUTPUT.
    Write: 'UPDATE returned' , sy-subrc.
    SKIP.
    The given Dataset having PK=1 doesn't get updated.
    Maybe my understanding is wrong:
    Is it correct that the updated dataset ist defined by the primary key in this workingarea?
    My Primary Key is PK.
    Can you see the error?

    UPDATE  dbtab      FROM wa. or
    UPDATE (dbtabname) FROM wa.
    Changes one single line in a database table, using a primary key to identify the line and taking the values to be changed from the specified work area, wa. The data is read out of wa from left to right, matching the line structure of the database table dbtab. The structure of wa remains unchanged. This means that wa must be at least as wide (see DATA) as the line structure of dbtab, and have the same alignment. Otherwise, a runtime error occurs.
    If either the database table, dbtab, or the work area, wa, contain Strings, wa must be compatible with the line structure of dbtab.
    Example
    Changing the telephone number of the customer with customer number '12400177' in the current client:
    DATA   wa TYPE scustom.
    SELECT SINGLE * FROM scustom INTO wa
      WHERE id = '12400177'.
    wa-telephone = '06201/44889'.
    UPDATE scustom FROM wa.
    When the command has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1).
    Examples
    Update discount for the customer with the customer number '00017777' to 3 percent (in the current client):
    DATA: wa TYPE scustom.
    SELECT SINGLE * FROM scustom INTO wa
      WHERE id = '00017777'.
    wa-discount = '003'.
    UPDATE scustom FROM wa.
    The Return Code is set as follows:
    SY-SUBRC = 0:
    The specified line has been updated.
    SY-SUBRC = 4:
    The system could not update any line in the table, since there is no line with the specified primary key.
    rwrd if helpful
    bhupal

  • Dynamic Update Statement in Native SQL

    Hi Experts,
    I want to dynamically pass the field in Update statement in Native SQL. For eg.
    data: str1 type string.
    str1 = 'MARKETS'.
    EXEC SQL.
          UPDATE PRDT.TBVEHDS4 SET (str1) = :'U'
          WHERE  VEH_NO       =  :'K1WK-54520'
          AND    SEGMENT_NO   =  :'01'
    ENDEXEC.
    But this is not taking (str1) as MARKETS field to update as U , its taking STR1 itself, Giving native SQL exception as Invalid Token as we are using DB2 as external DB system.
    I checked with field-symbols also, but nothing helped.
    Please help, thanks in Advance.
    Regards,
    Abhishek

    Hi,
    Check this demo program in SE38  ADBC_DEMO, take as example to construct your own dynamic native sql
    Regards,
    Felipe

  • Change AUSP-ATWRT without Update statement

    Hello,
    I am looking for any kind of FM / BAPI/standard way to update AUSP-ATWRT field without using UPDATE statment. I can not use UPDATE statement in my code.
    Any help is appriciated!
    Thanks in advance

    Hi,
    So... where and how have you looked thus far..? I'm not trying to be difficult or snide here, but if I, who didn't know of the existance of AUSP some 12 minutes ago did find what I believe to be the correct BAPI by:
    1) looking at the table description to figure out what the table contains, and
    2) doing one search on SCN...
    you will too, I believe...
    cheers
    Janis

  • Update statement is not working(urgent)

    Hi,
    when i use below code it gives me dump when reocrds arem ore.
    loop at itab.
      update de1000 SET vrprs = itab-rfwrt
      where kaufn = itab-vbelv
      and mtpos IN  soption and perio =  perio and VRPRS <> 0.
    endloop.
    the structure of itab and de11000 is not same.
    please suggest me alternative.
    thanks
    jack

    I believe you can not use update statement with in loop & endloop. it will dump.
    Here is further info. Create another internal table with
    the same structure of de1000 and update the table with required values. finally use the following state
    update de1000 from table t_de1000(internal table)(check syntex)
    Reward if useful
    Message was edited by:
            Nallasamy Ponnusamy

  • UPDATE statement in Receiver JDBC adapter

    Hi all,
    I would like to use UPDATE statement in my receiver JDBC adapter and would like to know how this UPDATE statement works in following case.
    1) If i have 10 records to be updated in database, whether Commit happens at the end of all 10 records updation OR it will be for every record update?
    Regards

    Hi,
    Then let me construct my query this way...
    i have 10 records that needs to be updated to database, say For Ex: 7 records are updated successfully and 8th record has issue in updating the table.
    In this case i would like to ROLLBACK entire 10 records with out committing any thing.
    So if i use your 2nd option, it should perform as i expected right?
    Regards

  • Doubt about UPDATE STAT COLUMN

    Hi,
    I have a doubt of when to execute update stat:
    i create this SQL to generate an SQL script to generate update stat for all my tables:
    select 'UPDATE STAT ' || schemaname || '.' || tablename || ' ESTIMATE SAMPLE 20 PERCENT' from tables where schemaname = 'DBUSER' and not tablename like 'JDBC%' AND type = 'TABLE'
    and created this SQL to generate an SQL script for update stat for all columns.
    select 'UPDATE STAT COLUMN(*) FOR ' || schemaname || '.' || tablename || ' ESTIMATE SAMPLE 20 PERCENT' from tables where schemaname = 'DBUSER' and not tablename like 'JDBC%' AND type = 'TABLE'
    my doubt is i really need run that second script? or the UPDATE STAT for table dont UPDATE STAT for all columns?
    thanks for any insight
    Clóvis

    > my doubt is i really need run that second script? or the UPDATE STAT for table dont UPDATE STAT for all columns?
    Hi Clovis,
    hmm... good question.
    There are a few things to know about the UPDATE STAT command here.
    1) It will always generate statistics for key or indexed columns.
    2) The optimizer won't be able to generate a better plan when there are column statistics for non-indexed columns present.
    3) The command will also collect column statistics for all columns that already have statistics.
    The direct effect of 3) is that by running your second command just once - all column statistics will always be collected.
    Since you can easily change the default sample size for your tables via
    ALTER TABLE SAMPLE SIZE 20 PERCENT
    I would say: drop your script and just use
    UPDATE STAT DBUSER.* ESTIMATE
    This single command would lead to the same statistics as your script does.
    And if you really, really want to leave out the JDBC tables - then just set their default sample size to 0 and they will be ignored by the UPDATE STAT command.
    regards,
    Lars

Maybe you are looking for

  • Help, I can no longer send/receive images in messenger on my iphone 4

    I have noticed that I can no longer send or receive images in messenger on my phone since the first IOS 7 update.  Now i'm noticing that I can not send/receive anything other than text.  Also, I can not receive the messages that are sent to a group,

  • Kernel panic when I power down my Thunderbolt 1 drive AFTER unmounting it

    I've been using a "LaCie d2 USB 3.0/Thunderbolt 4TB" external drive since April 2014, which is connected to my late-2012 iMac via the Thunderbolt 1 port. When I'm not using the drive, I first unmount it, and then power it down at the mains. This work

  • SQL Server Express and Visual Studio 2013

    In February I installed Visual Studio 2013 Professional. Looking in the Control Panel at all my installed programs, I see that I have a bunch of SQL server-related programs loaded, from the 2013 install and also from installs of previous Visual Studi

  • Unwanted ios 8 how to remove?

    I Have a "new" iad (the three that was not the three) which is already as clunky as **** on ios 7 despite being less than two years old. I do NOT want another ios thT takes nearly half my available memory but I have an update nag that is taking up 1.

  • Drag and drop examples do not work ?!

    Hi guys, i want to add drag and drop functionality to one of my programs i tried to run the java examples of this page: http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html but it just does not work ! windows give me the "can't drop" icon w