Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error E2451 sql.c 17: Undefined symbol 'EXEC' in f

Author  Topic 

stevenandler
Starting Member

42 Posts

Posted - 2012-07-16 : 12:30:31
Here is a sample of a program that I got from the website

http://www.csee.umbc.edu/portal/help/oracle8/server.815/a68022/sql.htm

#include <stdio.h>

/* declare host variables */
char userid[12] = "SCOTT/TIGER";
char emp_name[10];
int emp_number;
int dept_number;
char temp[32];
void sql_error();

/* include the SQL Communications Area */
//#include <sqlca.h>

main()
{ emp_number = 7499;
/* handle errors */
EXEC SQL WHENEVER SQLERROR do sql_error("Oracle error");

/* connect to Oracle */
EXEC SQL CONNECT :userid;
printf("Connected.\n");

/* declare a cursor */
EXEC SQL DECLARE emp_cursor CURSOR FOR
SELECT ename
FROM emp
WHERE deptno = :dept_number;

printf("Department number? ");
gets(temp);
dept_number = atoi(temp);


Whenever the compiler gets to the EXEC statemnet a compile error
occurs.

E2451 SQL.CPP 17: Undefined symbol 'EXEC' in function main()
I am using Borland c++
VER 5.5.1 and SQL 2008 R2

Can some please provide me with some help.

Thank you.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-07-16 : 12:38:06
/* connect to Oracle */
SQL 2008 R2


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

xhostx
Constraint Violating Yak Guru

277 Posts

Posted - 2012-07-16 : 12:39:31

The script you have posted is an Oracle script. This MS SQL Forum. you will be better off if you can find an ORACLE forum.

--------------------------
Get rich or die trying
--------------------------
Go to Top of Page
   

- Advertisement -