PRO*C FETCH, is this expected behavior?
From: Frank Peters <fwp_at_Jester.CC.MsState.Edu>
Date: Sun, 1 Mar 1992 06:27:10 GMT
Message-ID: <1992Mar1.062710.13863_at_ra.msstate.edu>
SQL> desc susers
... Declarations and cp argv[1] into charmatch ...
... Program termination code ...
Full Name: Tim Griffin
Full Name: Tim Beyeain
Date: Sun, 1 Mar 1992 06:27:10 GMT
Message-ID: <1992Mar1.062710.13863_at_ra.msstate.edu>
Hello,
To illustrate, I have the following table:
SQL> desc susers
Name Null? Type ------------------------------- -------- ---- USERCODE NOT NULL NUMBER FNAME CHAR(15) MNAME CHAR(15) LNAME CHAR(25) CNAME CHAR(15) OFFICE CHAR(20) EADDR CHAR(40) DEPTNO NUMBER SQL> select fname, lname from susers; FNAME LNAME ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ Frank Peters Thomas Ritter Tim Griffin Tim Beyea Charles Dunn
5 rows selected.
... Declarations and cp argv[1] into charmatch ...
EXEC SQL DECLARE who_cursor CURSOR FOR
SELECT FNAME, LNAME, CNAME FROM SUSERS WHERE UPPER(FNAME) = UPPER(:charmatch) OR UPPER(LNAME) = UPPER(:charmatch) OR UPPER(CNAME) = UPPER(:charmatch);
EXEC SQL OPEN who_cursor;
EXEC SQL WHENEVER NOT FOUND GOTO no_more;
for (;;) {
EXEC SQL FETCH who_cursor INTO :fname, :lname, :cname; printf("Full Name: %s %s\n", fname.arr, lname.arr);}
... Program termination code ...
Running this program gives the following:
Full Name: Tim Griffin
Full Name: Tim Beyeain
Notice that the second fetch ('Beyea' still has the 'in' from the end of 'Griffin').
-- Frank Peters Internet: fwp_at_CC.MsState.Edu Bitnet: Fwp_at_MsState Phone: (601)325-7030 FAX: (601)325-8921Received on Sun Mar 01 1992 - 07:27:10 CET