Problem while inserting data in unix env [message #651681] |
Mon, 23 May 2016 05:04 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amit.sonar
Messages: 98 Registered: December 2009 Location: Mumbai
|
Member |
|
|
Hi All,
I am trying to insert data in a table using unix environment. In my data, there are special characters.
while loading data into table in unix environment, those special characters get converted into junk character and get inserted into table.
Could you please help me on this?
Reards,
Amit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Problem while inserting data in unix env [message #651696 is a reply to message #651695] |
Mon, 23 May 2016 06:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/a59247482a11edb9544247f102223e8d?s=64&d=mm&r=g) |
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Quote:
So you think because something "worked", actually it does not you just have been lucky to get the expected result, it will work for ALL other people, without knowing what was your problem and what is his.
This is a silly behavior.
yes it may be luckily.
Can u please suggest us what is the solution and how to check NLS_LANG below query?
SELECT DECODE (parameter,
'NLS_CHARACTERSET', 'CHARACTER SET',
'NLS_LANGUAGE', 'LANGUAGE',
'NLS_TERRITORY', 'TERRITORY'
) NAME,
VALUE
FROM v$nls_parameters
WHERE parameter IN ('NLS_CHARACTERSET', 'NLS_LANGUAGE', 'NLS_TERRITORY')
|
|
|
|
|
|
|
|
|
|
Re: Problem while inserting data in unix env [message #651709 is a reply to message #651707] |
Mon, 23 May 2016 08:43 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amit.sonar
Messages: 98 Registered: December 2009 Location: Mumbai
|
Member |
|
|
Michel Cadot wrote on Mon, 23 May 2016 18:28
Just execute "env | grep NLS" from Unix prompt.
You didn't say which client tool you use, is this SQL*Plus?
I executed env | grep NLS but no output. seems the env variable has not declared.
Also executed following command and it is cleared that the variable NLS_LANG is not set in the environment.
SQL> @[%NLS_LANG%]
SP2-0310: unable to open file "[%NLS_LANG%].sql"
SQL>
[Updated on: Mon, 23 May 2016 08:57] Report message to a moderator
|
|
|
|
Re: Problem while inserting data in unix env [message #651711 is a reply to message #651710] |
Mon, 23 May 2016 09:22 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amit.sonar
Messages: 98 Registered: December 2009 Location: Mumbai
|
Member |
|
|
BlackSwan wrote on Mon, 23 May 2016 19:48do you have a data storage problem (incorrect characters in the database table)?
or
do you have a data presentation problem (incorrect characters displayed when SELECTED)?
SELECT COLUMN1, ASCIISTR(COLUMN1) FROM TABLEA WHERE ID = 1;
convert SELECT above to work in your environment & post results using COPY & PASTE
SQL> desc test_lang
Name Null? Type
----------------------------------------- -------- ----------------------------
LANG NVARCHAR2(50)
SQL> insert into test_lang values('Série');
1 row created.
SQL> select * from test_lang;
LANG
--------------------------------------------------
S??rie
SQL> commit;
Commit complete.
SQL> select lang,ASCIISTR(lang) from test_lang;
LANG
--------------------------------------------------
ASCIISTR(LANG)
--------------------------------------------------------------------------------
S??rie
S\FFFD\FFFDrie
|
|
|
|
|
Re: Problem while inserting data in unix env [message #651734 is a reply to message #651714] |
Tue, 24 May 2016 03:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amit.sonar
Messages: 98 Registered: December 2009 Location: Mumbai
|
Member |
|
|
Michel Cadot wrote on Mon, 23 May 2016 20:16amit.sonar wrote on Mon, 23 May 2016 15:43Michel Cadot wrote on Mon, 23 May 2016 18:28
Just execute "env | grep NLS" from Unix prompt.
You didn't say which client tool you use, is this SQL*Plus?
I executed env | grep NLS but no output. seems the env variable has not declared.
Also executed following command and it is cleared that the variable NLS_LANG is not set in the environment.
SQL> @[%NLS_LANG%]
SP2-0310: unable to open file "[%NLS_LANG%].sql"
SQL>
If NLS_LANG is not set then you tell Oracle you use the default character set which does not contain any "special" character, so Oracle has to convert these ones to something you know and to do so it replaces these characters by one that is named a replacement character.
Tell Oracle the character set you actually used and there should be no problem.
As you are in Linux, generally your OS character set is UTF8 and so you have to set NLS_LANG with AL32UTF8.
Read Setting the NLS_LANG Environment Variable and Setting NLS_LANG.
Is there any other way to do it without changing environmental variable?
|
|
|
|
|
|
|
Re: Problem while inserting data in unix env [message #651751 is a reply to message #651744] |
Tue, 24 May 2016 08:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amit.sonar
Messages: 98 Registered: December 2009 Location: Mumbai
|
Member |
|
|
Michel Cadot wrote on Tue, 24 May 2016 15:46
It is an Oracle only variable.
If you not use it you have bad data in your database.
I don't see where is the problem.
So the choice is:
not use it and have bad data <-> use it and have correct data
Just tell that and you will have all approvals.
Hi Michel,
Yes, correctly said. Will do it in the same way.
Thank you for your inputs and appreciate your efforts.
Regards,
Amit Sonar
|
|
|
|
Re: Problem while inserting data in unix env [message #651755 is a reply to message #651750] |
Tue, 24 May 2016 09:33 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68665 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
mist598 wrote on Tue, 24 May 2016 14:45Hi Michel,
what columns values we need to fetch and see from V$SESSION_CONNECT_INFO View
What about the documentation?
Hint:
SQL> desc V$SESSION_CONNECT_INFO
Name Null? Type
-------------------------------- -------- ----------------------
SID NUMBER
SERIAL# NUMBER
AUTHENTICATION_TYPE VARCHAR2(26)
OSUSER VARCHAR2(30)
NETWORK_SERVICE_BANNER VARCHAR2(4000)
CLIENT_CHARSET VARCHAR2(40)
CLIENT_CONNECTION VARCHAR2(13)
CLIENT_OCI_LIBRARY VARCHAR2(27)
CLIENT_VERSION VARCHAR2(40)
CLIENT_DRIVER VARCHAR2(9)
CLIENT_LOBATTR VARCHAR2(23)
Which one could give the client character set?
|
|
|