成功编译错误 JVM Oracle 数据库移动数据

Succes with compiling Error JVM Oracle Database Move Data

我在特定文件夹中有一个数据。我只知道id但是数据的名称包含的不仅仅是一个 ID,因此我使用的是 "listFiles"。出于安全原因,只有数据库可以进入文件系统,因此我想将 java class 上传到我的 oracle 中。但是我的 Oracle DB 总是说它编译成功,但我不知道为什么。

这是我的代码:

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED MOVEFILE as `import java.io.*`;
public class MOVEFILE {
/**
 * Eigentliche Methode zum Verschieben
 */
public static int moveFile(String orgPath, String gewPfad, String dateiID) {
    File folder = new File(orgPath);
    File[] listOfFiles = folder.listFiles(new FilenameFilter(){
        @Override
        public boolean accept(File folder, String name){return name.toLowerCase().contains(dateiID);}});
    String orgDatei = listOfFiles[0].toString();
    File org = new File(orgDatei);
    File gew = new File(gewPfad);
    if (!org.exists())
        return 0;
    if (gew.exists())
        return 0;
    if (copyFile(orgDatei, gewPfad) == 1)
        if (deleteFile(orgDatei) == 1)
            return 1;
    return 0;
}

我有方法 copyFiledeleteFile。当我在没有 moveFile 的情况下编译它们时,它编译成功。

你能帮帮我吗?对不起,我的英语不好。如果您有任何问题,我会尽快回答他们。谢谢:)

我认为 Berger 在评论中说对了。

您不能在为 listOfFiles 定义的匿名内部 class 中引用 dateiID,除非您使 dateiID final.

此外,您不需要在 import 行周围加上单引号。

您可以通过询问数据库问题所在来自己发现这一点,如下所示:

select * 
from dba_errors 
where name = 'MOVEFILE' 
order by sequence;