Raptor
A reader, January 20, 2006 - 1:44 pm UTC
The Raptor early adoptor release can export INSERT statements.
Right click the table, Export->SQL Insert will generate insert statements into a file.
I don't know if I can incorporate it in a script though.
January 20, 2006 - 2:47 pm UTC
neat, learned two things today :)
that makes it a good day.
How to pass the dbms_sql.column_value(my_Cursor, 1, col_value ) as a varchar2 parameter?
Jenny, January 25, 2006 - 1:16 pm UTC
Hi Tom,
The dump_table_to_csv() works very well. now I wrote a procedure dump_all_tables()to dump all contents of user_tables into a sql file. but I got errors as the following:
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected NUMBER got SYS.AQ$_SUBSCRIBERS
ORA-06512: at "SYSTEM.DUMP_TABLE_TO_CSV", line 62
ORA-06512: at "SYSTEM.DUMP_ALL_TABLES", line 23
ORA-06512: at line 1
bellow is my procedure:
create or replace procedure dump_all_tables(p_dir in varchar2,
p_filename in varchar2)
is
my_Cursor integer default dbms_sql.open_cursor;
my_query varchar2(1000)
default 'select table_name from user_tables ';
col_count number := 0;
col_value varchar2(30);
my_status integer;
table_name varchar2(30);
my_descTbl dbms_sql.desc_tab;
begin
dbms_sql.parse( my_Cursor, my_query, dbms_sql.native );
dbms_sql.describe_columns(my_Cursor, col_count, my_descTbl );
dbms_sql.define_column(my_Cursor, 1, col_value, 4000 );
my_status := dbms_sql.execute(my_Cursor);
while(dbms_sql.fetch_rows(my_Cursor)> 0)
loop
dbms_sql.column_value(my_Cursor, 1, col_value );
table_name := to_char(col_value);
dump_table_to_csv(table_name, p_dir,p_filename );
end loop;
end;
/
Please guide me why I can not pass the col_value as a varchar2 parameter when calling dump_table_to_csv()?
How can I do to make it works?
Thanks for your time.
Jenny
January 25, 2006 - 4:33 pm UTC
the problem is, dump csv works only with "basic" datatypes - strings, numbers, dates, raws (which will be in HEX).
complex object types - you cannot do that with dbms_sql.