Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Very strange behaviour of SQL under OCI

Re: Very strange behaviour of SQL under OCI

From: <ahasanas_at_my-dejanews.com>
Date: Fri, 02 Apr 1999 12:43:03 GMT
Message-ID: <7e2e0l$91k$1@nnrp1.dejanews.com>


Hi,

Your OCI code is getting a NULL_VALUE_RETURNED error (1405) as per documentation. You may check the "indp" parameter after fetch and it should be negative. If it is your 'kod_odm' field is null. If you do not catch this exception fetch stops raising the exception. In your case may be the very second record has kod_odm null. So you get only the first record.

If you want to get all the rows use select "SELECT nvl(kod_odm,0) FROM transakcje" assuning kod_odm is number. The exception will not occur.

Asif Hasan
spectrum_at_bangla.net

In article <7e0aet$1fi$1_at_euler.softax.com.pl>,   "Grzesiek" <grzesiek_at_no.spam> wrote:
>
> Thomas Kyte <tkyte_at_us.oracle.com> wrote in message
> news:370b7a5d.7377608_at_192.86.155.100...
> > A copy of this was sent to "Grzesiek" <grzesiek_at_no.spam>
> > (if that email address didn't require changing)
> > On Thu, 01 Apr 1999 11:55:32 GMT, you wrote:
> >
> >
> > Lets see the code.
> >
> OK. Actually I'm using some set of classes which covers primary OCI,
> but here is simplified, almost "pure C" version of the code. It produces
> output:
>
> $ Records fetched: 1
>
> while there are over 3000 records in table.
>
> #define VERSION_7 2
>
> /* zewnetrzne typy danych */
> #define VARCHAR2_TYPE 1
> #define NUMBER_TYPE 2
> #define INT_TYPE 3
> #define FLOAT_TYPE 4
> #define STRING_TYPE 5
> #define ROWID_TYPE 11
> #define DATE_TYPE 12
> #define RAW_TYPE 23
> #define LONG_RAW_TYPE 24
> #define UNSIGNED_TYPE 68
> #define CHAR_TYPE 96
> #define CHARZ_TYPE 97
>
> extern "C"
> {
> #include <ociapr.h>
> }
> #include <iostream.h>
> #include <string.h>
>
> static int fetchSize = 20;
>
> int main(void)
> {
> ub1 m_hda[512];
> Lda_Def m_lda;
> Cda_Def m_cda;
> sb4 dbSize;
> sb2 dbType;
> sb4 displaySize;
> char *tmpFetch;
> ub2 *tmpLen;
> ub2 *tmpInd;
>
> memset(m_hda,0,sizeof(m_hda));
> if(olog(&m_lda, m_hda, (text*)"pz", -1, (text*)"pz", -1,
> (text*)"PZ", -1, OCI_LM_DEF))
> return -1;
> if (oopen(&m_cda, &m_lda, (text *)0, 1, 1, (text *)0, 1))
> return -1;
> if (oparse(&m_cda,
> (text*)"SELECT kod_odm FROM transakcje",
> (sb4) - 1, 0, (ub4)VERSION_7))
> return -1;
> if(odescr(&m_cda,
> 1,
> &dbSize, &dbType,
> 0, 0,
> &displaySize,
> 0, 0,
> 0))
> return -1;
> tmpFetch=new char[displaySize*fetchSize];
> tmpLen=new ub2[fetchSize];
> tmpInd=new ub2[fetchSize];
> if (odefin(&m_cda, 1, (ub1 *)tmpFetch, displaySize,
> (sword)VARCHAR2_TYPE,
> (sword) - 1, (sb2 *)0, (text *)0, -1, -1,
> (ub2 *) tmpLen, (ub2 *) tmpInd))
> return -1;
> if(oexec(&m_cda) < 0)
> return -1;
> if(ofen(&m_cda,fetchSize) < 0)
> return -1;
> cout<<"Records fetched: "<<m_cda.rpc<<endl;
> oclose(&m_cda);
> ologof(&m_lda);
> return 0;
> }
>
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Apr 02 1999 - 06:43:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US