I have 2 views in SQL Developer, view1 and view2. view1 is created from table1 and view2 is created using unions between 2 other views. BOTH views show expected data on SQL Developer and have same Grants.
I tried to run Java query against view2 but am not getting any results from a "select *", however, i get results fine from view1.
String table = “view2”;
Statement stmt = dataSource.getConnection.createStatement();
ResultSet rs = stmt.executeQuery(“select * from “ + table);
if(rs.next()){ //rs.next() returns true if there is a value from ResultSet
System.out.println(“exist”);
} else {
System.out.println(“doesn’t exist”);
}
If i run view1, i get "exist" and i can print out row values, with view2, i get "doesn't exist". Additional observations:
I am very lost on this... anyone can help? thanks
So it was some permission inside the SQL that is messing it up. it is fixed now! thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.