Oracle - PL\SQL for Oracle Forms in Developer 2000
Posted on 2004-11-24
-- I am unable to retrieve the correct value from SQL%ROWCOUNT....
--WHAT IVE DONE
-- When the code below runs the variable thisNumber is always set to the number 1
--even when there are no records that meet this sql select statments criteria....
--What I mean is that if I run the select statment manually in TOAD or SQL PLUS I get 0 records
--returned but when I run this form it will always set thisNumber to 1... And the weird thing is that
--it sets the NT variable within the select into statement to 9, how can this be???
--Am i coding the select statement correctly? if the DEV_ID in my where clause is of VARCHAR2 type
--will this be okay the way that I have it? Or is some type of parenthesis needed? Or is this okay in
--this case since I'm bringing the variable in through an input parameter to the function and it knows
--that its of varchar2 type so I don't need the parenthesis???
FUNCTION getNumOfDevicesWithCriteria( thisDeviceID in VARCHAR2,
thisExemptnKey in NUMBER,
thisNumber IN OUT NUMBER ) return boolean
select count(*) into NT
WHERE DEV_ID = thisDeviceID and
EXEMPTN_KEY = thisExemptnKey;
thisNumber := SQL%ROWCOUNT;