暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 编译java源时出错

askTom 2017-09-20
309

问题描述

嗨,
我的问题是
在编译java源代码时,我收到警告:
JAVA源编译
警告: 执行完成并警告
无法解析对象详细信息

代码:
create or replace and compile java source named "DirTestList" 
as 
import java.io.*; 
import java.sql.*; 
 
 public class DirTestList
 { 
 public static void getList(String directory) 
 throws SQLException 
 { 
 File path = new File( directory ); 
 String[] list = path.list(); 
 String element; 
 
 for(int i = 0; i < list.length; i++) 
 { 
 element = list[i]; 
 #sql { INSERT INTO test_list (FILENAME) 
 VALUES (:element) }; 
 } 
 } 
 
 } 


你能帮忙吗?

谢谢

专家解答

您的架构中是否有一个名为test_list的表,其中包含文件名列?

因为一旦存在,它对我来说都是笨拙的:

create or replace and compile java source named "DirTestList" 
as 
import java.io.*; 
import java.sql.*; 
 
 public class DirTestList
 { 
 public static void getList(String directory) 
 throws SQLException 
 { 
 File path = new File( directory ); 
 String[] list = path.list(); 
 String element; 
 
 for(int i = 0; i < list.length; i++) 
 { 
 element = list[i]; 
 #sql { INSERT INTO test_list (FILENAME) 
 VALUES (:element) }; 
 } 
 } 
 
} 
/
sho err

Errors for JAVA SOURCE CHRIS."DirTestList":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      Info: 1 warnings
0/0      ^
0/0      #sql { INSERT INTO test_list (FILENAME)
0/0      VALUES ( ...  ) ;
0/0      ^^^^^^^^^
0/0      INSERT INTO test_list (FILENAME)
0/0      DirTestList:16: Warning: Database issued an error: PL/SQL: ORA-00942: table or view does not exist

create table test_list ( filename varchar2(10) ); 

create or replace and compile java source named "DirTestList" 
as 
import java.io.*; 
import java.sql.*; 
 
 public class DirTestList
 { 
 public static void getList(String directory) 
 throws SQLException 
 { 
 File path = new File( directory ); 
 String[] list = path.list(); 
 String element; 
 
 for(int i = 0; i < list.length; i++) 
 { 
 element = list[i]; 
 #sql { INSERT INTO test_list (FILENAME) 
 VALUES (:element) }; 
 } 
 } 
 
} 
/
sho err

No errors.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论