Insert record in table using select statemet...
I want to insert a record as like a same record already exists in table only a couple of field values different.
The following insert works fine in SQL server2k5.
Insert into pmuser
(HGROUP, UNAME, DTPASS, SCODE, SSOURCE, sEmail, bCollapseSideMenu)
Select HGROUP, 'Veer11', DTPASS, 'Veer11', SSOURCE, sEmail, bCollapseSideMenu
Where UniqueID = '99'
Kindly help to make this Insert work with ORACLE.
Should work 'as is' in Oracle
Except maybe the table name from the query is not the same as for the insert?
Otherwise as it is written it may cause duplicate key exception on UniqueID = '99'.
Last edited by LKBrwn_DBA; 05-07-2008 at 10:20 AM.
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
Assuming you are referencing all columns in your table you can do...
You can also research Oracle documentation, it's free!
select HGROUP, 'Veer11', DTPASS, 'Veer11', SSOURCE, sEmail, bCollapseSideMenu
where UniqueID = '99'
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Click Here to Expand Forum to Full Width