How to export XML file in CLOB column using Oracle SQL - sql

I have an XML file in a CLOB column, which is present in an Oracle table. I would like to export the XML file into LINUX landing directory which will be done through Informatica. Can you help me out in how to do this. Please share your thoughts.Thank you.

Use SQL Developer ( I used version 3.2.20.09 )
http:/WWW.Oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
Select Export from the right hand context menu
Context Menu
Select the Export Data checkbox
Select Loader from the Format dropdown
Select Separate Files from the Save as dropdown
Enter the name of a directory
Click Next
Click Finish
Export Dialog
It exports the data to separate files but at least it's in clear text.

Is the file stored in cleartext in one of the fiels i.e. not binary or something?
If so then pick the field up in your source qualifier and parse it to a flat file made up of one port e.g. file_in .
If not, could you elaborate the error you are receiving in your current job and describe how the job works?

Related

convert text file to Excel sheet using SSDT

I have requirement where I need to convert text file to Excel Sheet using SSDT.
I have idea how to do like I
Step 1. have to upload data to sql server any table
and then Step 2. from Sql Server to Excel Spread sheet.
But I would like to do it in only one step that is Convert Directly from Text file to Excel Sheet without sending it to the table in Sql server using SSDT. Is there any way that I could do in one Step. Thank you in advance.
If i am understanding your question correctly, it is possible to use the import data wizard in SSMS to convert a text file to an excel file. You can save the wizard as an SSIS package also if you need to do the conversion programatically.
right click on any database in your server, hover over 'tasks' and select 'import data...'
in 'data source' drop down, select 'flat file source'. click next.
browse to the file you want to import. you can preview your flat file from here to make sure its rows and columns have been detected correctly. click next.
in 'destination' drop down, select 'microsoft excel'. browse to the destination folder and name your file. click next.
here you can rename columns and preview the end result. click next.
map your data types and determine if you want the package to fail if you encounter an error. click next.
here you can choose to save as an SSIS package or just run one time. you can now click through the rest depending on your choice to finish the sequence.
This is a very brief overview. for more detailed information, you can go here: https://learn.microsoft.com/en-us/sql/integration-services/import-export-data/import-and-export-data-with-the-sql-server-import-and-export-wizard?view=sql-server-2017
I hope this helps.

SQL Server - Copying data between tables where the Servers cannot be connected

We want some of our customers to be able to export some data into a file and then we have a job that imports that into a blank copy of a database at our location. Note: a DBA would not be involved. This would be a function within our application.
We can ignore table schema differences - they will match. We have different tables to deal with.
So on the customer side the function would ran somethiug like:
insert into myspecialstoragetable select * from source_table
insert into myspecialstoragetable select * from source_table_2
insert into myspecialstoragetable select * from source_table_3
I then run a select * from myspecialstoragetable and get a .sql file they can then ship to me which we can then use some job/sql script to import into our copy of the db.
I'm thinking we can use XML somehow, but I'm a little lost.
Thanks
Have you looked at the bulk copy utility bcp? You can wrap it with your own program to make it easier for less sophisticated users.
Since it is a function within your application, in what language is the application front-end written ? If it is .NET, you can use Data Transformation Services in SQL Server to do a sample export. In the last step, you could save the steps into a VB/.NET module. If necessary, modify this file to change table names etc. Integrate this DTS module into your application. While doing the sample export, export it to a suitable format such as .CSV, .Excel etc, whichever format from which you will be able to import into a blank database.
Every time the user wants do an export, he will have to click on a button that would invoke the DTS module integrated into your application, that will dump the data to the desired format. He can mail such file to you.
If your application is not written in .NET, in whichever language it is written, it will have options to read data from SQL Server and dump them to a .CSV or text file with delimiters. If it is a primitive language, you may have to do it by concatenating the fields of every record, by looping through the records and writing to a file.
XML would be too far-fetched for this, though it's not impossible. At your end, you should have the ability to parse the XML file and import it into your location. Also, XML is not really suited if the no. of records are too large.
You probably think of a .sql file, as in MySql. In SQL Server, .sql files, that are generated by the 'Generate Scripts' function of SQL Server's interface, are used for table structures/DDL rather than the generation of the insert statements for each of the record's hard values.

Access SQL, importing txt files, delimitation

I have a question regarding Access queries. The below query will import data from a txt file into a new table. I have tested it, and it delimits by comma. Is there any way to change the delimitation character?
SELECT * INTO NewTable
FROM [Text;HDR=Yes;FMT=Delimited;Database=C:\Docs].Test.csv
Is there any way to change the delimitation character?
Yes. You can use a schema.ini file:
"When the Text driver is used, the format of the text file is determined by using a schema information file. The schema information file is always named Schema.ini and always kept in the same directory as the text data source. The schema information file provides the IISAM with information about the general format of the file, the column name and data type information, and several other data characteristics."
For the complete story see
Schema.ini File (Text File Driver)

Import SQL records from file into sql DB and changing type

I created a .txt file using BULK that contains all the records of a sql DB. Now I need to import these records into a new DB. The problem is that I need to change the type of some fields from DOUBLE to BIGINT or the records won't be added to the new DB.
Please, wich functions and how do I have to use them?
Thanks
Importing into SQL Server, you can right-click on the database and select Tasks > Import Data. This will open up the Import/Export Wizard which is a slimmed down version of the same functionality in SSIS.
Once the Wizard is open, you can navigate the through the prompts and eventually get to a screen, Select Source Data, where you can click on the Edit Mappings button and modify the data types of the data being imported.

How to export data with Oracle SQL Developer?

How to export Oracle DB data using SQL Developer? I need all data, tables, constraints, structure and so on.
In SQL Developer, from the top menu choose Tools > Data Export. This launches the Data Export wizard. It's pretty straightforward from there.
There is a tutorial on the OTN site. Find it here.
In version 3, they changed "export" to "unload". It still functions more or less the same.
If, at some point, you only need to export a single result set, just right click "on the data" (any column of any row) there you will find an export option.
The wizard exports the complete result set regardless of what you selected
To export data you need to right click on your results and select export data, after which you will be asked for a specific file format such as insert, loader, or text etc. After selecting this browse your directory and select the export destination.