Thread: UTL_FILE with parameters
05-04-12, 10:33 #1Registered User
- Join Date
- May 2012
Unanswered: UTL_FILE with parameters
The below code snippet UTL_FILE.PUT_LINE(v_file,V_TEMPA);
in the below BLOCK does not spool the data of the table but the columns instead as defined in variable V_TEMPA
I want to spool dynamically for the table. Can you let me know what change is needed? Execute immediate?
Thanks a ton
set serveroutput on
v_file := UTL_FILE.FOPEN(location => 'EXTRACT_DIR',
filename => V_TABLE_NAME||'.txt',
open_mode => 'w',
max_linesize => 32767);
FOR TAB_REC IN (SELECT TABLE_NAME
WHERE TABLE_NAME = UPPER (V_TABLE_NAME))
FOR COL_REC IN (SELECT *
WHERE TABLE_NAME = TAB_REC.TABLE_NAME
ORDER BY COLUMN_ID)
V_TEMPA := V_TEMPA || 'cur_rec2.'||COL_REC.COLUMN_NAME||'||''~''||';
V_TEMPA := SUBSTR(V_TEMPA,1, LENGTH(V_TEMPA)-7);
--V_TEMPB := 'SELECT '||V_TEMPA||' FROM '||TAB_REC.TABLE_NAME;
FOR cur_rec2 IN (SELECT * FROM emp)
05-04-12, 10:50 #2Registered User
Provided Answers: 1
- Join Date
- Aug 2003
- Where the Surf Meets the Turf @Del Mar, CA
>I want to spool dynamically for the table
I do not understand this statement.
I do not know what procedure does now.
I do not understand what the procedure should do differently.You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Good judgement comes from experience. Experience comes from bad judgement.