SELECT 'LOAD DATA'
|| CHR (10)
|| 'INFILE '''
|| LOWER (table_name)
|| '.dat'''
|| CHR (10)
|| '<APPEND/REPLACE/TRUNCATE>'
|| CHR (10)
|| 'INTO TABLE '
|| table_name
|| CHR (10)
|| 'FIELDS TERMINATED BY '','''
|| CHR (10)
|| 'TRAILING NULLCOLS'
|| CHR (10)
|| '('
FROM all_tables
WHERE table_name = UPPER ('&1');
SELECT DECODE (ROWNUM, 1, ' ', ' , ')
|| RPAD (column_name, 33, ' ')
|| DECODE (data_type
, 'VARCHAR2', 'CHAR NULLIF (' || column_name || '=BLANKS)'
, 'FLOAT', 'DECIMAL EXTERNAL NULLIF(' || column_name || '=BLANKS)'
, 'NUMBER', DECODE (data_precision
, 0, 'INTEGER EXTERNAL NULLIF (' || column_name || '=BLANKS)'
, DECODE (data_scale
, 0, 'INTEGER EXTERNAL NULLIF (' || column_name || '=BLANKS)'
, 'DECIMAL EXTERNAL NULLIF (' || column_name || '=BLANKS)'
)
)
, 'DATE', 'DATE "MM/DD/YY" NULLIF (' || column_name || '=BLANKS)'
, NULL
)
FROM user_tab_columns
WHERE table_name = UPPER ('&1')
ORDER BY column_id;
SELECT ')'
FROM SYS.DUAL;
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.