SQL & PL/SQL :: How To Convert String To Ascii

May 20, 2011

I can't think of a clue how to get the desired results.

I have table column with varchar2 type. I need to convert the strings in this column to ascii values. Now I know Oracle function ascii() converts a character to ascii values. But it just converts the first character of the string and ignore the others. I need to convert the whole string to ascii values. For example, if I need to convert the string "USA", the result should be '858365' (as in U decimal value is 85, S decimal value is 83 and A decimal is 65).

I think I need to use instr() function and also PL/SQL to pass all these strings through a cursor and then use a loop but I'm still confused about it.

View 5 Replies


ADVERTISEMENT

Convert Oracle Sqlplus Output Into ASCII Format?

Sep 20, 2012

I am using oracle database 9iR2 (9.2.0.8) on windows 2003 server.

Is there any method to convert following output in to ASCII format ??

select ename from scott.emp;

ENAME
--------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS

View 6 Replies View Related

SQL & PL/SQL :: How To Find Extended ASCII Characters From A String

Sep 19, 2013

I have a table like mentioned below

create table test1( test_no number, test_description varchar2(100));
insert into test1 values (1,'ABC£¥');
insert into test1 values (2,'BCD£¥');

Now I am selecting from the above table and the expected rest it should have shown is as shown below

TEST1
-----------------------
TEST_NO TEST_DESCRIPTION
1 ABC£¥
2 BCD£¥

But instead of showing the extended ascii characters, it is showing some different characters as shown below

select * from test1;

TEST1
-----------------------
TEST_NO TEST_DESCRIPTION
1 ABCLY
2 BCDLY

I have an requirement where i need to fetch the exact ascii characters for £ and ¥ instead of L and Y respectively.

View 1 Replies View Related

How To Convert String To Date

Apr 15, 2007

I have a date saved in varchar2 colomn.

how can I convert the vaules into date, so I can use the date to compare data.

Ex: I have the value '20-03-2007 05:31:29', but this value is saved as varchar2.

how can I take from this value the date '20-03-2007' as date format?

View 6 Replies View Related

SQL & PL/SQL :: Convert Alphabet To String?

May 30, 2013

I want to make a query in which i can convert
alphabet
A
B
C
D

asume i have column name alphabet have data A B C D.But i want to retrieve data like this
Apple
Boy
Cow
Duck

View 2 Replies View Related

SQL & PL/SQL :: How To Convert String To Date Format

Jun 12, 2011

I have a string in this format '2011/06/01 00:00:00'. How do I convert this to date format.I tried to_date,to_char and they give errors invalid number & literal does not math format string. I don't have much control on the string since that is the way is comes from the application.

View 3 Replies View Related

SQL & PL/SQL :: How To Convert A String Into Numeric Other Than To_number

Dec 30, 2012

I have a column which has has all numeric values 3 digits to 7 digits in length but all in string format, I want to use seomthing other than to_number function.

Would like to use within the ETL tool, where to_number function isn't getting recognized.

select EMP_NO from employees;

View 2 Replies View Related

SQL & PL/SQL :: Convert One String Into Multiple Strings?

Aug 31, 2010

i have a column 'name' in which value is 'Shailesh Negi',i have to insert 'shailesh' into'first name' column and 'Negi' into 'last name' column respectively.

View 20 Replies View Related

SQL & PL/SQL :: Convert Column Value To Delimited String Using Query?

Jan 10, 2012

I want to convert a column value to a delimited string using a query.

Example

TableA
Col1 Col2 Col3
1 x200 MIS-X
2 x200 BTS-X
3 x200 TYR-X
4 x100 YRY-X

Select Col3 From TableA where Col2 = 'x200'

Expected Output:

'MIS-X','BTS-X','TYR-X'

View 4 Replies View Related

SQL & PL/SQL :: Convert String Of Flags Into List Of Labels

Apr 21, 2011

I have a varchar2 column that contains something like this:

10100010

Each digit represents a flag that corresponds to a certain label:

1 - Bananas
0 - Oranges
1 - Apples
0 - Tomatos
0 - ..
0 - ..
1 - Kiwi
0 - Others

