sql4002n : precompiler strange error


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: sql4002n : precompiler strange error

Threaded View

  1. #1
    Join Date
    Feb 2009
    Posts
    6

    sql4002n : precompiler strange error

    Hi everyone,

    I'm working with DB2 and I got a strange precomplier error ; hope someone will have any idea how to resolve this because I'm completely disappointed about that problem

    I'll try to explain my problem clearer as possible but it's not trivial.

    First of all, I’ve got two similar functions declared like this:

    Code:
    CREATE FUNCTION "DB2ADMIN"."FUNC_BK_BIG_2_624001995" (
        "COMPOUND_2_1"	CHARACTER(8),
        "COMPOUND_2_2"	CHARACTER(8) )
      RETURNS VARCHAR(16)
      SPECIFIC "SQL090520165705700"
      LANGUAGE SQL
      DETERMINISTIC
      NO EXTERNAL ACTION
      CONTAINS SQL
      CALLED ON NULL INPUT
      INHERIT SPECIAL REGISTERS
    RETURN VARCHAR(COMPOUND_2_1, 8) || VARCHAR(COMPOUND_2_2, 8);
    
    CREATE FUNCTION "DB2ADMIN"."FUNC_BK_BIG_3_79140483" (
        "COMPOUND_4_1"	CHARACTER(4),
        "COMPOUND_4_2"	CHARACTER(4),
        "COMPOUND_4_3"	CHARACTER(4),
        "COMPOUND_4_4"	CHARACTER(4) )
      RETURNS VARCHAR(16)
      SPECIFIC "SQL090520165706200"
      LANGUAGE SQL
      DETERMINISTIC
      NO EXTERNAL ACTION
      CONTAINS SQL
      CALLED ON NULL INPUT
      INHERIT SPECIAL REGISTERS
    RETURN VARCHAR(COMPOUND_4_1, 4) || VARCHAR(COMPOUND_4_2, 4) || VARCHAR(COMPOUND_4_3, 4) || VARCHAR(COMPOUND_4_4, 4);
    
    When I try to precompile this C code:
    Code:
    EXEC SQL BEGIN DECLARE SECTION;
    
    static struct _index_buff_102_OT {
        struct {short len; char buff[8];} COMPOUND_2_1;
        struct {short len; char buff[8];} COMPOUND_2_2;
    } index_buff_A_102;
    
      EXEC SQL DECLARE SEQ_ON_INDEX_102 CURSOR FOR
        SELECT 
            RID,
            VERSION,
            "COL1",
            "COL2",
            "COL3",
            "COL4",
            "COL5",
            "COL6",
            "COL7",
            "COL8",
            "COMPOUND",
            "COMPOUND_2_1",
            "COMPOUND_2_2",
            "COMPOUND_4_1",
            "COMPOUND_4_2",
            "COMPOUND_4_3",
            "COMPOUND_4_4",
            ("AMOUNT" * 100)
          FROM
            BIG
          WHERE
            BK_BIG_2_624001995 >= func_BK_BIG_2_624001995(:index_buff_A_102.COMPOUND_2_1.buff, :index_buff_A_102.COMPOUND_2_2.buff)
          ORDER BY
            "BK_BIG_2_624001995";
    
    EXEC SQL END DECLARE SECTION;
    everything goes well:
    Code:
            SQL0060W  The "C" precompiler is in progress.
            SQL0091W  Precompilation or binding was ended with "0"
                      errors and "0" warnings.
    but if I try to precompile :
    Code:
    EXEC SQL BEGIN DECLARE SECTION;
    
    static struct _index_buff_103_OT {
        struct {short len; char buff[4];} COMPOUND_4_1;
        struct {short len; char buff[4];} COMPOUND_4_2;
        struct {short len; char buff[4];} COMPOUND_4_3;
        struct {short len; char buff[4];} COMPOUND_4_4;
    } index_buff_A_103;
    
      EXEC SQL DECLARE SEQ_ON_INDEX_103 CURSOR FOR
        SELECT 
            RID,
            VERSION,
            "COL1",
            "COL2",
            "COL3",
            "COL4",
            "COL5",
            "COL6",
            "COL7",
            "COL8",
            "COMPOUND",
            "COMPOUND_2_1",
            "COMPOUND_2_2",
            "COMPOUND_4_1",
            "COMPOUND_4_2",
            "COMPOUND_4_3",
            "COMPOUND_4_4",
            ("AMOUNT" * 100)
          FROM
            BIG
          WHERE
            BK_BIG_3_79140483 >= func_BK_BIG_3_79140483(:index_buff_A_103.COMPOUND_4_1.buff, :index_buff_A_103.COMPOUND_4_2.buff, :index_buff_A_103.COMPOUND_4_3.buff, :index_buff_A_103.COMPOUND_4_4.buff)
          ORDER BY
            "BK_BIG_3_79140483";
    
    EXEC SQL END DECLARE SECTION;
    I got this error :
    Code:
            SQL0060W  The "C" precompiler is in progress.
       10   SQL4002N  "index_buff_A_103.COMPOUND_4_3.buff" and
                      "index_buff_A_103.COMPOUND_4_2.buff" are undeclared host
                      variables that cannot both be used as descriptor names in a
                      single SQL statement.
       10   SQL4002N  "EXEC" and "" are undeclared host variables that
                      cannot both be used as descriptor names in a single SQL
                      statement.
            SQL0095N  No bind file was created because of previous
                      errors.
            SQL0091W  Precompilation or binding was ended with "3"
                      errors and "0" warnings.
    Someone got any ideas what the problem is and how to resolved it ?

    Any help would really be appreciated.

    Thanks in advance,

    Yan302
    Last edited by Yan302; 05-25-2009 at 09:21 AM.

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2009, 09:22 AM
  2. Replies: 0
    Last Post: 04-03-2009, 03:13 AM
  3. Replies: 5
    Last Post: 01-17-2007, 01:37 PM
  4. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 03:53 AM
  5. Replies: 0
    Last Post: 04-07-2000, 09:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center