1

I wish to execute DMLs using bind variable with shell scripts. For example, something like:

#!/bin/bash

SH_NUM=10

sqlplus -S test_user/test_pass <<EOD
var a number;
a:=${SH_NUM}
insert into test_table values(a);
commit;
EOD

I'm not sure if this is possible, I can use this approch when using pl/sql but I wish to know if I can do it this method as well.

closed as off-topic by roaima, Isaac, schily, Jeff Schaller, GAD3R Nov 6 '18 at 16:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – roaima, Isaac, schily, Jeff Schaller, GAD3R
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    what happened when you tried it? – thrig Nov 5 '18 at 16:36
0

Problem is the assigment line, it should be changed to:

exec :a :=${SH_NUM};
  • So it's fixed now? – roaima Nov 6 '18 at 7:28
  • Yes, it solve the issue. – Nir Nov 6 '18 at 8:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.