CREATE OR REPLACE FUNCTION F_GETPREJOBTIME (CTABLE IN VARCHAR)
RETURN DATE IS
RESULTS USER_JOBS.LAST_DATE%TYPE;
BEGIN
SELECT LAST_DATE
INTO RESULTS
FROM USER_JOBS
WHERE WHAT LIKE CTABLE+ '% '
FOR UPDATE NOWAIT;
IF RESULTS IS NULL THEN
RETURN (TO_DATE( '2007-01-01 ', 'yyyy-MM-dd '));
ELSE
RETURN(RESULTS);
END IF;
END F_GETPREJOBTIME;
/
------解决方案--------------------
SELECT LAST_DATE
INTO RESULTS
FROM USER_JOBS
WHERE WHAT LIKE CTABLE+ '% '
FOR UPDATE NOWAIT;
-----------------------------------------
SELECT LAST_DATE
INTO RESULTS
FROM USER_JOBS
WHERE WHAT LIKE CTABLE || '% '
FOR UPDATE NOWAIT;