Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> INSERT command question
Hi all,
I'm copying from one 9i table to another, and populating a UID column at the same time, like this:
INSERT INTO table_1 (col1,col2,uid_column) (SELECT col1,col2,SYS_GUID() from table_2);
The system-generated UID is fine, but I need to reformat it for application reasons, so I'm taking a second pass through the table after the INSERT, like this:
UPDATE table_1 SET uid_column='UID' || SUBSTR(uid_column,1,6) || '-' SUBSTR(uid_column,7,11) || '-' || SUBSTR(uid_column,18);
What I'd like to do is reformat the UID in the INSERT command, rather than having to have a separate UPDATE command that runs afterwards. Is that possible? I appreciate that it's possible within an iterating PL/SQL block, but I'd like to do it in a single command if I can...
TIA
Nick
Received on Fri Oct 07 2005 - 08:42:24 CDT
![]() |
![]() |