By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

how to execute script from file within function

P: 2
Hi,
is it posible to execute script from file within function (sql or pl/sql or ...)
Jan 20 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 534
If you want to execute a shell script, or an operating system command you may need to write your function in C, or java, or sh.
Check out these links:

http://www.postgresql.org/docs/8.2/static/xplang.html

http://www.postgresql.org/docs/8.2/s...ternal-pl.html
Jan 23 '07 #2

P: 2
If you want to execute a shell script, or an operating system command you may need to write your function in C, or java, or sh.
Check out these links:

http://www.postgresql.org/docs/8.2/static/xplang.html

http://www.postgresql.org/docs/8.2/s...ternal-pl.html
OK,thanks.
And what about a SQL script from file?
Jan 25 '07 #3

Expert 100+
P: 534
You can submit a file containing your sql statements using psql:
Expand|Select|Wrap|Line Numbers
  1. psql -f  <pathname>
  2.  
Jan 25 '07 #4

Expert 100+
P: 534
I failed to mention that depending on whether the PG* variables are set in your environment the command-line to psql may need to include more arguments (dbname, username, etc)

follow this link for details:

http://www.postgresql.org/docs/8.0/i.../app-psql.html
Jan 25 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.