Subject | enclosing a string in quotes |
---|---|
Author | gorepj |
Post date | 2010-09-06T11:42:37Z |
Hi all,
In PSQL is there a more elegant way of enclosing a string in quotes?
e.g.
I want to create a statement dynamically that contains a string parameter.
The statement needs to look like
select locn10 from bd10p where area10 = ':AREA||'
Here's how I do it now
-----------------------------
S = 'select locn10 from bd10p where area10 = '||''''||:AREA||'''';
FOR EXECUTE STATEMENT S
INTO :LOCN
DO SUSPEND;
-----------------------------
Is there a better way?
You may ask why am I doing it this way anyway? Well, I'm evaluating FB25 where I will want to do cross database queries and, as far as I can tell, I need to do this using EXECUTE BLOCK etc.
Regards
Peter
In PSQL is there a more elegant way of enclosing a string in quotes?
e.g.
I want to create a statement dynamically that contains a string parameter.
The statement needs to look like
select locn10 from bd10p where area10 = ':AREA||'
Here's how I do it now
-----------------------------
S = 'select locn10 from bd10p where area10 = '||''''||:AREA||'''';
FOR EXECUTE STATEMENT S
INTO :LOCN
DO SUSPEND;
-----------------------------
Is there a better way?
You may ask why am I doing it this way anyway? Well, I'm evaluating FB25 where I will want to do cross database queries and, as far as I can tell, I need to do this using EXECUTE BLOCK etc.
Regards
Peter