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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A trick in Embedded SQL

Status
Not open for further replies.

oracledb

Programmer
Nov 28, 2001
1
US
Hi, everyone

I have a program as follows. It can be successfully precompiled on Oracle 8.1.6.0.0 for UNIX, but not on Oracle 8.1.6.0.0 for Windows NT. When it is precomiled on WinNT, the following error occurs:

EXEC SQL FETCH salespeople INTO :emp_rec_ptr;
PCC-S-02420, Incomplete (or missing) type specification

I don't understand the error message. Can you tell me how to fix the problem? Thanks a lot. (See code below, please)
------------------------------------------------------------

#include <stdio.h>
#include <sqlca.h>

struct emp_info
{
char emp_name[30];
float salary;
float commission;
};

main()
{
EXEC SQL BEGIN DECLARE SECTION;
struct emp_info *emp_rec_ptr;
char username[20];
char password[40];
EXEC SQL END DECLARE SECTION;

if (!(emp_rec_ptr = (struct emp_info *) malloc(sizeof(struct emp_info))))
exit(1);

strcpy(username, &quot;SCOTT&quot;);
strcpy(password, &quot;TIGER&quot;);

EXEC SQL CONNECT :username IDENTIFIED BY :password;

EXEC SQL DECLARE salespeople CURSOR FOR
SELECT ENAME, SAL, COMM
FROM EMP
WHERE JOB LIKE 'SALES%';

EXEC SQL OPEN salespeople;

for (;;)
{
EXEC SQL FETCH salespeople INTO :emp_rec_ptr;
printf(&quot;%-11s%9.2f%13.2f\n&quot;, emp_rec_ptr->emp_name,
emp_rec_ptr->salary, emp_rec_ptr->commission);
}

EXEC SQL CLOSE salespeople;
EXEC SQL COMMIT WORK RELEASE;
exit(0);
}
------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top