如何从程序等于
的spring数据JPA调用存储过程过程CREATE OR REPLACE PROCEDURE ERPDEV.INTG_TO_TRAN_PROC AS IN_USER_ID NUMBER;
IN_USER_DEVICE_ID NUMBER;
IN_IN_DATE DATE;
IN_IN_TIME DATE;
IN_OUT_TIME DATE;
IN_DIFF_TIME NUMBER;
IN_USER_DEVICE_LOCATION VARCHAR2(25);
IN_FLOOR_TIME NUMBER;
BEGIN FOR REC1 IN (SELECT
C.USER_ID,
C.USER_DEVICE_ID
FROM USER_DEVICE_MAP C) LOOP IN_USER_ID := REC1.USER_ID;
IN_USER_DEVICE_ID := REC1.USER_DEVICE_ID;
IN_FLOOR_TIME := 0;
FOR REC IN (SELECT
B.DEVICE_ID,
B.USER_DEVICE_ID,
B.USER_DEVICE_LOCATION,
B.IN_DATE,
B.IN_TIME,
B.OUT_TIME
FROM BIOMETRIC_INTEGRATION B
WHERE B.USER_DEVICE_ID = IN_USER_DEVICE_ID AND B.IN_DATE = TO_DATE(SYSDATE)
ORDER BY B.DEVICE_ID) LOOP IN_USER_DEVICE_LOCATION := REC.USER_DEVICE_LOCATION;
IN_IN_TIME := REC.IN_TIME;
IN_OUT_TIME := REC.OUT_TIME;
IN_IN_DATE := REC.IN_DATE;
IN_DIFF_TIME := 0;
IN_DIFF_TIME := (IN_OUT_TIME - IN_IN_TIME) * 24;
IN_FLOOR_TIME := IN_FLOOR_TIME + IN_DIFF_TIME;
END LOOP;
INSERT INTO BIOMETRIC_TRANSACTION (TRAN_ID, USER_ID, USER_DEVICE_ID, USER_DEVICE_LOCATION, IN_DATE, FIRST_IN_TIME, LAST_OUT_TIME, TOTAL_TIME_ON_FLOOR)
VALUES
(BIO_TRAN_SEQ.NEXTVAL, IN_USER_ID, IN_USER_DEVICE_ID, IN_USER_DEVICE_LOCATION, IN_IN_DATE, (SELECT MIN(IN_TIME)
FROM
BIOMETRIC_INTEGRATION
WHERE USER_DEVICE_ID =
IN_USER_DEVICE_ID),
(SELECT MAX(OUT_TIME)
FROM BIOMETRIC_INTEGRATION
WHERE USER_DEVICE_ID = IN_USER_DEVICE_ID), ROUND(IN_FLOOR_TIME, 2));
END LOOP;
COMMIT;
END;
答案 0 :(得分:0)
尝试如下:
@Entity
@NamedStoredProcedureQuery(name = "User.plus1", procedureName = "plus1inout", parameters = {
@StoredProcedureParameter(mode = ParameterMode.IN, name = "arg", type = Integer.class),
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "res", type = Integer.class)
})
public class User {}
@Procedure("plus1inout")
Integer explicitlyNamedPlus1inout(Integer arg);