Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

oopss..look here Oracle Error with C program

SOLVED
Go to solution
Rita C Workman
Honored Contributor

oopss..look here Oracle Error with C program

Sorry, hit enter too soon..

Got this error on a job that's been running with NO problems for the last 3 years !!! It is coded in C (which nobody still here knows...)

"Oracle 01458 - Oracle invalid length inside variable character string"

Has anyone seen this????

I can tell you the job does a qsort (which is not a reliable sort...), and that it blows off at different points, but nothing constant other than this error. The DBA's and the Programmers are about to the end of the line....
Everything I've checked is fine....no new patches have been added that might have affected it (libc). I am running out of things to try...

Will this week ever end???ha ha ha
4 REPLIES
Dan Hetzel
Honored Contributor
Solution

Re: oopss..look here Oracle Error with C program

Hi Rita,

When you try to use a char[] variable in a C program, yo have to make sure of the following:
1. your variable has been given a size like in:
char my_string[64];
or by using malloc() if your variable has been defined as a pointer.
2. you're NOT trying to store more data that your variable can actually contain.

If you're trying to store more than 64 chars in the string my_string defined here above, you'll have a "segmentation violation" error if the surrounding code doesn't check it before.

The same could happen if you're addressing the (n + x)th element of an array defined with size n.

The error message could be that the surrounding oracle code is checking the size of the data BEFORE storing it in a variable, which is good practice.

As data contained in a database is by definition extremely variable, it is well possible that on of the latest records exceeds the hard coded limits. Maybe you simply never reached that limit before.

Try investigating which part of the code, putting some milestones like 'printf("my string is %s\n",my_string);'
This would allow you to know where the problem appears.
If you don't feel confident in doing this, don't hesitate to attach your code so that I could quickly check it if it's not too long. I used to be quite 'fluent' in C although "time flies"... ;-)

Best regards,

Dan


Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Carlos Fernandez Riera
Honored Contributor

Re: oopss..look here Oracle Error with C program

I supose your C code is a PRO*C:

Strings are defined as structure with

an array variable and a length variable.

sprintf(grant.arr,"GRANT CONNECT , DBA TO %s IDENTIFIED BY %s ",logint,logint);
grant.len=strlen(grant.arr);


Your variable.len must be invalid.


unsupported
jherring
Regular Advisor

Re: oopss..look here Oracle Error with C program

Rita

see if this helps

ORA-01458: invalid length inside variable character string

Cause: An attempt was made to bind or define a variable character string with a buffer length less than the two-byte
minimum requirement.

Action: Increase the buffer size or use a different type.

obtained from http://www.cs.umbc.edu/help/oracle8/errmsg/A54625_01/newch2d.htm

Hope this helps

Jon
Rita C Workman
Honored Contributor

Re: oopss..look here Oracle Error with C program

Thank you very much Dan, Carlos & Jon.

It seems the problem was with the data (array) being corrupted by something introduced that was 'too small'.
A special thank you to Jon for the additional Oracle site info.


Regards,
Rita