sql-scripts

How can I describe a table in Oracle without using the DESCRIBE command?

∥☆過路亽.° 提交于 2019-11-26 09:44:27
问题 I\'m having a hard time with a class I am taking. We need to write an Oracle script that will act just like the DESCRIBE command. The book we are using describes how to work with the Data Dictionary very poorly. Not looking for answers, but a point in the correct direction. 回答1: You're looking for USER_TAB_COLUMNS - all the columns, and their descriptions in the schema the query is executed in - or ALL_TAB_COLUMNS - the same except for all tables that user has permission to view. A typical

How to Execute SQL Script File in Java?

こ雲淡風輕ζ 提交于 2019-11-26 04:25:04
问题 I want to execute an SQL script file in Java without reading the entire file content into a big query and executing it. Is there any other standard way? 回答1: There is no portable way of doing that. You can execute a native client as an external program to do that though: import java.io.*; public class CmdExec { public static void main(String argv[]) { try { String line; Process p = Runtime.getRuntime().exec ("psql -U username -d dbname -h serverhost -f scripfile.sql"); BufferedReader input =