Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sinqle quote prefix

Status
Not open for further replies.

don2241

IS-IT--Management
Jun 1, 2001
57
AU
Hi,
I am trying to have a sinqle quote as a prefix from a select statement.

My data in the database might look like: 000123456
In my select statement I want to be able to have code that would output the above data like: '000123456

I have tried: chr(39)|| [field name] but that did not work. Any suggestions

/Martin
 
It works for me.

Is field_name numeric. It must be for concatenation. If not use chr(39) || char(field_name)

Good Luck

Brian
 
Hi
[field_name] is not numeric, it is a character field. This is the error message I get when using chr():

Warning: SQL error: [unixODBC][IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0204 - CHR in *LIBL type *N not found.,

As far as I know we should have chr() function in our libary, or might I be wrong?

I do not know if it matters but the whole query is sitting inside double quotes because the query is stored, and used, as a variable

/Martin
 
I am using version V5R2 of OS/400. That version does not appear to have the chr function. The following should work, however:

select '''' || field_name from table_name
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top