+ Reply to Thread
Results 1 to 3 of 3

inserted values to be structured in the specified format

  1. 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.



  2. 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.

  3. 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
  4. 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