|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
The ' character in a concatenation |
« View previous topic :: View next topic » |
Author |
Message
|
krustyelpayaso |
Posted: Tue Nov 08, 2005 5:29 am Post subject: The ' character in a concatenation |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
Hello everybody,
We can supose that the value of the nom varible is: peter1
I have the next code:
SET libelle = ' AND A.BI04INFO_ID NOT IN ( ';
----
---- I build the reste of the "libelle" variable here with others values
----
SET libelle = libelle || ' )';
---- I concatenate the two variables
SET infoNom = nom || libelle;
--ESQL
SET OutputRoot.XML.infosIdFound[] = (SELECT A.BI04INFO_ID FROM Database.BI04_INFORMATION AS A WHERE A.BI04SI_ID = siId AND A.BI04TI_ID = tiId AND A.BI04CI_ID = ciId AND A.BI04KEY_SI_ID = infoNom);
I try to write a sentence like: WHERE A.BI04SI_ID = sid AND A.BI04TI_ID = tiId AND A.BI04CI_ID = ciId AND A.BI04KEY_SI_ID = 'peter1' AND A.BI04INFO_ID NOT IN (id1, id2). The trouble is i don't know how add the ' character at the nom. I try that because if the value of the variable nom, hasen't the ' character, the select don't work.
I've tried to put ''' (single, single, single), or "'" (double, single, double), or '\'' (single, slash, single, single), etc.
Do you know how i can do it?
A lot of thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 08, 2005 5:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
krustyelpayaso |
Posted: Tue Nov 08, 2005 5:53 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
I'm afraid that work with other characters (*,@,$etc), but not with the ' character. I've tried but it puts AND A.BI04KEY_SI_ID = peter1 AND A.BI04INFO_ID NOT IN (id1, id2). (peter1 without ')
Agghhh |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 08, 2005 5:54 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Can you show the exact code you use, and the exact result it produces? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
krustyelpayaso |
Posted: Tue Nov 08, 2005 6:10 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
Ok. Well, this is my code
DECLARE nbInfosFound INTEGER;
DECLARE E INTEGER 1;
DECLARE infos CHARACTER;
DECLARE libelle CHARACTER;
DECLARE reste BOOLEAN;
DECLARE aux INTEGER;
SET reste = FALSE;
SET libelle = ' AND A.BI04INFO_ID NOT IN ( ';
WHILE E <= D DO
IF (OutputRoot.XML.actualInfoId[E] IS NOT NULL) THEN
SET infos = CAST(OutputRoot.XML.actualInfoId[E] AS CHARACTER);
IF ( infos IS NOT NULL ) THEN
SET libelle = libelle || infos ;
IF ( E <> D) THEN
SET libelle = libelle || ' ,';
ELSE
SET libelle = libelle || ' ';
END IF;
SET reste = TRUE;
END IF;
END IF;
SET E = E + 1;
END WHILE;
SET libelle = libelle || ' )';
IF (reste) THEN
SET infoNom = '' || nom || '' || libelle;
ELSE
SET infoNom = '' || nom || '' ;
END IF;
SET OutputRoot.XML.infosIdFound[] = (SELECT A.BI04INFO_ID FROM Database.BI04_INFORMATION AS A WHERE A.BI04SI_ID = siId AND A.BI04TI_ID = tiId AND A.BI04CI_ID = ciId AND A.BI04KEY_SI_ID = infoNom);
I can't send you the results because it's a long process. I've have see the result with the debugger . When he make a
IF (reste) THEN
SET infoNom = '' || nom || '' || libelle;
ELSE
SET infoNom = '' || nom || '' ;
END IF;
and it go to the ELSE, it's works OK. Perfect. It haven´t the ' character and AND A.BI04INFO_ID NOT IN.... neither. But when it take the other path (SET infoNom = '' || nom || '' || libelle; ), it don't find the items, and i can certificarte than the items exists into the Oracle Database.
Thanks |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|