What I want to do is, translate '10100010' into the string '(Bananas,Apples,Kiwi)' using SQL-only. As a bonus it would be nice if the string is completely empty if all flags are '0', so no '()'.

View 6 Replies View Related

SQL & PL/SQL :: Convert A String In Date Obtaining Just A Year?

Nov 12, 2012

basically I have to insert in a date field a string that is a year(four characters).

The problem is that I have to convert a string in date obtaining just a year. How can i do this?

View 14 Replies View Related

PL/SQL :: How To Convert BLOB To BASE64 String And Back

Aug 15, 2012

We have a forms application in Forms 10g. We scan a document and gets it to a image item in the Form. Now, we need to pass this image to a 3rd party application (document mgt. system, ). They have given us a web-service for this. We have to convert the image to a BASE64 string and then invoke the web-service method and input it.

The, 3rd party application document management system will also send images as BASE64 strings through the web-service. We need to convert them back to a blob and put to an image item in the form so that it can be viewed by the end-user.

So, how can we convert a image item in form (as BLOB) to a base64 string and also do the reverse???

View 2 Replies View Related

SQL & PL/SQL :: Converting Binary To Ascii

Mar 24, 2011

I have simple program .It reads binary file and writes all , what reads into another file

WHILE my_lenght_help <= my_lenght LOOP
UTL_FILE.GET_RAW ( g_read_file , my_bufer_read ,200 );
UTL_FILE.PUT_RAW ( g_write_file , my_bufer_read );
my_lenght_help:= my_lenght_help + 200;
END LOOP;

my question. How I can change "my_bufer_read" between UTL_FILE.GET_RAW and UTL_FILE.PUT_RAW to make writable file ascii

View 3 Replies View Related

SQL & PL/SQL :: ASCII Function In UTF-8 Database?

Dec 2, 2010

I want to get NUMBER value from RAW bytes in PL/SQL...For example, single-byte value 0xED in RAW variable should became 237 in NUMBER variable.

We used to use:ascii(utl_raw.cast_to_varchar2(utl_raw.substr(p_data,i,1))), but this seems working in DBs with single-byte character sets only, and now I am on DB with AL32UTF8 character set...

I would be happy if the following function returns 237, not 0:

function mmm (
r RAW -- ed (237 in decimal)
) return NUMBER
is
n NUMBER;
begin

[code]....

View 4 Replies View Related

SQL & PL/SQL :: Extended Ascii To Character

Jan 27, 2011

I have requirement to convert the extended ascii to character. Is there any function available .

View 9 Replies View Related

SQL & PL/SQL :: Delete Non-ASCII Characters?

Sep 9, 2013

In field APPLICATIONNAME are non ASCII characters. Howto delete them?for example

old value:
René

new value:
Ren

