0

Here's how my query looks like :

Edit (I have near to none experience with PLSQL, I just read on some post if you're using Begin/End in your script, you no longer can use plain select, you should insert that result into somewhere! ) can this be the reason the query doesn't work in SSIS? )

   Variable x1 Number
   Variable x2 Number
   Variable x3 Number




   Variable x20 Number


   Begin  select user_defined_function(parameters) into x1 from dual; 
    select user_defined_function(parameters) into x2 from dual; 
    select user_defined_function(parameters) into x3 from dual; 


    select user_defined_function(parameters) into x20 from dual; 

   End;
    / 

    with Q1 as (....) 
    , Q2 as (....)
    , Q3 as (...)

    Select * from Q1,Q2,Q3 joining together 

The query works in SQL developer, however I have to use execute script instead of f5. otherwise it will prompt for variable values.

As I suspected, the query in its current format doesn't work in SSIS. I get the error INVALID SQL STATEMENT 900

11
  • Do you intend on providing the variable values at runtime? Often with Oracle I've had to resort to a dynamically generated SQL string. Commented Nov 10, 2020 at 21:53
  • @Nick.McDermaid the variable values are supposed to be retrieved via the select statements user defined functions. I won't enter anything Commented Nov 10, 2020 at 21:56
  • @Nick.McDermaid does this mean what I think it means ? The lack of support for parameterized queries in the various Oracle connection managers is an unfortunate limitation in SSIS. Commented Nov 10, 2020 at 22:03
  • 2
    Is not the un-balance between the four Begin and the only one End the problem? Commented Nov 10, 2020 at 22:23
  • 1
    @MarmiteBomber Thanks for picking that up, I fixed it here. my actual script didn't have this issue Commented Nov 11, 2020 at 1:41

1 Answer 1

1

You may use additional CTO for passing the results of the user_defined_function into the main query, such as

with  
x1 as (
   select user_defined_function(parameters) as x1 from dual), 
x2 as (
   select user_defined_function(parameters) as x2 from dual),  
...

In your main query instead of using

column1 = x1

you would write

column1 = (select x1 from x1)

This approach eliminates the need of variables and PL/SQL blocks, and use a pure SQL

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, apparently you can't have PLSQL blocks with plain select in ODBC connections of SSIS
Actually you are using the SQL*Plus syntax of VARIABLE which would not work quite sure. You may try with DECLARE to define variable which would be PL/SQL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.