How to call stored procedure in Oracle from ADF?

Bansal, Nimish 60 Reputation points
2024-11-19T14:17:20.14+00:00

I have a stored procedure called test_proc in my oracle database. When I execute Script activity in my pipeline with the query "exec test_proc", it gives "Invalid SQL statement" error. PFB screenshots.

User's imageUser's image

Any solutions for this?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
0 comments No comments
{count} votes

Accepted answer
  1. Amira Bedhiafi 33,071 Reputation points Volunteer Moderator
    2024-11-19T22:54:48.9633333+00:00

    To call a stored procedure in Oracle from Azure Data Factory (ADF) and resolve the "Invalid SQL statement" error, follow these steps:

    1. Correct SQL Syntax for Oracle: Oracle does not use EXEC to call stored procedures. Instead, use the CALL statement or use an anonymous PL/SQL block. Example:
      
         CALL test_proc;
      
      
      Or, if your procedure has parameters:
      
         CALL test_proc(param1, param2);
      
      
    2. Use PL/SQL Block (if needed): If the procedure requires a PL/SQL block:
      
         BEGIN
      
            test_proc;
      
         END;
      
      
    3. Script Activity Setup: Ensure that the "Script Activity" in ADF is configured correctly:
      • Ensure your query is using one of the above syntaxes.
      • Ensure the ADF connection to the Oracle database is valid and points to the correct schema.
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.