I have the following db proc:

CREATE DBPROC NAMESEARCH (IN PNAME VARCHAR(20), OUT patid INTEGER)
AS
TRY
SELECT PATIENT.PATIENT_ID FROM "DBA".PATIENT
INNER JOIN "DBA".FAMILY_NAME ON
"DBA".PATIENT.FAM_NAME_ID=FAMILY_NAME.FAM_NAME_ID
WHERE "DBA".FAMILY_NAME.FAM_NAME=:PNAME;
WHILE $RC =0 DO BEGIN
FETCH INTO :patid;
END;
CATCH
IF $RC <> 100 THEN STOP ($RC, 'Unexpected error');

what i'm trying to do is get a list of all the patient_ids that have 'Smith'
as their surname.

The SQL is correct but i fear there are mistakes in the db proc as a whole.

In Postgres i would return a set of integers but in sapdb i get a resultset
composed of 'Smith' and nothing else.

Could anyone point out my error or point me in the direction of useful docs
(i've been through the ref manual already and not found it much help).

Thanks,

Steve Brett 
SID 
EMIS Ltd. 


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to