last 3 characters of a string
How to get the last 3 characters of a string occuring after a character / alphabet without using REGEXP_SUBSTR ?
Ex: 10000A001 is the string.
Note: - I want to use it in Oracle reports 6i, therefore i cannot use the statement REGEXP_SUBSTR
Sanjay
Hello
substr('10000A001',-3)
Tags: Database
Similar Questions
-
replace only the last 3 characters within a string
Hi all
I have the string "abcdef_01". How can I replace the last 3 characters with "000"? in this string, for example "_01" should be replaced by '000'. Any way to do it, without the concatenation of the original string with the last 3 characters replaced by "000"?
Thank you
Edited by: Roger22 the 18.10.2011 09:29Yes, you can...
SELECT rpad(substr('abcdef_01',1,length('abcdef_01')-3),length('abcdef_01'),chr(dbms_random.value(32,64)) || chr(dbms_random.value(32,64)) || chr(dbms_random.value(32,64))) FROM dual;
RPAD/lpad may use a third parameter that is longer than 1 character and - if the duration of param 1 + length of parameter 3 is longer that parameter 2 - truncates the result to fit the length of parameter 2.
HTH
-
How to get the last 50 characters in a string
Hi, I need to get 50 last characters in a piece of 25 characters each in two columns if the column notes less than 50 characters ex: 43 then I need to last 25 one column and left (18 characters) in the second column. I tried using substr and the first column of length functions fine, but the second column has a problem: select substr ("ABCDEF GHIJ', length('ABCDEF GHIJ')-25, 25) of double; Thanks, Kiran
Hello
what I understand: if I call 'x' the length of the string:
IF x > is 50 THEN result1 is 25 tanks, result2 = 25 characters
IF 25< x="">< 50 ="" then="" result1="25" chars,="" result2="(" 25="" -="" x="" )=""> >
IF x<= 25 ="" then="" result1="x" chars,="" result2="">=>
Note that SUBSTR (x, n) selects the n last characters:
SELECT SUBSTR ("ABCDEFGH",-3) FROM dual-> ANUS
For example AS
(SELECT "AAAAABBBBBCCCCCDDDDD" double str
UNION ALL SELECT 'AAAAABBBBBCCCCCDDDDDEEEEEFFFFFGGGGG' FROM dual
UNION ALL SELECT 'this_is_exactly_25__chars' FROM dual
UNION ALL SELECT 'This___is___exactly___fifty___characters' FROM dual
UNION ALL SELECT 'AAAAABBBBBCCCCCDDDDDEEEEEFFFFFGGGGGHHHHHIIIIIJJJJJKKKK' FROM dual
)
SELECT str
LENGTH WHEN CARTER (str)<>
THEN str
WHEN LENGTH (str)<>
THEN SUBSTR (str, 1, 25)
Of OTHER SUBSTR (str, LENGTH (str) - 49: 25)
END performance(1)
, LENGTH WHEN CARTER (str) > = 50
THEN SUBSTR (str,-25)
WHEN LENGTH (str) > 25
THEN SUBSTR (str, 25 - LENGTH (str))
ANOTHER NULL
End result2
SAMPLE
;
STR RESULT1 RESULT2
------------------------------------------------------ ------------------------- -------------------------
AAAAABBBBBCCCCCDDDDD AAAAABBBBBCCCCCDDDDD
AAAAABBBBBCCCCCDDDDDEEEEEFFFFFGGGGG AAAAABBBBBCCCCCDDDDDEEEEE FFFFFGGGGG
this_is_exactly_25__chars this_is_exactly_25__chars
This___is___exactly___fifty___characters This___is___exactly_ ___fifty___characters
AAAAABBBBBCCCCCDDDDDEEEEEFFFFFGGGGGHHHHHIIIIIJJJJJKKKK ABBBBBCCCCCDDDDDEEEEEFFFF FGGGGGHHHHHIIIIIJJJJJKKKK
Best regards
Bruno Vroman.
-
Remove 10 characters of this string
How to remove the last 10 characters of any string?
\
Keep throwing me these easier!
-
replace characters in the string
Hi all
Is it possible to index the characters in a string as if it were a table and remove them from the second position and now. I just want with the first letter or number so that I can later concatenate strings to it.
Thanks for any help!
-Michael
Hi Michael,
Yes. Use the function "Sring subset. At the beginning the value 0 (default value) and the length of 1.
This will give you the first character in the string.
Steve
-
separate the characters in a string
Hello
Y at - it an easy way of seprerate characters in a string
For example if I have a string 'abcdef '.
I want to seprate it in an array of 7 elements, where each element is a character in the string.
Thank you
Hi reza_sed,
the attached picture shows one solution.
Mike
-
Formula to replace characters in a string
Hi all
Is it possible to replace characters in a string somewhere if the string has no specific pattern for these characters? I use the replacestr function to replace characters in a string (i.e. ABC), but the chain is in the ABC format * where * are two random characters. The result I'm looking for is to replace ABC * with the NodeID.
ReplaceStr (propvalue (Core.Abbrev), ABC, ID (), T),) This formula works, but is either two additional characters in the end, after ABC. How can I cut that?
Thank you
If)
Not (Equals (Integer, length (PropValue (Core.ABBREV)), length (ReplaceStr (PropValue (Core.ABBREV), ABC, T))),
ReplaceStr (PropValue (Core.Abbrev), PropValue (Core.Abbrev), ID (), T),
PropValue (Core.Abbrev)
)
-
How to remove the first few characters of a string of liquid
I would like to delete the first three characters of a string of liquid. The question is how.
If I use the markup according to liquid when I know what are the first characters
{{it. {{["Estate status'] | strip_html | remove_first:"11."}}
It will remove the 11 characters.
But if I don't know what are the first characters, this markup can I use to get "RID" of the first three characters?
I tried 'split' and 'slice', but it must always know what characters to split or slice.
Thanks for any help.
Kind regards
Carla
Assign a value into slices and you can have table data that you can get out.
-
Match the last 2 characters of field of 1 to 2 characters of another field
Hi, I was looking for assistance with regard to get output when the last 2 characters of 1 on the ground of the last 2 characters of another field of a particular job, i.e. repair or the new job. Here's an example of my 2 tables and insert queries.
[code]
CREATE TABLE 'SITES '.
(
'CODE' VARCHAR2 (7 CHAR),
VARCHAR2 (27 CHAR) "NAME."
'SITE_NAME' VARCHAR2 (32 CHAR)
)
Insert in SITES (CODE, NAME, SITE_NAME) values ('CAFC', 'Central', 'Birmingham');
Insert in SITES (CODE, NAME, SITE_NAME) values ('MRCE', 'Central','Manchester ");
Insert in SITES (CODE, NAME, SITE_NAME) values ('LVCE', 'Central', 'Liverpool');
Insert in SITES (CODE, NAME, SITE_NAME) values ("WSCE", 'Central',' West of Central Scotland ");
CREATE TABLE 'JOBS '.
(
VARCHAR2 (20 BYTE) "JOB_REF."
'JOB_TYPE' VARCHAR2 (20 BYTE)
)
Insert into JOBS (JOB_REF, JOB_TYPE) values ('FFR53CM', 'Repair');
[/ code]
So I would take the first 2 characters 'CM' of the Sites Table and at last the match 2 characters of the job Table if the Type of job is the repair and then display the value of the Site name. The reason why I need to filter on the Type of employment is because when a new job is connected so I need to use the first 2 characters rather than the last 2, but I thought I would break it down in order to get the work of part 1.
Unfortunately I do not know how I can display it, also do not know whether to use a case statement, but still don't know how to write it.
If someone could please advise, really appreciate it.
Thanks in advance.
976439 wrote:
How I guarantee that it is only for the repair of Type of work?
You know the SQL language don't you?
What is the problem with everything by adding:
where job_type = 'repair '.
to the query.
Blimey! I don't think I would be hand-holding today.
-
Bunch of Oracle on the special characters in a string - translate?
How to remove special characters in a string, it can contain. , (space), etc.
SELECT TRANSLATE('123.456 (90-90)', '', '') FROM DUAL
Basically I want to undress and to compare with the db value.
WHERE TRANSLATE(TABLE.NUMCODE, '', '') = TRANSLATE('123.456 (90-90)', '', '')
Use TRANSLATE, since you're on 9i. For example:
TRANSLATE (your_string,'X,. #! % @$ ^ & * () _-+=', 'X')
Removes all the s characters in ', #! % @$ ^ & * () _-+=' of your_string.
SY.
-
How can I get the last 3 characters of the record
Hello
This statement [cdoe] select substr (password, 1, 3) to admin; Gets first 3 characters that I want to read the last 3 characters
Best regardsSQL> select substr('Raakh',-3) from dual; SUB --- akh 1 row selected.
Kind regards
Rob. -
extract characters from a string
Hi gurus,
I want to extract the first, third, fifth, seventh... characters in a string.
not to extract characters from a subset of characters in a select query in oracle 9i database.
for example (1):
Assume that a string like this "SUE" is that I am 'ACEGI"of the source string
and the source can be any valid string, I just give an example here.
Example (2) of "kalpataru' in klatau'
Please guide me for thisfor 9i:
SQL> with t as ( select 'ABCDEFGHIJ' str from dual union select 'kalpataru' from dual ) -- -- select str, trim(extract(xmlagg(xmlelement(e, substr(str,level,1)) order by level),'//text()')) str2 from t where mod(level,2) = 1 connect by level <= length(str) and prior str = str and prior sys_guid() is not null group by str / STR STR2 ---------- -------------- ABCDEFGHIJ ACEGI kalpataru klaau
-
How to remove the first 11 characters of a string
With the help of ' XML Publusher Desktop / generator model for Word / 5.6 Build 45'
I use XML Publisher. With the help of a RTF model, to generate purchase orders by email of the purchase of the Oracle.
The fields are drawn from the XML code generated by Oracle.
One of the fields is the place of delivery Description field.
Will appear in the report as follows:
* & lt;? SHIP_TO_LOCATION_NAME? & gt; *
When I attach a test XML file in Word and view the output, one of my test case returns a description of the site:
DON'T code USE County Hall of Global location
What I have to do is to remove the * DO NOT USE * according to the description of the location.
I could do is a Find / Replace, or a substring to ignore the first 11 characters from the string. But I don't know how to do it.
Any help would be much appreciated, because it is a production problem that is causing a bit of a small problem for us!
Thank you very much.Hello
Maybe you know this syntax :)Rahul
-
How to extract the last 5 characters of the column CLOB001?
Hi all
I've set up an external WS in the APEX and now I want to create a report with the following query:
Select dbms_lob. Substr (CLOB001, 5, -5) 'Test '.
of APEX_collections
where collection_name = "P422_CHECKVAT_RESULTS";
What I want to do is to retrireve the last 5 characters in the CLOB, has anyone any ideea how I can do this?
Kind regards
Ana-MariaSELECT dbms_lob.Substr(CLOB001,dbms_lob.getlength(CLOB001),dbms_lob.getlength(CLOB001)-5 ) test FROM HTMLDB_COLLECTIONS WHERE COLLECTION_NAME =
{code} Hope this helps... Tyson -
Get the last 2, 3 or 4 characters in a string
Hello
I have a number of files with filenames that when different lengths and they had different extensions of files of length, how could I just show the last 2, 3 or 4 characters.
Example of
fileName_of_this_lengh.ps
fileName_with_a_longer_length.doc
fileName_this_length.xls
fileName_with_a_really_long_length_like_this.tiff
Is it possible to extract it:
.PS
.doc
.xls
. TIFF
Thank you
Ben
I had a bit of a play autour and come up with the following:
But is there a smarter way to do this?SELECT CASE WHEN substr (file_name, -3) = '.ps' THEN '.ps' WHEN substr (file_name, -4) = '.zip' THEN '.zip' WHEN substr (file_name, -4) = '.doc' OR substr (file_name, -4) = '.DOC' THEN '.doc' END format FROM tableName
Published by: Benton on November 27, 2009 09:34You can try with
substr(file_name,instr(file_name,'.',-1)), regexp_substr(file_name,'\..*$')
Best regards
Maxim
Maybe you are looking for
-
Hi, I would like to exist offline / without internet for a while. I downloaded several of my different and deleted email accounts mbox files. I would like to see the emails in offline mode. Can I do this with Thunderbird? Thanks for your time, Jen.
-
What are the symbols below the post titles?
the check mark that I receive, check mark green, resolved. What is the Red Star? I have however it could be new positions or those I had not read, but these two criteria appear not to be the case. What is the black Apple? If it was Apple feedback but
-
Toshiba L4353 39 "- play movie USB problem"
Hello I recently bought a Toshiba L4353 39 "smart tv, reading the usb works, but I continue to have this very annoying problem. basically I view a video file and all right and then no reason playback of the file stops and I'm back on the screen of my
-
Hello I have a question about MODBUS/TCP. I have to write BITS of a register of exploitation. Unfortunally, operating records accept unsigned values (numbers). That's why I need to convert my binary value (for example 101000 > 5). But now I want to w
-
someone knows why I downloaded all my music on an external sd card, but my music shows also in my memory internal when I thought that he wouldn't?