Re: Problem with Pro *C

From: Tommy Wareing <p0070621_at_oxford-brookes.ac.uk>
Date: 9 Feb 1994 03:41:54 -0600
Message-ID: <CKyAr9.LMv_at_uk.ac.brookes>


Ramprasad Santhanakrishnan (rsanthan_at_top.cis.syr.edu) wrote:
> Hi folks
> I am having problem with the following program segment in Pro *C.

Yes, you are!
> This particular query is not inside any function or loop or switch
> statements. It is required to find the no. of unique csci_names
> in table .

It won't work you know...
> I dont know why it puts a break statement in 'C' program...
I do!

> /*
> EXEC SQL SELECT COUNT(DISTINCT csci_name)
> INTO :num_csci
> FROM breadth_of_testing
> WHERE system_name = :system_name
> AND csci_name <> "";
> */
Ok, this won't work anyway: it's not SQL! To start with, "" is not valid, you mean ''. Second, any comparisons to NULL (aka '') will *ALWAYS* fail (except for IS [NOT] NULL), so this will always return the answer 0. The last line should read AND csci_name IS NOT NULL;

> {
> [Output of Pre-compiler...]

 ...
> sqlcex(&sqlctx, &sqlstm, &sqlfpn);
> if (sqlca.sqlcode == 1403) break;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
You have an EXEC SQL WHENEVER NOT FOUND DO break; in force (1403 is the code for no data found).

--
  _________________________   _______________________________
 /  Tommy Wareing          \ / 'Happy, happy. Joy, joy!'     \
|  p0070621_at_brookes.ac.uk   X      said Ren & Stimpy          |
 \  0865-483389            / \ (Supplied by Simone, not me!) /
  ~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Received on Wed Feb 09 1994 - 10:41:54 CET

Original text of this message