asciistr
Anyone know if there is a bug or a limitation with the PLSQL function asciistr? It seems to give different results from those of the SQL function.
SQL > select *.
the v version $2
3.
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
AMT for IBM/AIX RISC System/6000: release 10.2.0.4.0 - production
NLSRTL Version 10.2.0.4.0 - Production
SQL > select nls_charset_name (nls_charset_id ("CHAR")) database_characterset
2, national_characterset nls_charset_name (nls_charset_id ('NCHAR'))
3 double
4.
LONG DATABASE_CHA
------------ ---------
WE8MSWIN1252 AL16UTF16
SQL > declare
t_buf 2 varchar2 (100);
3. start
4 t_buf: = asciistr (no ABC ');
5 dbms_output.put_line (t_buf);
6 select asciistr (no ABC ') in the double t_buf;
7 dbms_output.put_line (t_buf);
8 end;
9.
¿
ABC
PL/SQL procedure successfully completed.
Sorry I can't reproduce the error with multiple clients (windows/unix, 10.x, 11.x) against 11.2.0.4 database.
Maybe it's that bug 7475862 fixed to 11.2
Tags: Database
Similar Questions
-
ASCIISTR function that gives different results
Hi Experts,
I use the function ASCIISTR and it gives different results in SQLPLUS and TOAD
SQLPLUS
TOADSQL> SELECT ASCIISTR('é') UC FROM DUAL 2 ; UC ----- \201A SQL> SELECT ASCIISTR('ú') UC FROM DUAL; UC ----- \00A3
I know experts here will be reluctant to respond to questions about the TOAD, but I wanted to understand if I'm missing something. I checked the NLS_SESSION_PARAMETERS in SQLPLUS and TOAD, and they are the same. :-(does not understand this behaviorSELECT ASCIISTR('ú') UC FROM DUAL \00FA SELECT ASCIISTR('é') UC FROM DUAL \00E9
Version of database Oracle Database * 10g Enterprise Edition Release 10.2.0.3.0 - 64 bit Production *.
Thanks in advance!The default code for the command line page is 437, identical to TOAD, you want to get the code page 1252
SQL> host chcp Active code page: 437 SQL> SELECT ASCIISTR('é') UC FROM DUAL; UC _____ \201A SQL> host chcp 1252 Active code page: 1252 SQL> SELECT ASCIISTR('é') UC FROM DUAL; UC _____ \00E9 SQL>
-
Hello
I have the following sql to replace unwanted characters in the title (long field). If it can be re-written in a more simple way?
SELECT REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (ASCIISTR (TITLE), CHR (13), "), CHR (10), ' '), '\00BF',"), "\005C", "),"\00A0","), "\00BD", "),"\00A3","), "\00", ")
OF THE DOUBLE
Thank you
Hello
REGEXP_REPLACE is a bit simpler when you have several secondary chains which all have the same replacement. In this case, you have 7 secondary channels which are all replaced by anything else, so you can combine them. There is an another substring, which is replaced by something else, so you will need a second function to deal with, like this:
SELECT REGEXP_REPLACE (REPLACE (ASCIISTR (title)
, CHR (10)
, ' '
)
, CHR (13) | ' | \\00(BF|5C| A0. BD | A3)? »
)
OF the double
;
-
Dealing with the lower ASCII characters
In my database, somehow there are strange lower ASCII characters in some areas. It doesn't happen often, but I have some problems. For example, I found a field with an ASCII 12 x (18 decimal) character, which is something called "Device Control 2. When I run a query like
SET SERVEROUTPUT ON SIZE unlimited
SELECT
p.TX as "TX".
Of
point p
WHERE
para_id = 22623526 / / contains a bad character
Get different results depending on whether I have run into a TOAD with F5 or F9. F9 returns the line after line, but it puts a box where the bad character is
http://Pelorus.org/pictures/ToadAsciiError.PNG
But, if I run it with F5, I get nothing.
1 selected line. < < the single output possible.
If I change the para_id to something else, I get perfectly good output with F5
TX
--------------------------------------------------------------------------------
Milestones begin and end listed in Appendix-a. dates will be used for guidan
for all the work performed by this request for maintenance.
1 selected line.
And even weirder, if I have the coil in a file, I get the data, but has the wrong character.
TX
--------------------------------------------------------------------------------
Tighten each anode zinc new foot nut # 30lb of restraint. [CFR-465]
1 selected line.
(Mark hash added by me, but I can see the ASCII (x 12) in a hex editor.)
Here is a link to the text file with the wrong character
http://Pelorus.org/pictures/Err.txt
My questions are
1. What's happening here?
2. How can I strip this character on? I export it as an xml file, and this character causes me problems.
3. I see other bad characters in a few other places. Namely ASCII 13 x (19 dec) and ASCII 1Dx (29 dec). I hope that the solution to remove easily extrapolate other unwanted characters.
4. ideas how something like that you here in the first place? Cosmic rays?
I tried to use ASCIISTR() to delete, but it did not work.
ASCIISTR (p.TX) AS "TX".
The bad characters are still there.
Server Info:
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE Production 11.2.0.2.0
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
You can use the function to translate to remove unwanted characters from your data:
with t as)
Select 'ab '. Chr (18) | 'cd' union tx double all the
Select 'ab '. Chr (19) | 'cd' double tx
)
Select translate (tx, 'a' | chr (18): chr (19), 'a') t
-
How to know the special character?
I use the Release 10.2.0.1.0 Oracle version. I have a special character, but I suspect it as any other language caharacter.
His appearance in my "quick editor/Sql TOAD Editor" as "has? but when I'm selecting from the table to aid under application, her gives "no rows returned.
Select the tab1 id where id like 'a % ';
Please let me know, how can I be able to see the exact character or what Publisher will allow me to see the character?
I think the sql GUI developer might be able to show the same, but I don't have Developer sql with me.930254 wrote:
I use the Release 10.2.0.1.0 Oracle version. I have a special character, but I suspect it as any other language caharacter.
His appearance in my "quick editor/Sql TOAD Editor" as "has? but when I'm selecting from the table to aid under application, her gives "no rows returned.Select the tab1 id where id like 'a % ';
Please let me know, how can I be able to see the exact character or what Publisher will allow me to see the character?
I think the sql GUI developer might be able to show the same, but I don't have Developer sql with me.Select ASCIISTR (id) in tab1 where id like 'a % ';
-
Unicode hexadecimal conversion
Hello, can someone please tell me how to get the same effect on this Web site, http://mylanguages.org/converter.php, pl sql or oracle sql? They took an Arabic channel and returned one (to my knowledge) hex value.
Thank you very muchOr just REGEXP_REPLACE:
select regexp_replace(asciistr(my_string), '\\([0-9A-F]{4})', '\1;') from dual;
You'll get this, hexagonal instead of decimal digits, but it is completely equivalent:
سليم
-
Error Message ORA-31043: Element 'person' no globally defined in the schema
Hi all
We recorded 2 documents xsd as follows...
DECLARE lc_test_xsd CLOB; BEGIN lc_test_xsd := '<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.xyz.com/cicat/types/basictypes/2/0" targetNamespace="http://www.xyz.com/cicat/types/basictypes/2/0" version="2.0"> <simpleType name="LastNamePrefix"> <annotation> <documentation> Additional word to last name (name prefix) corresponding to SAP HR Core Table T535N; V. </documentation> </annotation> <restriction base="tns:String255" /> </simpleType> <simpleType name="CountryID"> <annotation> <documentation> Codes for the representation of country names according to ISO 3166. </documentation> </annotation> <restriction base="string"> <maxLength value="2" /> </restriction> </simpleType> <simpleType name="LocationCode"> <annotation> <documentation> Code of a location, e.g. Fe, Wa2 or Kor. </documentation> </annotation> <restriction base="string"> <maxLength value="4" /> </restriction> </simpleType> <simpleType name="GenderCode"> <annotation> <documentation> Code of the gender: male, female, unknown. Unknown is used if the value is unknown or must not be stored due to legal restrictions. </documentation> </annotation> <restriction base="string"> <enumeration value="male" /> <enumeration value="female" /> <enumeration value="unknown" /> </restriction> </simpleType> <simpleType name="String255"> <annotation> <documentation> String with 255 characters max </documentation> </annotation> <restriction base="string"> <maxLength value="255" /> <minLength value="1" /> </restriction> </simpleType> <simpleType name="RB-CostCenter"> <annotation> <documentation> Cost Center </documentation> </annotation> <restriction base="string"> <minLength value="3" /> <maxLength value="6" /> </restriction> </simpleType> <simpleType name="OrgUnitName"> <annotation> <documentation> Name of the Organizational Unit </documentation> </annotation> <restriction base="string"> <minLength value="1" /> <maxLength value="18" /> </restriction> </simpleType> <complexType name="StringMCA"> <annotation> <documentation> Multi Country String. Strings, which must be stored in ASCII code and country specific. The subelement ASCIIString contains the string encoded with ASCII. The subelement countrySpecificString allows country specific encoding. </documentation> </annotation> <sequence> <element name="asciiString" type="tns:String255" minOccurs="0" /> <element name="countrySpecificString" type="tns:String255" /> </sequence> </complexType> <simpleType name="OrgUnitID"> <annotation> <documentation> ID of the Organizational Unit </documentation> </annotation> <restriction base="unsignedInt"> <totalDigits value="8" /> </restriction> </simpleType> <simpleType name="GlobalID"> <annotation> <documentation> Global unique identifier of persons at xyz </documentation> </annotation> <restriction base="unsignedInt"> <totalDigits value="8" /> </restriction> </simpleType> <simpleType name="CiCatPersonID"> <annotation> <documentation> CI-CAT Identifier of Persons (CiCat-PID). Unique identifier of a person in CI-CAT </documentation> </annotation> <restriction base="unsignedInt"> <totalDigits value="20" /> </restriction> </simpleType> <simpleType name="CiCatAccountID"> <annotation> <documentation> CI-CAT Identifier of AD Accounts (CiCat-Ben-Sid). Unique identifier of AD Accounts in CI-CAT. </documentation> </annotation> <restriction base="unsignedInt"> <totalDigits value="20" /> </restriction> </simpleType> <simpleType name="PersonnelActionTypeCode"> <annotation> <documentation> The operation that was performed on the person: entry, data change, re-entry (into company), exit (out of company) </documentation> </annotation> <restriction base="string"> <enumeration value="entry" /> <enumeration value="data change" /> <enumeration value="re-entry" /> <enumeration value="exit" /> </restriction> </simpleType> <simpleType name="ContractStatus"> <annotation> <documentation> Contract Status: active, inaktive, resigned, retired </documentation> </annotation> <restriction base="string"> <enumeration value="retired"> <annotation> <documentation> End of contract relationship because of retirement </documentation> </annotation> </enumeration> <enumeration value="resigned"> <annotation> <documentation> End of contract because of quitting </documentation> </annotation> </enumeration> <enumeration value="inactive"> <annotation> <documentation> Incactive contract relationship, e.g. motherhood, suspension </documentation> </annotation> </enumeration> <enumeration value="active"> <annotation> <documentation> Normal contract status </documentation> </annotation> </enumeration> <enumeration value="deleted"> <annotation> <documentation> Contract physically deleted in the source system </documentation> </annotation> </enumeration> </restriction> </simpleType> <simpleType name="KnownAssociateCode"> <annotation> <documentation> Describes status of person to xyz: internal/external/fixed-term </documentation> </annotation> <restriction base="string"> <enumeration value="External" /> <enumeration value="Internal" /> <enumeration value="Fixed Term" /> <enumeration value="unknown" /> </restriction> </simpleType> <simpleType name="AssociateCode"> <annotation> <documentation> Describes status of person to xyz: union of known values plus free string for not yet known types </documentation> </annotation> <union memberTypes="tns:KnownAssociateCode string" /> </simpleType> <simpleType name="KnownExternalRelationType"> <annotation> <documentation> Describes relation (contract relation) of external person to xyz: contractor/customer/supplier/subsidiary/selfregistered </documentation> </annotation> <restriction base="string"> <enumeration value="Contractor" /> <enumeration value="Customer" /> <enumeration value="Supplier" /> <enumeration value="Subsidiary" /> <enumeration value="Selfregistered" /> <enumeration value="unknown" /> </restriction> </simpleType> <simpleType name="ExternalRelationType"> <union memberTypes="tns:KnownExternalRelationType string" /> </simpleType> <simpleType name="ValidityState"> <annotation> <documentation> If an attribute was taken over by an authoritative source such as HR-MDS or WOM. Set to "Valid" to indicate that the value was taken over from the source and is therefore valid. Set to "Invalid" if the source indicates the value is no longer value, e.g. because it got deleted. Otherwise set to "Unknown", e.g. when the value was entered manually. </documentation> </annotation> <restriction base="string"> <enumeration value="Valid" /> <enumeration value="Invalid" /> <enumeration value="Unknown" /> </restriction> </simpleType> <complexType name="HrPersonnelId"> <sequence> <element name="hrSourceSystem"> <annotation> <documentation> Name of HR source system </documentation> </annotation> <simpleType> <restriction base="string"> <minLength value="1" /> <maxLength value="20" /> </restriction> </simpleType> </element> <element name="hrPersonnelId"> <annotation> <documentation> ID of person in HR source system </documentation> </annotation> <simpleType> <restriction base="string"> <minLength value="1" /> <maxLength value="20" /> </restriction> </simpleType> </element> </sequence> </complexType> <complexType name="AccountType"> <annotation> <documentation> Types of Accounts: Three main categories are known: Person, resource or service account. A person account represents a single natural person. A resource account represents a resource such as a printer, a computer or a meeting room. Service Accounts represent everything else. The can be used for example for technical users or group accounts. Both resource and service accounts have an owner that is responsible for them. Each account type has subtypes for further categorization. </documentation> </annotation> <choice> <element name="personAccount" type="tns:PersonAccountType" /> <element name="resourceAccount" type="tns:ResourceAccountType" /> <element name="serviceAccount" type="tns:ServiceAccountType" /> </choice> </complexType> <simpleType name="KnownPersonAccountType"> <annotation> <documentation> Pre-defined types of Person Accounts </documentation> </annotation> <restriction base="string"> <enumeration value="Office" /> <enumeration value="Admin" /> <enumeration value="Test" /> <enumeration value="unknown" /> </restriction> </simpleType> <simpleType name="PersonAccountType"> <union memberTypes="tns:KnownPersonAccountType string" /> </simpleType> <simpleType name="KnownResourceAccountType"> <annotation> <documentation> Pre-defined types of Resource Accounts </documentation> </annotation> <restriction base="string"> <enumeration value="Room" /> <enumeration value="PC" /> <enumeration value="Printer" /> <enumeration value="unknown" /> </restriction> </simpleType> <simpleType name="ResourceAccountType"> <union memberTypes="tns:KnownResourceAccountType string" /> </simpleType> <simpleType name="KnownServiceAccountType"> <annotation> <documentation> Pre-defined Types of Service Accounts </documentation> </annotation> <restriction base="string"> <enumeration value="Group" /> <enumeration value="Machine" /> <enumeration value="Support" /> <enumeration value="System" /> <enumeration value="unknown" /> </restriction> </simpleType> <simpleType name="ServiceAccountType"> <union memberTypes="tns:KnownServiceAccountType string" /> </simpleType> <simpleType name="ActionType"> <annotation> <documentation> Defines the action that was performed on the object. </documentation> </annotation> <restriction base="string"> <enumeration value="Create" /> <enumeration value="Update" /> <enumeration value="Delete" /> </restriction> </simpleType> <simpleType name="LegalEntityId"> <annotation> <documentation> ID of a legal entity </documentation> </annotation> <restriction base="unsignedInt"> <totalDigits value="8" /> </restriction> </simpleType> </schema> '; DBMS_XMLSCHEMA.REGISTERSCHEMA (schemaurl => 'BasicTypes.xsd', schemadoc => lc_test_xsd); DBMS_OUTPUT.PUT_LINE('BasicTypes.xsd registration successfully completed'); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('BasicTypes.xsd registration failed '||SQLERRM); END; /
See for example the effect of elementFormDefault of http://www.liquid-technologies.com/Tutorials/XmlSchemas/XsdTutorial_04.aspx for details.
The fix:
>
...
>I hope this helps!
-
Detection of parameter NLS_LANG clientside in SQL * more script
Our company has developed an application that uses an Oracle database as backend. Companies can purchase our application and run it against their own installation of Oracle.
A new version of our application often requires an update to the Oracle database schema.
As well as from new application files, we send our customers an update.sql script, they must run to their database using SQL * more.
This update script can contain international characters such as é for example:
Save us the SQL script file in the windows-1252 encoding the character e is encoded by 0xE9 in the script file.UPDATE SHOPS SET DESCRIPTION = 'Café' WHERE SHOP_ID=1
When the ADMINISTRATOR runs him upgrade script is set NLS_LANG =. WE8MSWIN1252 it works perfectly.
When the ADMINISTRATOR has set the NLS_LANG = US7ASCII the e is replaced by an exclamation mark the upside. Other NLS_LANG settings can also be embarrassing.
To avoid this, we give very clear instructions. However, nobody reads. This raises two questions:
(A) is there a way to prevent this problem, so I do not the parameter NLS_LANG by the DBA to run the upgrade script depend on?
(B) otherwise: is there a way to test the NLS_LANG setting in the script and give up if it's not WE8MSWIN1252?
Info:
Database is 10.2.0.3/10.2.0.4 and sometimes 10.2.0.5, always the database character set WE8MSWIN1252.
Client software: I don't know what are the uses each s/n, but it will be mainly the software client 10g
Client OS: Some DBA will run the script from Windows, others of some varieties of Unix. I can't control that.(A) is there a way to prevent this problem, so I do not the parameter NLS_LANG by the DBA to run the upgrade script depend on?
Yes. Use the UNISTR function to encode strings with Unicode, for example UNSITR('\00e9') exhausts to code 'e '. The set conversion implicit character in the set to the national character of database character set will do. You can use the ASCIISTR function to simplify the creation of arguments to UNISTR based on the input text.
-Sergiusz
-
Select character especial as ª º
I have a User table with some records that contain a
ID | Name | Degree
----------------------------
1. User 1 | 10 º
2. User 2 | 6 º
3. 3 the user | 1 º
4. 4 the user | 9 º
5. 5 user | 10 º
How I wrote a sentence like
Select * from users where the diploma as '1 '?
my request has not brought any results
Thank youmy request has not brought any results
view the following SQL results
SELECT ASCIISTR ('1') FROM DUAL;
SELECT ASCIISTR (DEGREE) FROM USER_TBL WHERE ID = 4;
-
XmlElement and accented, characters
Hello
I use xmlelement to generate an xml file, but if a string contains an accented character it is not escaped, so in the file, I get 'to' and not ' to; "(or & #224;).
But if there is one "& gt;' it is converted to" & gt;'
can someone help me?
Thank you
Published by: user515918 on 6.42 lug-9-2009Maybe it's
SQL> select xmlelement(noentityescaping e,regexp_replace(asciistr('A smàll samplé'),'\\(.{4})','\1;')).getstringval() xml from dual / XML --------------------------------------------------------------------------------
A smàll samplé ?
-
SQL for sort a column containing digital/characters/alphanumeric characters.
I have a table with the column can contain numbers, characters, and a combination of numbers and characters. Here is an example of the table. In this regard, I would like to sort the table in the following way.
(a) sort first numbers in numerical order and then would sort the others in the order of the characters.
Example: -.
RUN SQL
SQL > select * from temp;
ID
---------------
A
22
46
CC
BBB
46jkb
1
10
100
one
AFTER CORRECTION
SQL > < MAGIC SQL statement >
ID
---------------
1
10
22
46
46jkb
100
one
A
BBB
CC
I tried asciistr, to_char and to_number and many other combinations. However, no luck :-(. Any help will be much appreciated.
SQL statement - to create and insert data in the table-
create table temp (id varchar2 (15));
insert into temporary values ('A');
insert into temporary values ('22');
insert into temporary values ('46');
insert into temporary values ("CC");
insert into temporary values ("BBB");
insert into temporary values ('46jkb');
insert into temporary values ('1');
insert into temporary values ('10');
insert into temporary values ('100');
insert into temporary values ('a');
commit;with t as ( select 'A' str from dual union all select '22' str from dual union all select '46' str from dual union all select 'CC' str from dual union all select 'BBB' str from dual union all select '46jkb' str from dual union all select '1' str from dual union all select '10' str from dual union all select '100' str from dual union all select 'a' str from dual ) select str from t order by lpad(regexp_substr(str,'^\d+'),max(length(regexp_substr(str,'^\d+'))) over(),'0') || upper(regexp_replace(str,'^\d+')) / STR ----- 1 10 22 46 46jkb 100 A a BBB CC 10 rows selected. SQL>
SY.
Maybe you are looking for
-
Custom fan curve/manual fan control?
Hello Product number: K0W62EA #ABU Product name: HP Pavilion 15 laptop 8.1 Windows 64-bit Intel Core i7-4510U CPU @ 2.00GHz 8GB 1600 MHz Kingston NVIDIA GeForce 840M I was wondering if there is a way for the manually set fan speed? Also is it possibl
-
Hello! I'm in a bit of a dilemma. Current Tecra Z50 is extremely close to what I want in a notebook, but the thing is, I currently don't really need and I don't have the time to put in place. Would buy an and I hang out until the end of the summer. I
-
How can you check if all your photos in Aperture are included in a backup?
So I just manually backed up my iMac by clicking in the upper right of my screen on the logo of Time Machine and selected "save now". That's what I usually do I don't like TM backup automatically. My concern is "stored all my pictures from my Apertur
-
Automatic locking of blackBerry Smartphones &; hide the clock in night mode
I just updated my Blackberry 9700 to firmware 5.0.0.59 3. I noticed that the AutoStandby 2.4.1 utility that locks the keyboard 30 seconds no longer works. An automatic keyboard lock is a very basic feature for each phone, and it would be good if it c
-
After mac os update and software reinstall now unable to use the scan function
Hello I never thought I had to post on one of them, but it really made me. I have a Macbook and stupidly thought that I would update to the mavericks os 10.9 the other day. I continued to be able to print once the update, but it was impossible to use