table
CREATE TABLE MIDDLEWARE_CONT
(
APPLICATIONNAME VARCHAR2(120 BYTE),
PRODUCTNAME VARCHAR2(70 BYTE),
HOSTNAME VARCHAR2(60 BYTE),

[code]....

View 14 Replies View Related

SQL & PL/SQL :: Inserting Tabs (ASCII 009) In Output

Jun 8, 2011

I'm looking for a way to insert tabs (ASCII 009) in SQL output, to make the output file Excel-ready without manual intervention.

Here's what I need :

SQL> set output myfile.xls;
SQL> select article,TAB,count(*) from sales group by article having count(*) > 0;

Instead of TAB I can insert a dollar sign, but then I have to replace it using a file editor, which is a manual operation. I have been looking for an OpenVMS application which can replace all dollar signs by tabs in a given file, with no luck.

I created a DCL procedure (simplified from GSR.COM which I found on the internet) that reads every record in the output file and substitutes dollar signs by tabs, but it doesn't work with tabs, only with "normal" characters.

Even if I use the OpenVMS editor to insert ASCII 009 tab characters in the SQL statement (using the GOLD 009 GOLD SPEC INS key combination), SQL apparently automatically substitutes tabs by full stop signs in the output :

select article,' ',date from werknemers limit to 2 rows;
ARTICLE DATE
TROUSERS . 12-28-1974
SHIRTS . 10-08-1973
2 rows selected

I can use SQL to create a CSV file (comma separated values) which can be opened by Excel :

"trousers",20
"shirts",30

But the user has to open this file from within Excel and make a number of choices (separator, text delimiter, header row) before (s)he gets to see the desired columnar spreadsheet. That's not automation : I need the generated SQL output file to be double-clickable so that it opens as a columnar spreadsheet immediately.

View 19 Replies View Related

SQL & PL/SQL :: Why Replace Function Is Not Replacing - ASCII Value Being Zero

May 16, 2013

why the REPLACE function is not replacing. I assume it has something to do with the ASCII value being zero.

Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
Connected as aggs@AGGSTEST

SQL>
SQL> SELECT str,
2 e9,
3 REPLACE(str, '%E9', e9) replace,
4 regexp_replace(str, '%E9', e9) regexp_replace,
5 utl_url.unescape(str, 'UTF8') utl_url,
6 ascii(e9) ascii
7 FROM (SELECT 'Soir%E9e' str,
8 chr(to_number('E9', 'xx')) e9
9 FROM dual);

STR E9 REPLACE REGEXP_REPLACE UTL_URL ASCII
-------- --- ------- -------------- ------- -----
Soir%E9e é Soire Soirée Soirée 0

View 5 Replies View Related

Application Express :: Export To ASCII File?

Apr 10, 2013

My application has several update-able forms. And I build a single staging table to store all these records.

The user wants a button on the last form and by clicking on this button they want to export the file(updated records from all the forms) in ASCII format.

if its do-able or not in apex since I haven't come across this kind of request earlier and didn't find the same in this forum?

Versions: 10g DB, Apex 4.1.

View 6 Replies View Related

Server Utilities :: SQL Loader Is Not Uploading Non-ASCII Characters?

Jan 10, 2012

I am using SQL Loader to load data from text file to DB. non-ASCII characters present in the text file is not uploaded correctly to DB.

Sample Data

test data üindex

Data in DB

test data ?index

View 1 Replies View Related

Server Utilities :: How To Process ASCII Character 29 While Loading Data With SQL Loader

Jul 20, 2010

i have to upload a file in database, the column seperator is ASCII CHARACTER 29, i dont know how to specify that in loader file?

how to write this - fields terminated by ' ' in sql file, which i am calling from a batch file.

i have attached the text file which i am trying to upload, here field seperator is ASCII CHARACTER 29 and record seperator is NEW LINE CHARACTER.

View 3 Replies View Related

ORA-02085 - Database Link String Connects To String

Jun 19, 2012

I have this error (and solution):

ORA-02085: database link string connects to string

Cause: a database link connected to a database with a different name. The connection is rejected.

Action: create a database link with the same name as the database it connects to, or set global_names=false.
Where should I set global_names=false ?

View 7 Replies View Related

Inserting Character From Extended ASCII Character Set?

Mar 8, 2007

I'm trying to insert a character from the extended ascii character set. Specifically, there's a company that has an accented e (�) in the name. Right now, the company name doesn't have the e at all, accent or no accent. So I'm trying to do an update, something like

update table1 set company_name='blah�" where company='blah'

It runs, but doesn't do the update. Even when I try to forcefully do an insert (instead of an update) I get nowhere; the accented is simply dropped. So the basic question is, how do you insert extended ascii characters into oracle?

View 3 Replies View Related

SQL & PL/SQL :: How To Find Whether Exact String Is Present / Not In Given String

Mar 14, 2013

I'm facing some problem even after using INSTR function in Oracle.The problem is I have written the logic in the PL/SQL block which appends all the values fetched in a loop on the basis of whether the string is present or not.

For ex:

The first value fetched from the select query first is ABCDEFG which gets appended to a variable
The next value fetched is AB even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
The next value fetched is BCDEF even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
The third Value fetched is ABCDEFG this will not get appended presently according to the logic which is correct.

writing that piece of code to append the value fetched which doesn't exactly match with the existing string

View 3 Replies View Related

How To Use String Buffer Instead Of String Query

May 9, 2008

show an ex to use string buffer for select statemnt

View 1 Replies View Related

SQL & PL/SQL :: Remove String Before And After Pipeline To Get String Between Pipeline?

May 10, 2010

I have a string like below:

string = 'HEADER||MEAL||15'

How to get 'MEAL' string? The length of the string can be various. Means, 'MEAL' can be 'INFLIGHT'. So, i cant use the substr. Is there a function that can recognize the pipeline? so that i can remove all the string before the pipeline and after the pipeline to get the string between the pipeline?

View 9 Replies View Related

How To Convert Row As Column

Apr 8, 2011

how can i change row as column in oracle.

I wrote the one query which is return the following output..

Query:

SELECT RMC_N_ID,NVL(DISCOUNT_N_ID,NULL) AS DISCOUNT_N_ID,NVL(NULL,'') AS LOADINGS_N_ID,NVL(NULL,'') AS WARCOMB_N_ID,NVL(NULL,'') AS ENDORSECOMB_N_ID FROM UWRMC_DISCOUNT WHERE RMC_N_ID =224 AND DISCOUNT_N_ID IS NOT NULL
UNION
SELECT RMC_N_ID,NVL(NULL,'') AS DISCOUNT_N_ID,NVL(LOADING_N_ID,NULL) AS LOADING_N_ID ,NVL(NULL,'') AS WARCOMB_N_ID,NVL(NULL,'') AS ENDORSECOMB_N_ID FROM UWRMC_LOADING WHERE RMC_N_ID =224
UNION
SELECT RMC_N_ID,NVL(NULL,'') AS DISCOUNT_N_ID,NVL(NULL,NULL) AS LOADING_N_ID ,WARCOMB_N_ID,NVL(NULL,'') AS ENDORSECOMB_N_ID FROM UWRMC_WARCOMB WHERE RMC_N_ID =224
UNION
SELECT RMC_N_ID,NVL(NULL,'') AS DISCOUNT_N_ID,NVL(NULL,NULL) AS LOADING_N_ID ,NVL(NULL,'') AS WARCOMB_N_ID, ENDORSECOMB_N_ID FROM UWRMC_ENDORSECOMB WHERE RMC_N_ID =224

Result:

RMC_N_ID DISCOUNT_N_ID LOADINGS_N_ID WARCOMB_N_ID ENDORSECOMB_N_ID
---------- ------------- ------------- ------------ ----------------
224 0 87 0 0
224 0 88 0 0
224 0 0 0 93
224 0 0 0 94
224 0 0 88 0
224 0 0 89 0
224 82 0 0 0
224 83 0 0 0

I want the result like below

RMC_N_ID DISCOUNT_N_ID LOADINGS_N_ID WARCOMB_N_ID ENDORSECOMB_N_ID
---------- ------------- ------------- ------------ ----------------
224 82 87 88 93
224 83 88 89 94

How can i get this..

View 3 Replies View Related

Forms :: Convert From 6i To 10g

Aug 3, 2011

how can i convert from oracle forms 6i to oracle developer suite 10g

View 4 Replies View Related

SQL & PL/SQL :: Convert Column Into Row?

Nov 2, 2012

my data looks like:-
Ename Job salary
----- ----- -------
A manager 10000
B clerk 60000
C assistant 30000
A manager 50000
B clerk 20000
D accountant 40000

I want the result while select all data should look like:-

A B C D
manager clerk assistant accountant
10000 60000 30000 40000
50000 20000

View 6 Replies View Related

SQL & PL/SQL :: Convert Many Rows To One

Sep 17, 2012

I use Oracle 11g and a Middleware which sends the SQL Statements to the database. That's why I can't send you loggings.

However, I' got this SQL:

With CTE
AS
(
select * from
data A2
WHERE
A2.ID ='536031'
AND
A2.AttrID = '6'
)

That code gives me the following result:

ID.........Version....AttrID.......group
536031......3.........6..............test5
536031......3.........6..............test6

What I try to do. I want to get all groups. The Groups should be in one column...the the result must be the following:

ID.........group
536031...test5, test6

In SQL server I always used

SELECT ID,
STUFF((SELECT ',' + [group] FROM CTE WHERE ID = c.ID ORDER BY [Version] FOR XML PATH('')),1,1,'')
FROM (SELECT DISTINCT ID FROM CTE)c

to achieve that. Is there a similar function in oracle like XML PATH? Or another way the get the result?

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved