Skip to main content
Question

I want to call the stored procedure using JavaScript in AA


Forum|alt.badge.img+2

Hi,

below is the javascript which I am trying to call but getting error.

Kindly help me

const oracle = require('oracle');

const connection = oracle.createConnection({
  host: '',
  port:'',
  user: '',
  password: '',
  servicename: ''
});

connection.connect();

const myProcedure = "CALL SPNAME(parameter1, parameter2, @return_code); SELECT @return_code;";

connection.query(myProcedure, ['?', '?'], (err, rows) => {
  if (err) {
    throw err;
  }

  const outputParam = rows[1][0]['@return_code'];
  console.log(outputParam);
});

connection.end();

4 replies

rbkadiyam
Mission Commander | Tier 5
Forum|alt.badge.img+17
  • Mission Commander | Tier 5
  • 587 replies
  • April 12, 2023

@Priyanka.H2 what error u r getting


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 7 replies
  • April 12, 2023

Named export 'createConnection' not found. The requested module 'oracle' is a CommonJS module, which may not support all module.exports as named exports.


Forum|alt.badge.img+6
  • Navigator | Tier 3
  • 142 replies
  • April 12, 2023

You are using this wrong. This script won’t run using run JavaScript action.
require() is not part of the standard JavaScript API. But in Node.js, it's a built-in function with a special purpose: to load modules.


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 7 replies
  • April 12, 2023

can you please help me with the basic javascript code. I want to call the stored procedure with input parameter in AA.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings