Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ignore parenthesis in case they wrap a string

1623052Jan 27 2015 — edited Jan 28 2015

Hi,

This is my first question, hopefully I'm doing this right, so I'm writing from a .CSV file into a table and then create a view from that table, taking only some of the fields in order to write them into another CSV file.

Here is my issue with a field from the view:

target.JPG

I want to get rid of the parenthesis, I couldn't find any definitive method on the net, so I have tried trimming the first and last '()' from the string using case :

target.JPG

I got the following error:

target2.JPG

I tried the same logic using case this time testing the string length (since 9 would be the longest):

SELECT CASE

WHEN length (a.base_amt)=9 THEN (select distinct substr(a.base_amt, 2, length(a.base_amt)-1) from CRD_AMT a )

ELSE

(select distinct a.base_amt from crd_amt a)

 END

FROM CRD\_AMT a

I have received the same error.

Now I know that this is not the best way at all to achieve what I need, I, I'm sure there is a way to ignore the parenthesis but i couldn't find anything that works..

I hope you experts perhaps have a solution.

Thanks!!

This post has been answered by Frank Kulash on Jan 27 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2015
Added on Jan 27 2015
9 comments
1,838 views