import groovy.sql.Sql
sql = Sql.newInstance(
"jdbc:oracle:thin:@localhost:1521:orcl",
"scott",
"tiger",
"oracle.jdbc.driver.OracleDriver")
view_name = 'EMPVIEW'
query = """
select dbms_metadata.get_ddl('VIEW', ${view_name}) as ddl,
length(dbms_metadata.get_ddl('VIEW', ${view_name})) as lenddl
from dual
"""
sql.eachRow(query){
println("ddl:${it.ddl.getSubString(1L, (int)it.lenddl)}")
println "----"
}
動作環境
Groovy 1.6.4, JDK6 Update16, Oracle11g R1
関連情報
DBMS_METADATA
0 件のコメント:
コメントを投稿