Oracle PL/SQL Daten auswählen und in eine CSV abspeichern.

BLR

Erfahrenes Mitglied
Hallo zusammen :)

ich möchte mit "Oracle sql Developer" eine tabelle auswählen:

1. select * from tabelleA

2. Das Ergebnis als CSV speichern.

Nun gibt es einen schönen Befehl:

Code:
SELECT /*csv*/ * from tabelleA;

/*csv*/ gibt mir den Inhalt aus CSV aus.

Das möchte ich nun speichern mit dem Oracle_Element: utl_file

Leider passt da noch was nicht:

BEGIN

DECLARE
CSV_FILE utl_file.file_type;
TYPE TMP_DATA IS TABLE OF VARCHAR(300) INDEX BY BINARY_INTEGER;

CSV_FILE := utl_file.fopen( 'C:\TEMP', 'csv.txt', 'w' );

INSERT INTO TMP_DATA
SELECT /*csv*/ * from spotfire.users;

CSV_FILE.put(TMP_DATA);

END;

da kommen einige Fehlermeldungen, die mich verwirren:

Error report:
ORA-06550: Zeile 6, Spalte 12:
PLS-00103: Encountered the symbol "=" when expecting one of the following:

constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "=" to continue.
ORA-06550: Zeile 8, Spalte 3:
PLS-00103: Encountered the symbol "INSERT" when expecting one of the following:

begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
The symbol "be
ORA-06550: Zeile 14, Spalte 4:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:

( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:

Vielleicht gehe ich auch falsch heran.
Ich muss einfach alle ergebnisse einer Tabelle als CSV abspeichern.

Danke für jeden tipp.
 
Zurück