struct를 정의 하는데 DECLARE section 밖에서 정의한 것을 사용할
경우 에러가 발생합니다.
struct는 반드시 DECLARE section 내에서 정의,선언을 해야
하나요?
참고로 CODE type을 CPP로 해야 합니다. KR_C type에서는 에러가
발생하지 않네요.
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
EXEC SQL INCLUDE SQLCA;
EXEC SQL INCLUDE SQLDA;
struct sdbinfo {
char sqlUserName[32];
char sqlPassword[32];
char sqlUsing[160];
};
int main(int argc, char *argv[])
{
EXEC SQL BEGIN DECLARE SECTION;
struct sdbinfo myst;
/*
struct {
char sqlUserName[32];
char sqlPassword[32];
char sqlUsing[160];
} myst;
*/
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT :myst.sqlUserName IDENTIFIED
BY :myst.sqlPassword USING :myst.sqlUsing;
return 0;
}
------------------------
compile : HP-UX
proc ora_select2.pc code=cpp
Pro*C/C++: Release 9.0.1.0.0 - Production on Thu Sep 8 10:02:00
2005
(c) Copyright 2001 Oracle Corporation. All rights reserved.
System default option values taken from:
/opt/oracle/OraHome1/precomp/admin/pcscfg.cfg
Semantic error at line 32, column 20, file ora_select2.pc:
EXEC SQL CONNECT :myst.sqlUserName IDENTIFIED BY :myst.sqlPassword
USING
:myst.sqlUsing;
...................1
PCC-S-02420, Incomplete (or missing) type specification
Semantic error at line 32, column 20, file ora_select2.pc:
EXEC SQL CONNECT :myst.sqlUserName IDENTIFIED BY :myst.sqlPassword
USING
:myst.sqlUsing;
...................1
PCC-S-02328, undefined struct member
|