All Forums General
karthik_2244 36 posts Joined 12/10
28 Feb 2012
3760:String not terminated before end of text

Hi,

In a procedure we get all the values passed to insert command using the cursor,

when i execute using dsql facing 3760 error.

insert into results values('PRCS STAT CODE','metadata','prcs', 1, 6720,'C ','X');

when I manually run the query its is working fine.

 

sample dsql:

dsql='insert into results values('''||TRIM(columnname)||''','''||TRIM(dbname)||' '','''||TRIM(tname)||''','||nullcount||',' ||notnullcount||','''||TRIM(BOTH' ' FROM minval)||''','''||TRIM(BOTH' ' FROM maxval)||''');';

 

Is it due to any datatype issue?

 

Thanks,

Karthik. N

ulrich 816 posts Joined 09/09
28 Feb 2012

The error message means that a string is not terminated - which means a string starts with an ' but not second ' can be found.

Do you have a SP debug or log table where the SP can insert the dsql into as a text.

In this case you would be able to see what the statement is you try to execute.

 

 

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

karthik_2244 36 posts Joined 12/10
28 Feb 2012

insert into results values('PRCS STAT CODE','metadata','prcs', 1, 6720,'C ','X');

This sql from log table derived from dsql.

ulrich 816 posts Joined 09/09
28 Feb 2012

And I it seems to be a correct one - so you can run this?

The first ' of  'metadata'  has a different color - but I guess this doesn't mean it is a different `or ´or what ever?

Are you sure that the call of this insert generates the error message?

Can you share the SP code?

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

karthik_2244 36 posts Joined 12/10
28 Feb 2012

Hi Ulrich,

Issue is due to the field TRIM(BOTH' ' FROM minval), it gives the value 'C '

CHAR2HEXINT of the value gives me 004300200020002000200020  as the field is of data type char(25).

when I used substr(minval,1,1) in sp, insert whent through fine.

Is the space in char filed causing the issue? [String not terminated before end of text]

 

SP code:

/*    MIN  VAL START  */

SET dsql = 'DELETE FROM vals  ALL ;';
CALL DBC.SysExecSQL(dsql);

SET dsql='insert into vals sel cast(min('||column_name||') as varchar(100)) from '||dbname||'.'||tname||';';
 CALL DBC.SysExecSQL(dsql);

SEL   vlu INTO minval  FROM vals;

/*    MIN  VAL END  */

 

dsql='insert into results values('''||TRIM(column_name)||''','''||TRIM(dbname)||''','''||TRIM(tname)||''','||totcount||','||uniqcount||','||nullcount||','||notnullcount||','''||TRIM(BOTH' ' FROM minval)||''','''||TRIM(BOTH' ' FROM maxval)||''',0);';

 

Thanks,

Karthik

ulrich 816 posts Joined 09/09
28 Feb 2012

I don't see the issue here right now.

Usually I don't specify the ' ' in the Trim as this is the default.

So TRIM(BOTH from maxval) should be Ok. But the syntax seems never the less correct.

Could you share the data types for the different input parameters and the ddl of the result table? Are the char fields latin or unicode?

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

You must sign in to leave a comment.