-
inserted values to be structured in the specified format
Here is a table structure :
Column Type Type
name schema name Length Scale Nulls
EMPNO SYSIBM INTEGER 4 0 Yes
ENAME SYSIBM CHARACTER 20 0 Yes
CNTY_VISITED SYSIBM CHARACTER 100 0 Yes
Now goes the prob.....
I want to insert a row in the table such that the data in the table shud look as :
EMPNO ENAME CNTY_VISITED
1001 JACK 'IND','JPN'
I guess you understood the req. It should not be IND,JPN.. It should be ' IND ' , ' JPN '
in the table.
-
Re: inserted values to be structured in the specified format
> Here is a table structure :
>
> Column Type Type
> name schema name Length
> Scale Nulls
>
> EMPNO SYSIBM INTEGER 4
> 0 Yes
>
> ENAME SYSIBM CHARACTER 20
> 0 Yes
>
> CNTY_VISITED SYSIBM CHARACTER 100
> 0 Yes
>
> Now goes the prob.....
>
> I want to insert a row in the table such that the
> data in the table shud look as :
>
> EMPNO ENAME CNTY_VISITED
> 1001 JACK 'IND','JPN'
>
> I guess you understood the req. It should not be
> IND,JPN.. It should be ' IND ' , ' JPN '
> in the table.
>
Hi,
if your problem is to insert a single quotation mark character (') into a column in a DB2 table, then you could simply double that character in your insert statement like so:
INSERT INTO VALUES (1001, 'JACK', '''IND'',''JPN''')
Good luck
aka.
-
Re: inserted values to be structured in the specified format
Andreas Kannegiesser wrote:
>> Here is a table structure :
>>
>> Column Type Type
>> name schema name Length
>> Scale Nulls
>>
>> EMPNO SYSIBM INTEGER 4
>> 0 Yes
>>
>> ENAME SYSIBM CHARACTER 20
>> 0 Yes
>>
>> CNTY_VISITED SYSIBM CHARACTER 100
>> 0 Yes
>>
>> Now goes the prob.....
>>
>> I want to insert a row in the table such that the
>> data in the table shud look as :
>>
>> EMPNO ENAME CNTY_VISITED
>> 1001 JACK 'IND','JPN'
>>
>> I guess you understood the req. It should not be
>> IND,JPN.. It should be ' IND ' , ' JPN '
>> in the table.
>>
>
>
> Hi,
>
> if your problem is to insert a single quotation mark character (') into a
> column in a DB2 table, then you could simply double that character in your
> insert statement like so:
>
> INSERT INTO VALUES (1001, 'JACK', '''IND'',''JPN''')
And if you do this from an application, just use parameter markers (good
against SQL-injection problems). Then the string can contain a single-quote
and you don't need to escape it by doubling it.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany