我的数据库里要执行的是(参数想从java代码里传):
begin
ViewPara.setDealStaticPara1b(20081201);
ViewPara.setDealStaticPara1e(20081231);
ViewPara.setDealStaticPara2b(20081201);
ViewPara.setDealStaticPara2e(20081231);
ViewPara.setDealStaticPara3b(20081201);
ViewPara.setDealStaticPara3e(20081231);
end;
select * from DEAL_STATIC_VIEW;我的java代码是这么写的:
try {
Connection conn = DbConnectionManager.getConnection();
// conn.setAutoCommit(false);
String sql = "begin "
+ " ViewPara.setDealStaticPara1b(?) "
+ " ViewPara.setDealStaticPara1e(?) "
+ " ViewPara.setDealStaticPara2b(?) "
+ " ViewPara.setDealStaticPara2e(?) "
+ " ViewPara.setDealStaticPara3b(?) "
+ " ViewPara.setDealStaticPara3e(?) "
+"end;";
CallableStatement proc = conn.prepareCall(sql);
proc.setLong(1, startDateLong);
proc.setLong(2, endDateLong);
proc.setLong(3, startDateLong);
proc.setLong(4, endDateLong);
proc.setLong(5, startDateLong);
proc.setLong(6, endDateLong);
proc.execute();
} catch (SQLException e) {
e.printStackTrace();
}
String s = "select * from DEAL_STATIC_VIEW;";
List list = DataBaseUtil.executeQuery(s); return list;
当执行到proc.execute();这行代码时,抛出异常,如下:
java.sql.SQLException: ORA-06550: 第 1 行, 第 42 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
:= . ( % ;
符号 ":=" 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 76 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 110 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 144 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 178 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 211 列:
PLS-00103: 出现符号 "END"在需要下列之一时:
. ( * % & = - + ; < / > at
in is mod not rem <an exponent (**)> <> or != or ~= >= <= <>
and or like between ||
符号 ";" 被替换为 "END" 后继续。
begin
ViewPara.setDealStaticPara1b(20081201);
ViewPara.setDealStaticPara1e(20081231);
ViewPara.setDealStaticPara2b(20081201);
ViewPara.setDealStaticPara2e(20081231);
ViewPara.setDealStaticPara3b(20081201);
ViewPara.setDealStaticPara3e(20081231);
end;
select * from DEAL_STATIC_VIEW;我的java代码是这么写的:
try {
Connection conn = DbConnectionManager.getConnection();
// conn.setAutoCommit(false);
String sql = "begin "
+ " ViewPara.setDealStaticPara1b(?) "
+ " ViewPara.setDealStaticPara1e(?) "
+ " ViewPara.setDealStaticPara2b(?) "
+ " ViewPara.setDealStaticPara2e(?) "
+ " ViewPara.setDealStaticPara3b(?) "
+ " ViewPara.setDealStaticPara3e(?) "
+"end;";
CallableStatement proc = conn.prepareCall(sql);
proc.setLong(1, startDateLong);
proc.setLong(2, endDateLong);
proc.setLong(3, startDateLong);
proc.setLong(4, endDateLong);
proc.setLong(5, startDateLong);
proc.setLong(6, endDateLong);
proc.execute();
} catch (SQLException e) {
e.printStackTrace();
}
String s = "select * from DEAL_STATIC_VIEW;";
List list = DataBaseUtil.executeQuery(s); return list;
当执行到proc.execute();这行代码时,抛出异常,如下:
java.sql.SQLException: ORA-06550: 第 1 行, 第 42 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
:= . ( % ;
符号 ":=" 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 76 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 110 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 144 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 178 列:
PLS-00103: 出现符号 "VIEWPARA"在需要下列之一时:
. ( * % & = - + ; < /
> at in is mod not rem <an exponent (**)> <> or != or ~= >=
<= <> and or like between ||
符号 "." 被替换为 "VIEWPARA" 后继续。
ORA-06550: 第 1 行, 第 211 列:
PLS-00103: 出现符号 "END"在需要下列之一时:
. ( * % & = - + ; < / > at
in is mod not rem <an exponent (**)> <> or != or ~= >= <= <>
and or like between ||
符号 ";" 被替换为 "END" 后继续。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货