Link to home
Start Free TrialLog in
Avatar of sharone_
sharone_

asked on

ORA-01405 - fetched column value is NULL

Im using a select statement in order to retreive data from the DB to my c program using OCI.
I use ORACLE DB 8 , OAS 4.0.7 on SUN SOLARIS 2.6 .
My select statement is :
"SELECT a,b,c FROM myTable WHERE x=:x"
a is a varchar2 , b&c are numbers in the DB.
In my code a is a text * b is an integer and c is long.
I get the Error in the title for executing yhis statement?
The DB does NOT have a NULL value at any column !
1)What can cause this problem ?
2)Is it because the OCIDefineByPos() ;
In the ORACLE TECHNET website they suggest to solve this problem with NVL functions - What are NVL functions , Where they can be found and how should I use them.
Thank you
sharone
ASKER CERTIFIED SOLUTION
Avatar of MattBradley
MattBradley

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sharone_
sharone_

ASKER

MattBradeley thank you.
How do I prevent this error using the NVL - (if my column name is a_col)?
How it is placed around each selected column ?
What are indicator variables and how they are used ?
for correct answer i will arase the points.
sharone
select nvl(a_col,'a'), nvl(b_col,'B') from table

This will return a,b if a_col and b_col are both null

For the best description on indicator variables check out the Pro*c user guide. They take the form of select a,b into :a.a_ind,:b.b_ind from table. The variabels can then be accessed to determine if a or b is null. Basically if a_ind > 0 then a is null...