Hello, I want to get a sql select output into a psql variable. Any
ideas how I might need to do this. My script executes a function which returns a TESTID. I’d
like to imbed the testid in the script output filenames. I see that psql can set environment variables with the psql
\i command. But got any idea how I can get sql output into a psql
variable? Thanks Doug psql orbitz=# \!testvar=1234 orbitz=# \!export testvar orbitz=# \!echo $testvar 1234 orbitz=# \q -bash-3.00$ echo $testvar 1234 But I’m unsure how I can get the pgsql return
code into a psql variable The shell script current psql p1gp1
<<QUIT >>$LOGFile 2>&1 \set ON_ERROR_STOP select da_test.QATestBuild(false) QUIT I’d like to do something like this from my
shell script psql p1gp1
<<QUIT >>$LOGFile 2>&1 \set ON_ERROR_STOP select da_test.QATestBuild(false) into :testid \!testid=:testid \!export $testid QUIT Echo $testid 1234 Doug Little Sr. Data Warehouse Architect | 500 W. Douglas.Little@xxxxxxxxxx
orbitz.com
| ebookers.com | hotelclub.com | cheaptickets.com | ratestogo.com | asiahotels.com |