来自vb.net的存储过程无法正常工作

时间:2015-08-24 16:52:58

标签: stored-procedures oracle11g

我在Oracle 11g中创建了这个存储过程。

make[3]: Entering directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib/gcc'
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh config.h
TARGET_CPU_DEFAULT="" \
HEADERS="options.h insn-constants.h config/elfos.h config/newlib-stdint.h config/riscv/riscv.h config/riscv/elf.h config/initfini-array.h defaults.h" DEFINES="LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh tm.h
TARGET_CPU_DEFAULT="" \
HEADERS="config/riscv/riscv-protos.h tm-preds.h" DEFINES="" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh tm_p.h
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh bconfig.h
g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/build -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/../include  -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/../libcpp/include  \
    -o build/genmddeps.o /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/genmddeps.c
Makefile:2428: recipe for target 'build/genmddeps.o' failed
make[3]: Leaving directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib/gcc'
Makefile:4112: recipe for target 'all-gcc' failed
make[2]: Leaving directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib'
Makefile:867: recipe for target 'all' failed
make[1]: Leaving directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib'
Makefile:214: recipe for target 'stamps/build-gcc-newlib' failed

当我从我的SQL Developer执行这个存储过程时,它工作正常,只是更新一些数据,但是当我从VB.net调用相同的存储过程时,它只执行前7个更新,但跳过设置为A列lunes ... viernes。

我还有8个存储过程正常工作,这个是唯一无法正常工作的存储过程。

这是我在VB.net上使用的代码

create or replace 
PROCEDURE LLENADO2 AS 
BEGIN

UPDATE TEMPORALREAL TR
SET TR.LUNES=' ';

UPDATE TEMPORALREAL TR
SET TR.MARTES=' ';

UPDATE TEMPORALREAL TR
SET TR.MIERCOLES=' ';

UPDATE TEMPORALREAL TR
SET TR.JUEVES=' ';

UPDATE TEMPORALREAL TR
SET TR.VIERNES=' ';

UPDATE TEMPORALREAL TR
SET TR.SABADO=' ';

UPDATE TEMPORALREAL TR
SET TR.DOMINGO=' ';

FOR I IN (
SELECT NO,TO_CHAR(DATETIME,'DAY') AS DIA FROM ARCHIVO GROUP BY NO,    TO_CHAR(DATETIME, 'DAY')
  ) LOOP

  IF I.DIA='LUNES    ' THEN
  UPDATE TEMPORALREAL T
  SET T.LUNES= 'A'
  WHERE T.NUMERO_EMPLEADO=I.NO;


  ELSIF  I.DIA='MARTES   ' THEN
  UPDATE TEMPORALREAL T
  SET T.MARTES = 'A'
  WHERE T.NUMERO_EMPLEADO=I.NO;


  ELSIF I.DIA='MIÉRCOLES' THEN
  UPDATE TEMPORALREAL T
  SET T.MIERCOLES= 'A'
  WHERE T.NUMERO_EMPLEADO =I.NO;


  ELSIF I.DIA='JUEVES   ' THEN
  UPDATE TEMPORALREAL T
  SET T.JUEVES = 'A'
  WHERE T.NUMERO_EMPLEADO= I.NO;

  ELSIF I.DIA='VIERNES  ' THEN
  UPDATE TEMPORALREAL T
  SET T.VIERNES = 'A'
  WHERE T.NUMERO_EMPLEADO= I.NO;

  ELSIF I.DIA='SÁBADO' THEN
  UPDATE TEMPORALREAL T
  SET T.SABADO = 'A'
  WHERE T.NUMERO_EMPLEADO = I.NO;

  ELSIF I.DIA='DOMINGO' THEN
  UPDATE TEMPORALREAL T
  SET T.DOMINGO = 'A'
  WHERE T.NUMERO_EMPLEADO = I.NO;

  END IF;
    END LOOP;
  COMMIT;
  END LLENADO2;

请告诉我我做错了什么。

提前致谢

1 个答案:

答案 0 :(得分:1)

我敢打赌T(*)(T,T)没有被跳过。我打赌,当从VB.net应用程序调用过程时,LOOPIF语句都不会评估为ELSIF,因为两个环境之间的NLS设置存在差异。我猜想VB.net应用程序没有设置为默认为西班牙语。

我的猜测是,您希望确保使用西班牙语将true转换为一天,而不管会话的语言设置如何。为此,您需要在datetime

中明确指定语言
to_char

我想你真的想要使用格式掩码TO_CHAR(DATETIME,'DAY','NLS_DATE_LANGUAGE=Spanish') 而不是fmDAY,这样你就不必在比较字符串中包含额外的空格。根据环境的不同,您可能希望获取日期编号而不是日期名称,因为这在更多NLS设置中很常见,并且对于可能不会说西班牙语的开发人员来说很清楚。