Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select count statement with parameters

Status
Not open for further replies.

stewarttn

Programmer
May 20, 2004
6
US
Could someone please look at this statement and see why my count is 0 when I know it actually is 1 ?

SELECT
COUNT(PRECEPTOR_SITE_EVAL."ENTHUSIASTIC")
FROM
"PRECEPTOR_SITE_EVAL" PRECEPTOR_SITE_EVAL
WHERE
PRECEPTOR_SITE_EVAL."ENTHUSIASTIC" = '3'
AND
PRECEPTOR_SITE_EVAL."ACADEMIC_YEAR" = '{?ACADEMIC_YR)'
AND
PRECEPTOR_SITE_EVAL."BLOCK_NUMBER" = '{?BLOCK_NO}'


 

Try substituting the actual values for the variables instead of prompting for them.
e.g.,

PRECEPTOR_SITE_EVAL."ACADEMIC_YEAR" = '1999'
AND
PRECEPTOR_SITE_EVAL."BLOCK_NUMBER" = '234'

How are these fields defined? Is block_number a character field or is it numeric? This could have an effect on how your variables are being compared with what is in the database.

mike
 
I did substitute the actual literals into one of the selects
and that worked. The problem is that there are about 100 statements that I would have to modify each time. The academic year field is defined as varchar2(5) like 03-04.
The block number is defined as varchar2(1) like 5.
 
Mike,

I changed the program to use running totals and that it working. Thanks for your help.

T.N. Stewart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top