Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2011
    Posts
    25

    Answered: Compile a trigger

    The sql script [trg.sql] contains this statement:

    CREATE OR REPLACE TRIGGER "XYX"."TRG_INS_VACWRKR" AFTER INSERT ON XYX.VACATION_WORKER
    FOR EACH ROW
    BEGIN ATOMIC
    UPDATE XYX.VACATION_WORKER
    SET SEARCH_FIRST_NAME = lower(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPL ACE(REPLACE(FIRST_NAME,'', 'ss'),'', 'Ue'),'', 'Oe'),'', 'Ae'),'', 'ue'),'', 'oe'),'', 'ae')),
    SEARCH_LAST_NAME =lower(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REP LACE(REPLACE(LAST_NAME,'', 'ss'),'', 'Ue'),'', 'Oe'),'', 'Ae'),'', 'ue'),'', 'oe'),'', 'ae'))
    ;--
    END
    @
    I am not able to compile this sql script using the command.

    db2 -td@ -vf trg.sql


    Suggestion are welcome

  2. Best Answer
    Posted by db2mor

    "Possible locale issue. If you are using the clp at the shell command line on Linux, was the file "trg.sql" created in the same shell window with local text editor?
    If the file trg.sql was created on a different operating system (such as Windows) its encoding might not be what the CLP is expecting relative to $LANG.
    Post the value of the LANG variable in your command-line session.
    Post the database codeset and codepage of your database , which you can get with 'db2 get db cfg for $dbname'."


  3. #2
    Join Date
    Apr 2012
    Posts
    1,143
    Provided Answers: 27
    Post the exact full error message you get.
    Post your db2level output, and your Operating system facts for the hostname running the DB2-server

  4. #3
    Join Date
    Nov 2011
    Posts
    25
    When I trying to compile the trigger I am getting this error:


    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0007N The character "▒" following ", 'Oe'),'▒', 'Ae'),'" is not valid.
    LINE NUMBER=5. SQLSTATE=42601
    Out put of Db2level:

    DB21085I This instance or install (instance name, where applicable: "v4old")
    uses "64" bits and DB2 code release "SQL10014" with level identifier
    "0205010E".
    Informational tokens are "DB2 v10.1.0.4", "s140509", "IP23584", and Fix Pack
    "4".
    Product is installed at "/opt/ibm/db2/V10.1".

    OS I am using is:

    Linux de-daihr-db-01 3.0.101-0.47.67-default #1 SMP Wed Aug 19 14:12:37 UTC 2015 (265cc32) x86_64 x86_64 x86_64 GNU/Linux

  5. #4
    Join Date
    Apr 2012
    Posts
    1,143
    Provided Answers: 27
    Possible locale issue. If you are using the clp at the shell command line on Linux, was the file "trg.sql" created in the same shell window with local text editor?
    If the file trg.sql was created on a different operating system (such as Windows) its encoding might not be what the CLP is expecting relative to $LANG.
    Post the value of the LANG variable in your command-line session.
    Post the database codeset and codepage of your database , which you can get with 'db2 get db cfg for $dbname'.

  6. #5
    Join Date
    Nov 2011
    Posts
    25
    It was character set issue:

    Issue this command and the issue is resolved.

    iconv -f ISO-8859-1 -t UTF-8//TRANSLIT trg.sql -o trg-c.sql

Posting Permissions

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