oracle - passing shell variable to plsql procedure -


i trying run procedure shell script. issue parameters not read procedure

#! /bin/bash  circle="genx" date="2015/09/29" version="v2"  /usr/oracle/u01/app/product/11.2.0/client_1/bin/sqlplus admin/admin@testdb <<"eof" begin gen_automation.delete_invalid_data('$circle','$date','$version'); commit; end; / "eof" 

it doesn't heredoc limit string being quoted; can reproduce , removing quotes fixes it:

/usr/oracle/u01/app/product/11.2.0/client_1/bin/sqlplus admin/admin@testdb <<eof begin gen_automation.delete_invalid_data('$circle','$date','$version'); commit; end; / eof 

this nothing oracle, it's how shell , heredoc working; this:

cat <<"eof" $circle "eof" 

... prints $circle instead of genx too.

this known behaviour:

quoting or escaping "limit string" @ head of here document disables parameter substitution within body. reason quoting/escaping limit string escapes $, `, , \ special characters, , causes them interpreted literally.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -