✍ Kashif M ™
☎ +91 9994883085
✉ kashif7222@gmail.com

Trends

Saturday, 14 October 2017


Insert into column from same table in Oracle


By on October 14, 2017



In many case we are suppose to add one additonal column in our table and insert data from another column from same table.



In my case, I want to add month column which store only month and year in yyyymm format






ALTER TABLE ebiz1
ADD mont column_type NULL

Insert into column from same table in Oracle
Insert into column from same table in Oracle

From the above syntax we will get additonal column in my table ebiz1. After the column is created I need to use UPDATE Statement as below.

UPDATE ebiz1 SET
mont= to_number(to_char(gl_date, 'yyyymm'))


From the Above statement I just copy gl_date column data into month column in yyyymm format

Kashif
mkashu: Insert into column from same table in Oracle
Review : Kashif | Kashif
Update: October 14, 2017 | Rating: 4.5

Comment for "Insert into column from same table in Oracle"

0 comments

Post a Comment

Blog Archive

Labels