Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

substr(RAW data)

Status
Not open for further replies.

scottgai

Programmer
Dec 12, 2001
11
US
I have question like this:
suppose I create a table:
Code:
create table mytable(msg  raw(254));
and there is a record in this table which contains the following message like:
Code:
616C6D6B000000......
I want to retrieve the first character from table mytable, I use such a sql statement:
Code:
select substr(msg,1,4) from mytable
the result only return the first 2 character: 616C
If i use substr(mst,1,8), then i got what i want.

I was confused about 2 points:
1. what does the number '254' mean in its definition? it means 254 bytes or others?
2. why should substr recognize four bits of raw data as a unit(char)?

who can explain this?
thanks in advance!

Scott

insert into mytable('call')
 
That it can store upto 254 bytes of data.
The substr is a character function so my guess is that it converts the raw to char and then gives you the first 4 characters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top