Friday, March 02, 2007

Update Value in Database Table Oracle or Sybase

Here is the syntax to update a database table. Again, this is a fairly straightforward task. In this example, we are changing two values where CUST_ID = 10001.

ORACLE
SQL> update CUSTOMER set CUST_SSN_ID = '111-11-1234', CUST_TITLE = 'Gen Mgr' where CUST_ID = 10001;

SYBASE
1> update CUSTOMER set CUST_SSN_ID = '111-11-1234', CUST_TITLE = 'Gen Mgr' where CUST_ID = 10001
2> go

The ";" is the execute command for Oracle and "go" is the execute command for Sybase.

Update (No pun intended): I had a few folks ask me about MySQL syntax.

UPDATE people SET CUST_SSN_ID = "111-11-1234", CUST_TITLE= "Gen Mgr" WHERE CUST_ID = 10001

No comments: