sr123
sr123

Reputation: 117

How to use the euro symbol in PL/SQL code?

Please I have a PL/SQL package where I'm using HTML code.

In the HTML code I need to use the euro symbol (as its HTML code) but when I use € the PL/SQL package considers like if i want to pass him a variable and he keep asking me about the value of euro.

Is there any option that makes the use of € possible in a PL/SQL package?

phrase_conditionnelle := 'Le montant de '||mt_salaire||
                                         ' €</b> ;

Upvotes: 0

Views: 1597

Answers (2)

Alex Poole
Alex Poole

Reputation: 191455

It looks like your client is interpreting the &euro; as a substitution variable:

SQL> select '&euro;' from dual;
Enter value for euro:

You can disable that behaviour with set define off in SQL*Plus, SQL Developer or SQLcl:

SQL> set define off
SQL> select '&euro;' from dual;

'&EURO
------
&euro;

1 row selected.

SQL> set define on; -- optional but restores behaviour

This is nothing to do with PL/SQL really, or even SQL; it's just client behaviour, at the point you try to compile the package - the client is interpreting the & before it passes any code to the database for processing. That also means that sessions calling your package don't need to worry about that setting.

Upvotes: 2

hotfix
hotfix

Reputation: 3396

this is one of the possible way to do that. just replace & by chr(38)

phrase_conditionnelle := 'Le montant de '||mt_salaire|| chr(38)||'euro;' ;

Upvotes: 0

Related Questions