Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Wednesday, June 24, 2009

Insert Double Byte Characters to Database

We cannot insert the double byte characters (eg: Chinese, Russian, Japanese etc) into a database directly. This is not possible even if we configure the database to Unicode encoding.

All the editors we use to run the sql does not recognize the double byte characters. They support only ASCI characters. So if we try to run a query which contains a double byte character, say Chinese, then the editor will replace the characters with question marks (???) means it does not recognize the symbol.

For Eg: if we copy the following query to an sql editor,

insert into () values ('支付宝');

then the editor will convert it as

insert into () values ('???');


There is a solution for this issue.

We can use the sql function compose() and we can pass the unicode of the characters to the function.

Eg: insert into () values (compose(unistr('\652F\4ED8\5B9D')));

This will insert the double character to the db.

The characters can be converted to the unicode using the following site
http://rishida.net/scripts/uniview/conversion.php


.

Thursday, April 23, 2009

SQL for altering user schema to add a new tablespace

The following sql is to create a tablespace after creation of a user schema and then alter the user schema to take the new tablespace as default.
It also changes the system defined tablespace 'temp' as the temporary tablespace for the user.


create tablespace pfss datafile '/u12/oradata/wcrsec01/PFSS.dbf' size 100m autoextend on next 50m maxsize 1000m;

create tablespace pfss_idx datafile '/u12/oradata/wcrsec01/PFSS_IDX.dbf' size 100m autoextend on next 50m maxsize 1000m;

alter user pfss default tablespace pfss temporary tablespace temp;

Alter user pfss quota unlimited on pfss_idx;

Alter user pfss quota unlimited on pfss;