opal-tools icon indicating copy to clipboard operation
opal-tools copied to clipboard

implementing prompting for variables in sql scripts

Open daust opened this issue 3 years ago • 1 comments

When running sql scripts with SQLplus or SQLcl you can define variables in the script and you will be prompted for them, e.g.:

define LABEL=&&1

select user "&&LABEL." from dual;

This is currently not supported. But it should be.

daust avatar Jan 24 '22 15:01 daust

It is more difficult than expected. But in the code I can put the values into a HashMap, sqlcl will then process it.

Looked at the sample code here: https://github.com/oracle/oracle-db-tools/blob/master/sqlcl/examples/customAccept.sql

Had a conversation with Kris Rice on the topic: https://twitter.com/daust_de/status/1485546387311845378

daust avatar Jan 29 '22 14:01 daust