Bonjour,
Je suis en train d'écrire un outil qui me permet de remplir ma base Oracle a partir de données exportées depuis DB2. Mon outil lit donc le fichier binaire DB2 et génère du code SQL pour remplir la base Oracle. A la suite de quoi j'exécute
Je rencontre des problème lorsqu'il s'agit d'injecter du code HTML dans des CLOB où il se plaint de quoted string not properly terminated et d'unknown command.
Code : Sélectionner tout - Visualiser dans une fenêtre à part sqlplus -S "user/passwd" <monscript.sql
J'ai donc extrait une des instructions qui posent problème et je l'ai exécutée dans sqlplus directement (sans plus de succès, ce qui est logique)
Note :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 SQL*Plus: Release 11.2.0.2.0 Production on Mer. Janv. 16 15:15:36 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. Use "connect username/password@XE" to connect to the database. SQL> connect user/passwd Connected. SQL> INSERT INTO CIMG_DEV."DP@COMMANDEINFOSOUSDOUA" VALUES (64519, ' ', 'M. UUUUUUUU Alain', 'xxxxx yyyyyy FRANCE', 'CHEZ xxxxx FRANCE DEPOT', ' ', ' ', 'FR ', ' ', 'W7026', '<html> ' || ' <head> ' || ' ' || ' </head> ' || ' <body> ' || ' <p style="margin-top: 0"> ' || ' <font size="3" face="Arial">xxxxx yyyyyy FRANCE SAS</font> ' || ' </p> ' || ' </body> ' || '</html>', '<html> ' || ' <head> ' || ' ' || ' </head> ' || ' <body> ' || ' <p style="margin-top: 0"> ' || ' <font size="3" face="Arial">xxxxx FRANCE DEPOT ' || '</font> </p> ' || ' <p style="margin-top: 0"> ' || ' <font size="3" face="Arial">4 ROUTE DE ZZZZZZZZ ' || '</font> </p> ' || ' <p style="margin-top: 0"> ' || ' <font size="3" face="Arial">45340 WWWWWW LA VVVVVVVVVV</font> ' || ' </p> ' || ' </body> ' || '</html>', 'FR000000245', ' '); 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ERROR: ORA-01756: quoted string not properly terminated SQL> SP2-0734: unknown command beginning "' || '</fo..." - rest of line ignored. SQL> SP2-0734: unknown command beginning "' || ' ..." - rest of line ignored. SQL> SP2-0734: unknown command beginning "' || ' ..." - rest of line ignored. SQL> SP2-0734: unknown command beginning "' || '</fo..." - rest of line ignored. SP2-0044: For a list of known commands enter HELP and to leave enter EXIT. SQL> SP2-0734: unknown command beginning "' || ' ..." - rest of line ignored. SQL> SP2-0734: unknown command beginning "' || ' ..." - rest of line ignored. SQL> SP2-0734: unknown command beginning "' || ' ..." - rest of line ignored. SQL> SP2-0734: unknown command beginning "' || ' </..." - rest of line ignored. SP2-0044: For a list of known commands enter HELP and to leave enter EXIT. SQL> SP2-0734: unknown command beginning "' || '</ht..." - rest of line ignored. SQL>
- il y a 2 champs CLOB contenant chacun du HTML
- je ne garantis pas que le HTML soit correct, mais ca ne devrait pas avoir d'importance
- je veux conserver mes retours à la ligne, les lignes vides et les éventuels / qui seraient tout seuls ... c'est pour ca que j'ai fait toutes ces concaténations (à cause des lignes vides)
Merci pour votre aide !
Partager