I am building DWH where in source data dump is made through SELECT *
query into DB. I am taking dump from the source DB, to save time (else had to write 115 select stmt using TRIM
where average number of filed per table is 150) I used SELECT * FROM TABLE
query to get the dump post which I am executing SED command to remove spaces from the fields.
This is taking a huge time & space as first SELECT
query dumps the table and sed
trims the Spaces. I have written a BJ to download the files & conversion.
There is space constraint in my server and I cannot mount extra space.
I am looking forward for inputs/tools/package/procedure on how can still use SELECT *
but there are no spaces in the fields and I can avoid using sed
command in UNIX.
Best Answer
If I understand you correctly, this PL/SQL will do the job for you:
Make sure you
set serveroutput on
to get the output fromDBMS_OUTPUT
.Change the query in the
CURSOR
to alter the table list it generates queries for.Note: Doesn't do anything for 'CLOB'/'BLOB' columns.
Example output:
Another thing to mention; You're going to be limited to the 4000 character limit, but will be OK unless you have tables with hundreds of columns.