Topic: SQL*Plus and PL/SQL >> pl/sql substr
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| labyrinth248 |
Posted: May 06, 2008 11:13:29 AM |
Total Post: 1
Joined: May, 2008
|
Hey everyone.
I am using toad and I’m trying to grab just the last for digits of data in the column. The column is a NUMBER(8). Ex. the data that would show in this column would be ‘20080506’. I need to just grab the 0506 part of the data. So far this is what I have:
select distinct
, FC.rate_end_dt
from ft_revenue_charge_200801_T FC
where substr(fc.RATE_END_DT, 8, 4) BETWEEN 0501 and 0931
I need to grab the last four digits in the column between 0501 and 0931.
For some reason it is grabbing all dates…
Thanks Guys
|
|
|
Mohammed Taj |
| Posted: May 06, 2008 12:31:25 PM | |
|
Total Post: 634
Joined: Jul, 2007
|
then use SUBSTR in your select statement not in WHERE cluase.
select substr(col1,5) from tablename where col1 between starting_value and ending_value;
SQL> select * from d;
COL1
--------------------
20080501
20080502
20080503
20080504
20080505
20080506
20080507
20080508
20080509
20080510
10 rows selected.
SQL> select substr(col1,4) from d where col1 between '20080501' and '20080505';
SUBSTR(COL1,4)
-----------------
80501
80502
80503
80504
80505
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Mohammed Taj | 634 |
| Murtuja Khokhar | 587 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 385 |
| Ramesh Jois | 226 |
| neeraj sharma | 189 |
| snehalatha p | 166 |
| Gitesh Trivedi | 151 |
| Gopu Gopi | 146 |
| Kushal ratnaker | 136 |
|
|