Home » SQL & PL/SQL » SQL & PL/SQL » how to export the data from table to the file (oracle 11g)
how to export the data from table to the file [message #652827] Mon, 20 June 2016 10:53 Go to next message
tolupuluri
Messages: 21
Registered: May 2016
Junior Member
Hi,

I would like to export the data from table to the file using stored procedure.
But the data to be in the fixed position in the output file.
Is there any way to resolve this.
Re: how to export the data from table to the file [message #652828 is a reply to message #652827] Mon, 20 June 2016 11:32 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
tolupuluri wrote on Mon, 20 June 2016 08:53
Hi,

I would like to export the data from table to the file using stored procedure.
But the data to be in the fixed position in the output file.
Is there any way to resolve this.

Yes, write the code to do what you desire.

post CREATE TABLE statement for the table to be exported.
Re: how to export the data from table to the file [message #652829 is a reply to message #652827] Mon, 20 June 2016 11:58 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

As this is YOU who writes the records into the file in your PL/SQL procedure, you can do it in the format you want.

Re: how to export the data from table to the file [message #652838 is a reply to message #652827] Mon, 20 June 2016 15:25 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9077
Registered: November 2002
Location: California, USA
Senior Member
You can spool it to a file or, if you want to use a procedure, you can use utl_file. You can use the rpad and lpad functions to achieve fixed lengths of data.
Re: how to export the data from table to the file [message #652839 is a reply to message #652838] Mon, 20 June 2016 15:31 Go to previous message
tolupuluri
Messages: 21
Registered: May 2016
Junior Member
Yes Barbara,

I tried using Lpad and Rpad is working fine for the current situation.
Thank you.
Previous Topic: Aggregate based on serial number after checking for thresholds
Next Topic: SQL to filter redundant key field
Goto Forum:
  


Current Time: Thu Mar 28 18:48:05 CDT 2024