cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
carbluc
Frequent Visitor

Paramenter list in SQL - to be used as variables with quotes and commas

Hello Community,

 

I have this SQL query for Oracle DB:

 

SELECT *
FROM
myTables
WHERE
OBS_DATE > (trunc(sysdate) - 365)

AND NAME in (

LIST OF VARIABLES 

)

 

 

The LIST of VARIABLES is usually an alphanumeric number and it must have quotes:

for instance:

'PPF000000028300444',
'PPF000000028300334'

 

I would like to have a Parameter that I can udpate and holds a list of this codes, with commas and quotes.

 

Therfore, how can I have inside the above query a parameter with my LIST of VARIABLES?

 

Thank you in advance,

Luca.

1 ACCEPTED SOLUTION

Accepted Solutions
carbluc
Frequent Visitor

Re: Paramenter list in SQL - to be used as variables with quotes and commas

So the secret is:

 

go into edit query -> advance editor -> put in the query NAME in ('"&PARAMETER_NAME&"').

 

since the parameter is aphanumeric: format such parameter as text.

 

Done. 

View solution in original post

1 REPLY 1
carbluc
Frequent Visitor

Re: Paramenter list in SQL - to be used as variables with quotes and commas

So the secret is:

 

go into edit query -> advance editor -> put in the query NAME in ('"&PARAMETER_NAME&"').

 

since the parameter is aphanumeric: format such parameter as text.

 

Done. 

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors