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: Any expert Pro*C/C++ programmer out there?

Re: Any expert Pro*C/C++ programmer out there?

From: sybrandb <sybrandb_at_gmail.com>
Date: 13 Mar 2007 05:37:25 -0700
Message-ID: <1173789445.569442.127080@n33g2000cwc.googlegroups.com>


On Mar 13, 6:21 am, "Ramon F Herrera" <r..._at_conexus.net> wrote:
> I have programmed using the OCI for years, but decided to move to
> Pro*C/C++. I have ran and modified the simplest examples so far. But
> now I ma stuck.
>
> In my application, the critical variable which is only known at run
> time is none less than the table name. It is something like this:
>
> SELECT emp_name FROM $table_name WHERE emp_id = :some_unique_id;
>
> So, per the manual, I guess I should use Method 3. The doubt that I
> have is this. If I know for a fact that there will be a single record
> being retrieved, do I still have to use the specifics of Method 3
> described in sample8.pc, with CURSOR, FETCH a loop and everything?
> It sounds like such a waste. It seems to me that there should be a
> simpler way, given that the contents of only one row will be
> retrieved.
>
> -Ramon

Never used Pro*C, though did work with Pro*Pascal for a few years.

The fact a single record will be retrieved is irrelevant to the implementation, which requires a CURSOR etc. If you want to assume there is always 1 record, and you can avoid the LOOP, you should by all means do so.
However you probably are aware that 'assume' is an acronym for 'I made an ass out of me and you'.
I would probably judge such code as ready for the garbage bin.

--
Sybrand Bakker
Senior Oracle DBA
Received on Tue Mar 13 2007 - 07:37:25 CDT

Original text of this message

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