|
編译报錯:
proc userid=DLADM/oracle@192.168.1.2:1521/zydb SQLCHECK=SEMANTICS include=/database/product/10.2.0/db_1/bin/proc RB06.pc
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Oct 17 20:32:36 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /database/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
Syntax error at line 81, column 18, file RB06.pc:
Error at line 81, column 18 in file RB06.pc
OUTER JOIN T_INVM_CUS IN_CU
.................1
PCC-S-02201, Encountered the symbol "OUTER" when expecting one of the following:
; , union, connect, group, having, intersect, minus, start,
where, with,
Pro*c代码如xia:
/**/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
EXEC SQL INCLUDE SQLCA;
EXEC SQL INCLUDE ORACA;
EXEC ORACLE OPTION (ORACA=YES);
void connect();
void sql(int V_AMOUNT,char V_DATE);
void sql_error();
int main(int argc, char **argv)
{
EXEC SQL BEGIN DECLARE SECTION;
int amount;
char amount_c[100];
char date[100];
EXEC SQL END DECLARE SECTION;
if(argc != 3)
{
printf("%s Input error!\n", argv[0]);
return -1;
}
memcpy(amount_c,argv[1],strlen(argv[1]));
memcpy(date,argv[2],strlen(argv[2]));
amount = atoi(amount_c);
/*SQLcuo誤--調用函數sql_reeor处理*/
EXEC SQL WHENEVER SQLERROR DO sql_error();
/*連接到数据库*/
connect();
/*执行SQL操作*/
sql(amount,date);
/*ti交事wu,duan开连接*/
EXEC SQL COMMIT WORK RELEASE;
exit(0);
}
void connect()
{
char* uname = "DLADM";
char* upasspord = "oracle";
char* server = "zydb";
/*连接数據库*/
EXEC SQL CONNECT :uname IDENTIFIED BY :upasspord USING :server;
}
void sql_error()
{
printf("%.*s\n",sqlca.sqlerrm.sqlerrml,sqlca.sqlerrm.sqlerrmc);
}
void sql(int V_AMOUNT,char V_DATE)
{
/* 清空BR06_ACT_TMP 表中數据*/
EXEC SQL INSERT /*APPEND*/ INTO RB06_MAIN
(RISK_KEY
,CHECK_DATE
,DATA_DATE
,SUM_AMT
,CUSNO
,RECNO)
SELECT 'RB06'||V_DATE|| LPAD(SEQ_RISK_KEY.NEXTVAL,5,'0') AS "RISK_KEY"
,V_DATE AS "CHECK_DATE"
,V_DATE AS "DATA_DATE"
,RB06_ACT_TMP.SUM_AMT AS "SUM_AMT"
,IN_CU.CUID_CUST_NO AS "CUSNO"
,INCT.INCT_REC_NO AS "RECNO"
FROM Z_INCT_CRT0 INCT
LEFT OUTER JOIN T_INVM_CUS IN_CU
ON IN_CU.INVM_MEMB_CUST_AC = INCT.INCT_ACCT_NO
INNER JOIN RB06_ACT_TMP
ON RB06_ACT_TMP.CUSNO = IN_CU.CUID_CUST_NO
WHERE INCT.INCT_TRN_CODE IN ('60', '1060')
AND INCT.INCT_CHANNEL = '0'
AND INCT.INCT_TRN_DATE = V_DATE;
EXEC SQL COMMIT;
}
makefile如下:
#!/usr/ccs/bin/make -f
INCLUDE= -I.\
-I ${ORACLE_HOME}/precomp/lib/env_precomp.mk \
-I${ORACLE_HOME}/bin/proc \
-I${ORACLE_HOME}/precomp/public \
-I$(ORACLE_HOME)/rdbms/public \
-I$(ORACLE_HOME)/plsql/public \
-I$(ORACLE_HOME)/network/public \
-I${ORALCE_HOME}/lib32 \
-I${ORALCE_HOME}/lib
CC=cc_r
PROCINCLUDE=${OR2ACLE_HOME}/bin/proc
CFLAGS= -g -q32 -qcpluscmt -DSS_32BIT_SERVER -D_DEBUG ${INCLUDE}
LINKS= -L${ORACLE_HOME}/lib -lclntsh
TARGET = RB06
OBJS = ${TARGET}.o
all: ${TARGET}
${TARGET}{OBJS}
${TARGET}:$<
${CC} ${CFLAGS} $@.o -o $@ ${LINKS}
${TARGET}.c:$<
proc userid=DLADM/oracle@192.168.1.2:1521/zydb SQLCHECK=SEMANTICS include=${PROCINCLUDE} ${TARGET}.pc
clean:
rm -rf RB06 RB06.c
Huan迎来到Java学習者论坛,转载請注明地址:http://www.javaxxz.com. |
|