Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 24 Jan 2007 @ 09:15:41 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Problem setting the error_message in UDF
 
From:   Patel,Harshida

Hello All,

I am having some problem setting the error_message in UDF. The UDF is as follows;

I want to set the inputErrorString value as the error_message.

     #define SQL_TEXT Latin_Text
     #include "sqltypes_td.h"
     #include 
     #include 
     // *******************************************************
     void unitTestFailedMessage( char inputErrorString[256],
                 char SQLState[6],
                 SQL_TEXT error_message[257] )
     {
        strcpy((char *) error_message, inputErrorString);
         strcpy(SQLState,  "U0011");

          return;
     }

The bteq script is as follows:

     drop SPECIFIC FUNCTION unitTestFailedMessage;
     create FUNCTION unitTestFailedMessage
     (myval VARCHAR(257))
     RETURNS INTEGER
     SPECIFIC unitTestFailedMessage
     LANGUAGE C
     NO SQL
     DETERMINISTIC
     EXTERNAL NAME unitTestFailedMessage
     PARAMETER STYLE SQL;


     select unitTestFailedMessage('somefailure');
     The following is the output of the bteq script:
      *** Function has been created.
      *** Warning: 5607 Check output for possible warnings encountered
              in compiling nd/or linking UDF/XSP/UDM/UDT.
      *** Total elapsed time was 1 second.
     Check output for possible compilation warnings.
     -------------------------------------------------------------
      /usr/bin/cc  -Xc -I /tpasw/etc -c -o
     unitTestFailedMessage.ounitTestFailedMessage.c
     NCR High Performance C Compiler R3.0c
     (c) Copyright 1994-98, NCR Corporation
     (c) Copyright 1987-98, MetaWare Incorporated
      /usr/bin/cc  -Xc -I /tpasw/etc -c -o
     pre_unitTestFailedMessage.opre_unitTestFailedMessage.c
     NCR High Performance C Compiler R3.0c
     (c) Copyright 1994-98, NCR Corporation
     (c) Copyright 1987-98, MetaWare Incorporated
      /usr/bin/cc -G  -Xc -I /tpasw/etc -o
     libudf_0448_12.sounitTestFailedMessage.o pre_unitTestFailedMessage.o
     \@FileList   -ludf -lumm2 -lmw -lm
     -lcc
     +---------+---------+---------+---------+---------+---------+


     select unitTestFailedMessage('somefailure');
      *** Failure 7508 Corrupt stack frame for
              UDF/XSP/UDMhpatel.unitTestFailedMessage.
              Statement# 1, Info =0
      *** Total elapsed time was 1 second.

So, how to set the error_message in UDF and how to call a UDF in stored procedure?

Will appreciate your input.


Thanks,

Harshida



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016