7502: A system trap was caused by UDF/XSP/UDM ALL_ETL_UDF
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


7502: A system trap was caused by... Expand / Collapse
Author
Message
Posted 9/23/2009 5:17:29 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/24/2009 11:30:26 AM
Posts: 3, Visits: 22
I wrote a UDF to read the string and if there are any control characters replace with spaces
when I run the udf one time is working and next time its giving 7502 system trap error and if I run again its working, I am not sure what needs to fix, can anyone help

I am also pasting the code

select myreplace(loss_desc)
from xxx

#define SQL_TEXT Latin_Text
#include "sqltypes_td.h"
#include
#include
#include
#include
#define MAX_STRING_LENGTH 256
#define IsNull -1
#define IsNotNull 0
#define NoSqlError "00000"
#define NUL '\0'


void myreplace( char *inp_str,
char *out_str,
int *inp_strIsNull,
int *out_strIsNull)
{
int i = 0, j = 0;
char *tmp_str ;
*out_str = '\0' ;

memset(out_str, NULL, sizeof(out_str)) ;

tmp_str = malloc(strlen(inp_str)*sizeof(char));
strcpy(tmp_str, inp_str) ;

if (*inp_strIsNull == IsNull)
{
*out_strIsNull = IsNull;
return;
}
*out_strIsNull = IsNotNull;
*out_str = NUL;

if (strlen(inp_str) == 0)
{
*out_str = '\0';
return;
}
while (tmp_str[i] != NULL )
{
if (iscntrl(tmp_str[i]) )
{
tmp_str[i] = ' ';
out_str[j] = toupper(tmp_str[i]);
}
else if (tmp_str[i] == '^' )
{
tmp_str[i] = ' ';
out_str[j] = toupper(tmp_str[i]);
}
else
{
out_str[j] = toupper(tmp_str[i]);
}
++i;
++j;
}
out_str[j] = '\0' ;
free(tmp_str) ;
return;
}


Sidd
Post #16917
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 7:48pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.047. 5 queries. Compression Disabled.