Results 1 to 6 of 6

Thread: SQL0102N Error

  1. #1
    Join Date
    Jun 2003
    Posts
    5

    Unanswered: SQL0102N Error

    Hi, I encountered the following error when I run a SQL command from Command Centre of DB2.

    The error is:
    ------------------------------ Command Entered ------------------------------
    select 'insert into CM_ACCT_DTL (ACCT_SYS_NUM,ACCT_NAM,ACCT_TYP_CD,ACCT_NUM,CTRY_C D,OFI_TEL_NO,HP_PGR_NO,FAX_NO,EMAIL_ADDR_TXT,SEX_C D,ADDR_ERR_CD,ADDR_SRC_CD,ADDR_TYP_CD,BLK_HSE_NO,S TREET_NAM,FLR_NO,UNIT_NO,BLDG_NAM,POSTAL_CD,CHECK_ IND,ADDR_EFF_DT,CREATE_USR_NUM,CREATE_DTTM,LAST_UP D_USR_NUM,LAST_UPD_DTTM,VERSION_CNT) values (''' || ltrim(rtrim(ACCT_SYS_NUM)) || ''',''' || ltrim(rtrim(ACCT_NAM)) || ''',''' || ltrim(rtrim(ACCT_TYP_CD)) || ''',''' || ltrim(rtrim(ACCT_NUM)) || ''',''' || ltrim(rtrim(CTRY_CD)) || ''',''' || ltrim(rtrim(OFI_TEL_NO)) || ''',''' || ltrim(rtrim(HP_PGR_NO)) || ''',''' || ltrim(rtrim(FAX_NO)) || ''',''' || ltrim(rtrim(EMAIL_ADDR_TXT)) || ''',''' || ltrim(rtrim(SEX_CD)) || ''',''' || ltrim(rtrim(ADDR_ERR_CD)) || ''',''' || ltrim(rtrim(ADDR_SRC_CD)) || ''',''' || ltrim(rtrim(ADDR_TYP_CD)) || ''',''' || ltrim(rtrim(BLK_HSE_NO)) || ''',''' || ltrim(rtrim(STREET_NAM)) || ''',''' || ltrim(rtrim(FLR_NO)) || ''',''' || ltrim(rtrim(UNIT_NO)) || ''',''' || ltrim(rtrim(BLDG_NAM)) || ''',''' || ltrim(rtrim(POSTAL_CD)) || ''',''' || ltrim(rtrim(CHECK_IND)) || ''',''' || ltrim(rtrim(ADDR_EFF_DT)) || ''',''' || ltrim(rtrim(CREATE_USR_NUM)) || ''',' || varchar(CREATE_DTTM) || ',''' || ltrim(rtrim(LAST_UPD_USR_NUM)) || ''',' || varchar(LAST_UPD_DTTM) || ',' || varchar(VERSION_CNT) || ')' from CM_ACCT_DTL ;
    -----------------------------------------------------------------------------
    SQL0102N The string constant beginning with "insert int" is too long. SQLSTATE=54002

    Can someone help me please? Any help is appreciated. Thanks in advance.

  2. #2
    Join Date
    Jan 2003
    Posts
    1,605

    Re: SQL0102N Error

    Hi,

    I don't understant what would you like to do? Do you want to do select or insert? I think that above SQL has some sintax problem. Not sure. What would you like to do?

    Grofaty

  3. #3
    Join Date
    Mar 2003
    Posts
    343
    I agree with Grofaty. I don't think you can use select and insert in the same statement in the manner that it has been used it. You could do a insert into select ...from ... but I'm not sure that the select (insert ... into..) syntax is valid.

    Also, you're inserting into the same table that you're trying to select from. It would help to know what you are attempting to do.

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    I think the original post was about generating an insert statement ...

    Try casting the selected column to, say varchar(500)

    HTH

    Sathyaram

  5. #5
    Join Date
    Jun 2003
    Posts
    5
    Originally posted by sathyaram_s
    I think the original post was about generating an insert statement ...

    Try casting the selected column to, say varchar(500)

    HTH

    Sathyaram

    Yes! I want to generate insert statement so that I can reuse these insert statements to populate the tables in the future. There is nothing wrong with the syntax. I suspected the length of the output column is to short. How do I set it to longer? How to use the cast function in DB2? Or is there a simpler way to generate such statements?

    Thanks in advance.

  6. #6
    Join Date
    Apr 2003
    Posts
    191
    Hi,

    command center and command line tools actually do have limitations. Try db2 -tf mystatement.sql or even db2sql92 -d ... -f mystatement.sql from the command line. If your statement still beyond the capabilities, get yourself a decent application development tool and code the sql and it's output and it should work.

    Johann

    Originally posted by ncs_vrl
    Yes! I want to generate insert statement so that I can reuse these insert statements to populate the tables in the future. There is nothing wrong with the syntax. I suspected the length of the output column is to short. How do I set it to longer? How to use the cast function in DB2? Or is there a simpler way to generate such statements?

    Thanks in advance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •