How to avoid Σ access to S when compiling in plsql?

We associate the use of the Σ symbol in our plsql packages. When we collect the packages and execute them, the Σ symbol goes into "S". Is there any way to avoid this?

Here is an example:

declare -- Local variables here i varchar2(10); begin dbms_output.put_line('hello - Σ '); end; 

Exit

 hello - S 
+3
source share
2 answers

This is not a valid ASCII character, so you need to use unicode, for example:

 dbms_output.put_line('hello - ' || unistr('\03A3') || ' '); 

Please note that dbms_output may not display the correct character depending on your character set.

+4
source

The PL / SQL source code is stored in the database in the database character set . Databases using UTF-8 can use UTF-8 also in the PL / SQL source code:

 with nls_parameters as ( SELECT 1 as depth, 'SESSION' as "LEVEL", parameter, value FROM nls_session_parameters union all SELECT 2 as depth, 'INSTANCE' as "LEVEL", parameter, value FROM nls_instance_parameters union all SELECT 3 as depth, 'DATABASE' as "LEVEL", parameter, value FROM nls_database_parameters ) select "LEVEL", parameter, '''' || value || '''' as value from nls_parameters where parameter = 'NLS_CHARACTERSET' order by parameter, depth ; LEVEL PARAMETER VALUE -------- ---------------- ---------- DATABASE NLS_CHARACTERSET 'AL32UTF8' 

Example:

 $ cat /tmp/foo.sql create procedure foo is begin dbms_output.put_line('hello - Σ '); dbms_output.put_line('μεταφρασμένο από το Google!'); end; / $ SQL> @/tmp/foo Procedure created. SQL> exec foo hello - Σ μεταφρασμένο από το Google! PL/SQL procedure successfully completed. SQL> 

Another example:

 $ cat /tmp/foo.sql create procedure fooΣ is Σ number := 100; begin dbms_output.put_line('hello - Σ = ' || Σ); dbms_output.put_line('μεταφρασμένο από το Google!'); end; / SQL> @/tmp/foo Procedure created. SQL> exec fooΣ hello - Σ = 100 μεταφρασμένο από το Google! PL/SQL procedure successfully completed. SQL> 

Please note that I am using a linux terminal that understands UTF-8.

+1
source

Source: https://habr.com/ru/post/1209594/


All Articles