Reputation: 301
I have table as Table1 (this table has various data types)
ID Name Price Date
123 James 0.9832 04/01/2015
345 Jacob 0.23412 05/01/2015
I want to create table Table2 having all data types as char and single quotes around it in the table
Required: Table2
ID Name Price Date
'123' 'James' '0.9832' '04/01/2015'
'345' 'Jacob' '0.23412' '05/01/2015'
so, when I extract data as .txt file it should be look like
ID,Name,Price,Date
'123','James','0.9832','04/01/2015'
'345','Jacob','0.23412','05/01/2015'
Upvotes: 0
Views: 33
Reputation: 4551
Best way to is create a view using this syntax
CREATE VIEW TEXT_EXPORT as
SELECT ''''||ID||'''' AS "ID",''''||Name||''''AS "NAME",''''||Price||''''AS "PRICE",''''||Date||'''' AS "DATE"
FROM TABLE1;
I agree there are better ways to export text than this. And using Oracle keywords as column names will hurt.
Upvotes: 2