LPX-00283 - Erro na leitura de XML

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
Responder
tora34
Rank: Analista Pleno
Rank: Analista Pleno
Mensagens: 108
Registrado em: Qua, 12 Nov 2008 6:01 pm
Localização: Campo Mourão PR
Renato Pasquini
Oracle Developer

Boa tarde senhores,
desenvolvi uma rotina para ler um arquivo XML.
Porém, após realizar os testes, na base de desenvolvimento e homologação, o programa foi disponibilizado em produção. Porém, em outra unidade (banco de dados na mesma versão do que foi realizado os testes) ao executar a rotina apresenta o erro descrito abaixo.
Minha dúvida é,
tem como setar o unicode padrão do oracle?
Se sim, tem algum comando para consultar o UNICODE do banco?

Segue o cabeçalho do arquivo XML:

Selecionar tudo

<?xml version="1.0" encoding="UTF-8"?>
<ConsultarLoteRpsResponse xmlns="http://www.e-governeapps2.com.br/">
Segue mensagem de erro:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00283: document encoding is UTF-8-based but default input encoding is not Error at line 1
ORA-06512 at SYS.XMLTYPE

Obrigado
Avatar do usuário
dr_gori
Moderador
Moderador
Mensagens: 5024
Registrado em: Seg, 03 Mai 2004 3:08 pm
Localização: Portland, OR USA
Contato:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Veja esse comando:

Selecionar tudo

Select value from SYS.NLS_DATABASE_PARAMETERS where PARAMETER = 'NLS_CHARACTERSET'
Aqui tem bastante coisa sobre unicode no oracle, e também nos manuais:
http://www.querytool.com/help/907.htm
Unicode support with Oracle
ODBC Driver Version
Unicode support is only available when using v8.1.5.5 of the Oracle ODBC Driver or later
Unicode support is not available when using the Microsoft ODBC Driver for Oracle
Data Types
If your database is using a Unicode character set, char, varchar2 and clob data types will hold Unicode values.

Irrespective of your database character set nchar, nvarchar2 and nclob data types will hold Unicode values.

Unicode Character Set Database
Full support of unicode in your Oracle database is only available if your Database Character Set has been set to a unicode character set, such as UTF8. The database character set is specified when your database is defined.

You can find out the database character set with:

Select value from SYS.NLS_DATABASE_PARAMETERS where PARAMETER = 'NLS_CHARACTERSET'

ASCII Character Set Database
If your Oracle database has been defined to use an ascii character set (as opposed to a unicode character set), then you can still store unicode data in your Oracle database. However there are some limitations on what you can do.

you can display unicode data OK
you cannot run an SQL statement containing a unicode literal
you cannot supply a unicode value to a parameter in a parameterised query.
The reason for these limitations is that, when you pass SQL or a parameter to the database, it will convert the values to the character set of the database. If the database uses an Ascii character set, the unicode values will be converted to Ascii characters.

AQT has a circumvention for the point number 2 - this is discussed below.

Beause the Data Loader uses parameterised queries by default, it cannot load unicode values unless you use the Load using Insert Statements option.

Unistr Function
Oracle has a function UNISTR which allows you to specify unicode character values. This allows you to insert or update unicode values in your database, even if your databases uses an Ascii character set.

The UNISTR function is not available in Oracle v8.

Running SQL Statements with Unicode literals
If your database uses a unicode character set, you can run SQL statements that include unicode literals.

If your database uses an Ascii character set, you cannot run SQL statements that include unicode literals. To circumvent this, AQT has an option Unicode Options > For Oracle, use UNISTR for Unicode strings. When this is option is checked, AQT will scan all SQL being processed. If it finds any unicode string values, it will replace them with a unistr function:

Example:

if you run the following:

Select * from HR.TEST1 WHERE COL1 = 'ald'

AQT will actually run:

Select * from HR.TEST1 WHERE COL1 = unistr('\03B1\03BB\03B4')

This makes it very easy to use unicode data in an Oracle database that uses an Ascii characterset.
Qualquer coisa, prende o grito !
Responder
  • Informação