473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Single Quote

I am trying to construct this query in a function:

SELECT CONCAT('SEQ=',CHAR(NEXTVAL FOR MYSCHEMA.LOAD_ID)) FROM
SYSIBM.SYSDUMMY1

Here is what I use to construct it but I am unable to get the single
quotes for SEQ. How do I get them?

set vsql = 'SELECT CONCAT(' || 'SEQ' || ',CHAR(NEXTVAL FOR MYSCHEMA.' ||
SEQNAME || ')) FROM SYSIBM.SYSDUMMY1';

Cheers,
San.

Jun 29 '06 #1
2 5710
This will work:

set vsql = 'SELECT CONCAT(''SEQ='',CHAR(NEXTVAL FOR MYSCHEMA.LOAD_ID))
FROM SYSIBM.SYSDUMMY1'

U need to 'escape' the single quote by another single quote. and so a
single quote should be ''
shsandeep wrote:
I am trying to construct this query in a function:

SELECT CONCAT('SEQ=',CHAR(NEXTVAL FOR MYSCHEMA.LOAD_ID)) FROM
SYSIBM.SYSDUMMY1

Here is what I use to construct it but I am unable to get the single
quotes for SEQ. How do I get them?

set vsql = 'SELECT CONCAT(' || 'SEQ' || ',CHAR(NEXTVAL FOR MYSCHEMA.' ||
SEQNAME || ')) FROM SYSIBM.SYSDUMMY1';

Cheers,
San.


Jun 29 '06 #2
On Thu, 29 Jun 2006 06:34:22 UTC "shsandeep" <sa**********@gmail.com>
wrote:
I am trying to construct this query in a function:

SELECT CONCAT('SEQ=',CHAR(NEXTVAL FOR MYSCHEMA.LOAD_ID)) FROM
SYSIBM.SYSDUMMY1

Here is what I use to construct it but I am unable to get the single
quotes for SEQ. How do I get them?

set vsql = 'SELECT CONCAT(' || 'SEQ' || ',CHAR(NEXTVAL FOR MYSCHEMA.' ||
SEQNAME || ')) FROM SYSIBM.SYSDUMMY1';

Cheers,
San.


Try:

set vsql = 'SELECT CONCAT(' || 'SEQ' || ''',CHAR(NEXTVAL FOR
MYSCHEMA.' || SEQNAME || ''')) FROM SYSIBM.SYSDUMMY1';

Basically, you have to escape the ' character to get the literal.

--
Will Honea
Jun 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: sankofa | last post by:
hi, i can't seem to be able to escape my single quote properly... is it even possible in javascript? this is a portion of my code.. var DLEWIS="Pastor Lewis"; .... Sermon is a yser-defined...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
3
by: Jason | last post by:
I have several tables with quite a few fields and I'm getting errors when trying to insert records with single quotes in the data like: name = John O'Henry or a city name of O'Fallen So I went...
11
by: Elmo | last post by:
Hi all! I am not very proud to ask this but here is my problem: string code = "\'13\'" The string code will have to contain following info: '51','52','63','other'... to get certain info...
13
by: JohnQ | last post by:
Why would anyone write: class SomeThing // class littered with non-domain single-instancing code :( { private: SomeThing(); static SomeThing* pInstance_; public: static SomeThing*...
3
by: Eric Layman | last post by:
Hi, I've saved data into the db by doing a replace() on single quote. Right now on data display on a datagrid, it shows double single quote. How do I make changes during run time of datagrid...
8
by: Grant Edwards | last post by:
I'm pretty sure the answer is "no", but before I give up on the idea, I thought I'd ask... Is there any way to do single-precision floating point calculations in Python? I know the various...
4
by: fniles | last post by:
I am looping thru DataReader and constructing a sql query to insert to another database. When the data type of the field is string I insert the field value using a single quote. When the value of...
2
by: Reporter | last post by:
I got the following example from http://www.evolt.org/article/User_Friendly_Forms_in_PHP/20/60144/index.html : echo '<tr><td>First name:</td><td><input type="text" name="first_name"...
0
by: dhascuba | last post by:
The @name field can contain a single quote in it such as: Mike O'Grady. Since this is creating and SQL statement on the server side, it will not process the name if it has a single quote in it. Id'...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.