基本上我想從Postgres中的SQL文件執行SQL文件。可以從SQL腳本中引用另一個SQL文件
爲MySQL類似的問題:is it possible to call a sql script from a stored procedure in another sql script?
爲什麼?
因爲我有一個項目中有2個數據文件,我想要一行可以加載第二個文件的註釋/未註釋。
澄清: 我想從A.SQL調用B.SQL
Clarification2: 這對於那些使用Hibernate創建從最初的SQL文件數據庫中的Spring項目(A. SQL)。
進一步反思,似乎我可能不得不從java /字符串/休眠處理這個。
下面是配置文件:在SQL不支持
spring.datasource.url=jdbc:postgresql://localhost:5432/dbname
spring.datasource.username=postgres
spring.datasource.password=root
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.data=classpath:db/migration/postgres/data.sql
spring.jpa.hibernate.ddl-auto=create
你怎麼想執行的SQL文件?用psql? –
@Tommaso Di Bucchianico我想從另一個文件調用一個sql文件。 –