Home » SQL & PL/SQL » SQL & PL/SQL » Database script for Insert statements (oracle10g, 10.2.0.2.0, aix53)
Database script for Insert statements [message #423171] Tue, 22 September 2009 07:07 Go to next message
chandu_imax
Messages: 46
Registered: May 2008
Location: Hyderabad
Member
Hi All,

Actually i have one table XYZ with 100 rows. I want the insert statements for that rows.

For example :
SQL> select * from XYZ;

col1 col2 col3
------------------ ------------------ -----------------
abcdegsts xsadfsdfddfdf fdsfh gdf
dvjhjddjd dfdsfdfdfsdsdf dskfhgfsd

2 rows selected.

now i require insert statements for these rows like

INSERT INTO XYZ values('abcdegsts','xsadfsdfddfdf','fdsfh gdf');
INSERT INTO XYZ values ('dvjhjddjd','dfdsfdfdfsdsdf','dskfhgfsd');

Like this i require for all the 100 statements. Please help me in this.

Thank you...
Re: Database script for Insert statements [message #423173 is a reply to message #423171] Tue, 22 September 2009 07:11 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Write something like
SELECT 'INSERT INTO XYZ (col_1,col_2) ('''||col_1||''','''||col_2||''');'
FROM XYZ;
Re: Database script for Insert statements [message #423176 is a reply to message #423171] Tue, 22 September 2009 07:31 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
From your previous topic:
Michel Cadot wrote on Mon, 21 September 2009 14:15
...
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.
...

Your answer:
chandu_imax wrote on Tue, 22 September 2009 08:14
...
Thank you Michel. I will follow the instructions from now onwards.
...

Conclusion?

Regards
Michel


Previous Topic: Update an unprocessed record exclusively
Next Topic: trigger problem
Goto Forum:
  


Current Time: Wed Feb 19 15:54:27 CST 2025