0

How do you pass multiple variables in the form of a string?

I had this issue, when trying to make a query (And I couldn't use a procedure)

SELECT 
  * 
FROM 
  xxxx
WHERE 
  id IN ( 913456,412548,1225 )
0

2 Answers 2

0

Solution:

in_ids := '1;457;988;';

SELECT Substr(in_ids, a.pos_from, a.length) ids
FROM   (SELECT Lag(c.poscomma, 1, 0) over (ORDER BY c.poscomma)
               + 1                   pos_from,
               c.poscomma            pos_to,
               Abs(Lag(c.poscomma, 1, 0) over (ORDER BY c.poscomma)
                   + 1 - c.poscomma) length
        FROM   (SELECT Substr(in_ids, LEVEL, 1) AS CHARACTER,
                       LEVEL                  AS poscomma
                FROM   dual
                CONNECT BY LEVEL <= Length(in_ids)) c
        WHERE  c.CHARACTER = ';') a;
Sign up to request clarification or add additional context in comments.

Comments

0
SELECT * FROM Customers
WHERE Country IN ('Germany', 'France', 'UK');

Checkout this

1 Comment

It was actually a Q&A answer, so I already had it. I needed to pass a parameter into a query, because I was using a tool that is unable to work with procedures and refcursors.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.