? How do I declare a structure into which to fetch records?

From: Stephen M. Deal <deal_at_tempus.Kodak.Com>
Date: Wed, 30 Dec 92 05:46:17 GMT
Message-ID: <1992Dec30.054617.3077_at_kodak.kodak.com>


I don't have my manuals with me (I'm at home) and I am trying to get some embedded SQL C code (a.k.a. Pro*C) to precompile. I am not sure that the manuals would answer this one anyway so I have turned to the net for help.

I have declared a structure into which a record should be retrieved:

  EXEC SQL BEGIN DECLARE SECTION;
  struct emprec_ {
    char name[35];
    char dept_name[41];
    char phone[16];
  } query_results; /* Results of query placed here */   EXEC SQL END DECLARE SECTION; but the precompiler errors on the fetch statement as follows:

  Precompiling proc_3.pc
   215 EXEC SQL FETCH emp_csr INTO :query_results;

   215 ....................................................^
       PCC-S-0026:  Undeclared host variable "query_results" at line 215
in file proc_3.pc
  • Error code 1

It is pretty clear what is wrong. But how do I fix it? I know that char datatypes are declared as VARCHAR, yet int are declared as int. Is there a keywork for declaring embedded SQL structures?

Even a snippet of code that shows the proper syntax for the declaration would be helpful. I just need the precompiler to recognize that the structure has been declared.

Thanks in advance,



| Steve Deal | Internet: deal_at_Kodak.COM |
| Eastman Kodak Co. | UUCP: ...rutgers!rit!kodak!tempus!deal |
| Engr. Systems Div. | Voice: (716) 726 - 5396 |
| mailcode: 35108 | FAX: (716) 726 - 7406 |
| 901 Elmgrove Road | |
| Rochester, NY | |
| 14653-5108 | |

    Disclaimer:	"Everyone is entitled to an opinion, 
		 the above is mine and not that of my employer."
Received on Wed Dec 30 1992 - 06:46:17 CET

Original text of this message