Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 7 Monaten, 4 Wochen
Letzter Beitrag:
vor 7 Monaten, 4 Wochen
Beteiligte Autoren:
Mike James, kingdr, Fabrice Harari, Markus K., Vinit Sawant


Startbeitrag von Vinit Sawant am 23.11.2017 07:52

We have WINDEV application. In that we are having one button.
But when we click on the button we are getting following error:

Le champ 'Table_sousComposantsPossibles' n'a pas pu s'initialiser, car il a rencontré l'erreur Hyper File suivante :
Erreur dans le code SQL de la requête . Initialisation de la requête impossible.
Mot %% inattendu

Informations techniques

Projet : Adage

Dump de l'erreur du module .

- Niveau : erreur fatale (EL_FATAL)

SQL code is:
SELECT C1.Code_Composant AS Code_Composant,
C1.Nom_Site AS Nom_Site,
C1.Base AS Base,
C1.description AS description,
C1.Reference_Plan AS Reference_Plan,
C1.Indice_Plan AS Indice_Plan,
C1.Id_Contrainte AS Id_Contrainte,
C1.Cfig AS Cfig,
C1.Unite_Quantite AS Unite_Quantite,
C1.type AS type,
ADAGE_S_Composants C1
C1.Nom_Site = {p_Site}

AND C1.Code_Composant {p_CodeComposantPere}
AND C1.Code_Composant LIKE %{pComposant}%
AND C1.description LIKE %{pDescription}%

-- on n'autorise pas l'insertion d'un frère
AND C1.Code_Composant NOT IN
(SELECT COR.Nom_Composant_Fils
FROM ADAGE_S_Correspondance_Operations_CompFils COR
WHERE COR.Nom_Composant_Operation_Mere={p_CodeComposantPere}
AND COR.Nom_Site_Operation_Mere = {p_Site}
AND COR.Nom_Site_Composant_Fils = {p_Site}
AND COR.Numero_Ordre_Operation_Mere = {p_OrdreOperation})

-- on n'autorise pas l'insertion d'un ancêtre (vérif sur 1 génération, on ne vérifie pas plus loin)
C1.Code_Composant NOT IN
(SELECT COR2.Nom_Composant_Operation_Mere
FROM ADAGE_S_Correspondance_Operations_CompFils COR2
WHERE COR2.Nom_Composant_Fils={p_CodeComposantPere}
AND COR2.Nom_Site_Operation_Mere = {p_Site}
AND COR2.Nom_Site_Composant_Fils = {p_Site})


According to the error, % is unexpected.
I removed % but still code is not working.
Does anyone have any idea about this?
How to fix this issue?
Thanks in advance


just copy the statement, insert it in the hfsql control center, replace the variables by valid values and execute the statement. This way it is much easier to see where the error comes from.

von Markus K. - am 23.11.2017 08:04

the error message says that you have an unexpected '%%' in your query

The only way I see that you can have that is if you forget to fill one of the parameters that is between 2 %.

However, as you are not showing us the code that is calling the query, there is no way to verify that

Best regards

von Fabrice Harari - am 23.11.2017 10:25
I'm seeing the same message when I leave a report filter blank (deliberately). In other reports of mine, when the filter is empty (null?) the entire clause is ignored, but possibly this doesn't happen when using the LIKE operator.

von Mike James - am 23.11.2017 20:09
I think it is a syntax error in LIKE, you may have
LIKE '%my description%'
LIKE '%' + "myDescription" + '%'

sDescription is string = "myDesc"

LIKE '%' + sDescription + '%'

ie single quote is needed for beginning and end and watch out if you have
single to inside sDescription also.



von kingdr - am 23.11.2017 21:28
Kingdr: when using Reports & Queries (query editor), the query does not require quotes around parameters. That's to say, when the report is run, if quotes have been added, an error will occur.

However, if you want to test the query in query editor, the quotes are required. So I end up putting them in, testing the query, then removing them to test/develop the report.

von Mike James - am 23.11.2017 22:00
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.