I am looking for some help in regards to removing trailing spaces from my queue names. The following is an example of a table that I am using:
QUEUE_NAME
Queue A
Queue B
Queue C
The problem I have is that there is an extra space at the end of the queue name and when trying the following code:
SELECT
TRIM(TRAILING ' ' FROM QUEUE_NAME)
FROM
TABLE_QUEUE;
the space is still there.
I was reading the searches from Google and came across the following code to remove special characters [https://community.oracle.com/blogs/bbrumm/2016/12/11/how-to-replace-special-characters-in-oracle-sql] and this removed all the spaces including the one at the end. The code I wrote:
SELECT
REGEXP_REPLACE(QUEUE_NAME, '[^0-9A-Za-z]', '')
FROM
TABLE_QUEUE;
Only issue I have now is that my result is shown as the following:
QUEUE_NAME
QueueA
QueueB
QueueC
I have never really used regexp_replace hence not sure what I need to change to the code to leave the spaces in between the queue names, so would really appreciate it if somebody could advise on how I could fix this.
Thanks in advance.
---- code edited as should not include [.!?]+
select DUMP(queue_name) from table_queue. Read a bit about the DUMP function and play with it, you will find it to be very helpful in many occasions.