Bonjour ,
J'ai un niveau tres tres moyen sur ORACLE.Je dois générer un document xml à partir d'une base de données , et je dispose de très peu de temps.
j'ai créée une table XML avec du contenu xml.
Dans cette table DATA_XML,j'ai stocké une ligne xml.Comment copier la ligne xml de la table vers un document xml (Mon_Fichier.xml) en SQL (ou pl-sql), et comment récupérer le fichier généré.MERCI
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 CREATE TABLE DATA_XML ( document xmltype ) xmltype document store as clob;
En me documentant , je suis tombé sur un package XMLDOM , et j'ai essayé le pl-sql suivant.
Voici l'erreur générée ;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 CREATE OR REPLACE directory Mon_Rep AS 'C:\temp'; DECLARE doc DBMS_XMLDOM.DOMDocument; xdata XMLTYPE; CURSOR xmlcur IS SELECT * from global_referentiel_xml BEGIN OPEN xmlcur; FETCH xmlcur INTO xdata; CLOSE xmlcur; doc := DBMS_XMLDOM.NewDOMDocument(xdata); DBMS_XMLDOM.WRITETOFILE(doc,'Mon_Rep/referentiel.xml'); END;
"Erreur commençant à la ligne 2 de la commande :
CREATE OR REPLACE directory Mon_Rep AS 'C:\temp'
Erreur à la ligne de commande : 2, colonne : 0
Rapport d'erreur :
Erreur SQL : ORA-01031: privilèges insuffisants
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
if the user was granted the necessary privilege at a higher label
than the current login.
*Action: Ask the database administrator to perform the operation or grant
the required privileges.
For Trusted Oracle users getting this error although granted the
the appropriate privilege at a higher label, ask the database
administrator to regrant the privilege at the appropriate label.
Erreur commençant à la ligne 3 de la commande :
DECLARE
doc DBMS_XMLDOM.DOMDocument;
xdata XMLTYPE;
CURSOR xmlcur IS
SELECT * from global_referentiel_xml
BEGIN
OPEN xmlcur;
FETCH xmlcur INTO xdata;
CLOSE xmlcur;
doc := DBMS_XMLDOM.NewDOMDocument(xdata);
DBMS_XMLDOM.WRITETOFILE(doc,'Mon_Rep/referentiel.xml');
END;
Rapport d'erreur :
ORA-06550: Ligne 8, colonne 5 :
PL/SQL: ORA-00933: la commande SQL ne se termine pas correctement
ORA-06550: Ligne 6, colonne 5 :
PL/SQL: SQL Statement ignored
ORA-06550: Ligne 9, colonne 5 :
PLS-00103: Symbole "FETCH" rencontré à la place d'un des symboles suivants :
begin function pragma procedure subtype type <identificateur>
<identificateur entre guillemets> current cursor delete
exists prior
Symbole "begin" a été substitué à "FETCH" pour continuer.
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action: "
Partager