Skip to Main Content

passing parameters to js script?

anilech_ntsNov 15 2018 — edited Nov 23 2018

Hi! Simple question: how can i pass parameter to js script from sqlcl command line? for me args.length value is always 0.

contents of test.js:

script

print("\nargs.length: "+args.length);

for(var i=1;i<args.length;i++){

  print("arg["+i+"]:"+args[i]);

}

/

exit

C:\oracle>sql /nolog @test.js

SQLcl: Release 18.3 Production on Thu Nov 15 10:55:43 2018

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

args.length: 0

C:\oracle>sql /nolog @test.js par1 par2 par3

SQLcl: Release 18.3 Production on Thu Nov 15 10:55:43 2018

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

args.length: 0 <- i expect 3 here

thanks!

Comments
Post Details
Added on Nov 15 2018
4 comments
261 views