Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Pro *C/C++ Cursor problem ???
In article <8ce13e$7cv$1_at_nnrp1.deja.com>,
Eric Chow <eric138_at_yahoo.com> wrote:
> Hi Oracle Developers,
>
> If I use a cursor, is it possible to know the data type of the value ?
>
> For example :
>
> exec sql declare xCursor cursor for
> select emp_name from emp where salary > 100;
>
> exec sql open xCursor;
> ...
>
> for(;;) {
> ...
> ...
>
> exec sql fetch .....
> }
>
> During the fetch, can I know what the dat type of that FETCH VALUE ?
>
when using static sql, as you are, you are implying at COMPILE time you know the datatypes. I mean -- you had to of set up and define host variables of a certain type to fetch into. Youre fetching into the same variable every time you run this program -- that variable has a type you know already. This question doesn't seem to make sense to me - - you already *know* the type of the fetched column -- you declared a variable to fetch into.
When using DYNAMIC sql, you can use a SQLDA structure. there you can describe a query into this structure and get the type codes back out (eg: type=5 means Ascii Null terminated string). You can also use the new "ansi dynamic sql" interface as well.
> Best regards,
> Eric
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
Thomas Kyte tkyte_at_us.oracle.comOracle Service Industries
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Apr 04 2000 - 19:46:20 CDT