| | |
substr help
Please support our Oracle advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 6
Reputation:
Solved Threads: 0
I need to derive last 2 numbers after the '-' from the code column.
example if the code is 76767-99 then I need a query to return only 99. I am using substr and instr functions but not getting what I want. Please help me correct the below query.
code - 76767-99
Thanks,
example if the code is 76767-99 then I need a query to return only 99. I am using substr and instr functions but not getting what I want. Please help me correct the below query.
code - 76767-99
sql Syntax (Toggle Plain Text)
SELECT NVL (TRIM (SUBSTR (code, (INSTR (code, '_' ) ) + 1 ) ), '0' ) FROM temp_table;
Thanks,
Last edited by peter_budo; Aug 13th, 2009 at 12:39 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Try the following sample code.
Oracle Syntax (Toggle Plain Text)
SELECT code,SUBSTR(code,INSTR(code,'-',1)+1,2) FROM table_name;
Share your Knowledge.
![]() |
Similar Threads
- strings as input, substr and len (C++)
- Fast substr (C++)
- substr problem (C++)
- atoi(string.substr(x,x)) Possible? (C++)
- An equivalent method of substr() in C (C++)
- substr() Causing Runtime Error (C++)
Other Threads in the Oracle Forum
- Previous Thread: Simple
- Next Thread: oracle help
| Thread Tools | Search this Thread |
2009predictions acquisition amazon.com bartz bernanke cia citrix cloudcomputing crm database dell economy editor enterprise enterprise2.0 enterprisesoftware federalreserve forbes hp ibm intellipedia internet larryellison layoffs linux loughridge mediawiki michaeljackson microsoft neverland nortel notebooks oil operatingsystem oracle palm rimm saas salesforce sap seagate socialcomputing sql sun sybase technologystocks virtualiron virtualization vmware wiki wikipedia xen yahoo zoho






