Skip to main content
Solved

Using ampersand , “&” in plsql as a character

  • November 14, 2021
  • 9 replies
  • 4408 views

Forum|alt.badge.img+2

Hi,

I want to write a plsql script for a quick report with using ampersand symbol, “&”, as a character in the where clause in the code. But when run the report it gives me the error “Invalid member name.”  How can I solve  it? 

Thanks You

 

Best answer by Charith Epitawatta

Hi @XitThariK,

If what you have is something similar to this:

WHERE name = 'Dungeons & Dragons' 

You can replace it using the ASCII code for ampersand ‘chr(38)’ like this:

WHERE name = 'Dungeons ' || chr(38) || ' Dragons' 

I tested this and it worked. 

Hope this helps!

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

Minoshini Fonseka
Superhero (Employee)
Forum|alt.badge.img+19

@XitThariK : Do you have any comments added in the query? Incase, if you have such, you could remove and give a try to run the QR again. 


Forum|alt.badge.img+12
XitThariK wrote:

Hi,

I want to write a plsql script for a quick report with using ampersand symbol, “&”, as a character in the where clause in the code. But when run the report it gives me the error “Invalid member name.”  How can I solve  it? 

Thanks You

 

 

I believe you can use concatenation, as outlined here:

https://community.oracle.com/tech/developers/discussion/468604/escaping-ampersand-in-queries

 

Good luck!

Joe Kaufman


Forum|alt.badge.img+2
  • Do Gooder (Partner)
  • November 15, 2021

I tried the both but didn’t solved it.


Minoshini Fonseka
Superhero (Employee)
Forum|alt.badge.img+19

@XitThariK : What is the IFS application track you use?

 


Forum|alt.badge.img+6
  • Do Gooder
  • November 15, 2021

Hi, 

 

You could use this  replace('Test&Test','&','And')  = ‘TestAndTest’. 

 

Thanks 

L P Reddy 


Charith Epitawatta
Ultimate Hero (Employee)
Forum|alt.badge.img+31

Hi @XitThariK,

If what you have is something similar to this:

WHERE name = 'Dungeons & Dragons' 

You can replace it using the ASCII code for ampersand ‘chr(38)’ like this:

WHERE name = 'Dungeons ' || chr(38) || ' Dragons' 

I tested this and it worked. 

Hope this helps!


Forum|alt.badge.img+2
  • Do Gooder (Partner)
  • November 15, 2021

Hi Charith Epitawatta,

 

Thank You Very much. It get worked. 

 

 


Forum|alt.badge.img+2
  • Do Gooder (Partner)
  • November 15, 2021

Thanks you  everyone 


Minoshini Fonseka
Superhero (Employee)
Forum|alt.badge.img+19

Hi @XitThariK ,

@Charith Epitawatta ‘s suggestion will work for you undoubtedly.  

Additiionally I would like to provide a small input from my side.. This is using LIKE clause..  

  • PL SQL Query

 
Quick report

select * from customer_info_tab
where name like 'Deals _ Done Limited'


 

 


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