Home » RDBMS Server » Server Utilities » update statement
update statement [message #71616] Tue, 03 December 2002 14:42 Go to next message
Arpit
Messages: 99
Registered: March 2001
Member
Hello All,

I've two columns (product_no & maintenance_level)in my product table.

Product_No has values and Maintenance_Level is a brand new column which I need to populate it with a value "P" or "S" from Product_No column.

The Product_No column has product nos. with a character "P" in the middle of the product_no or at the end (-P or -S). How can i find it and do an insert.

For eg:-

Product_No Maintenance_Level
---------- -------------------
MFLPINTSIF P
MFLPCOGO P
M-GISAI-P S
M-GISSPAC-S S

How will be my update statement?

Any help on this would be highly appreciated.

Thanks!
Re: update statement [message #71631 is a reply to message #71616] Fri, 06 December 2002 02:08 Go to previous message
Azim Bhanji
Messages: 2
Registered: December 2002
Junior Member
If the P's and S's are always at the 5 position.
Try this in your update statement.

Update tabelname
set Maintenance_Level = substr(Product_No,5,1);

5 is the position of the P's and S's, and 1 is the number of characters.

I hope this works.

Azim
Previous Topic: Re: DBMS_standard
Next Topic: several hosts to sqlplus with only one connection??
Goto Forum:
  


Current Time: Mon Dec 23 17:22:49 CST 2024