简体   繁体   中英

No output while executing SQL query in Java

When I run the below code in Oracle SQL, it shows output. But when I execute it through PreparedStatement in Java, there's no output in ResultSet.

select p.table_name, 'is parent of ' rel, c.table_name
from   all_constraints p
join   all_constraints c on c.r_constraint_name = p.constraint_name
                         and c.r_owner = p.owner
where p.table_name = '<table-name>'    
union all
select c.table_name, 'is child of ' rel, p.table_name
from   all_constraints p
join   all_constraints c on c.r_constraint_name = p.constraint_name
                         and c.r_owner = p.owner
where c.table_name = '<table-name>'    ;

Sorry, Actually all_constraints table can be accessed only with SYSDBA privileges. So, I gave SYSDBA privilege and executed. It worked fine.

Thank You for all your responses. Cheers..

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM