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!

deal with string over 4000 char in one field

BIAPMay 23 2016 — edited May 27 2016

I have a table like following:

Status, reason1, reason2, reason3, other, reasonforchange

Status could only be active or active, not nullable. 

Requirement is to get status and reason for that status:

SELECT status, decode(status, 'active', reason1||reason2||reason3||other, 'inactive', reasonforchange) reason

FROM table

Challenge is reason1||reason2||reason3||other could be over 4000 characters as other column is free text field defined as varchar2(4000). By concatenating all those, it would blow up the 4000 string limit. How could I achieve query above without hitting the issue. Prefer native SQL, but pl/sql could be considered.

Cheers

BIAP

This post has been answered by Manik on May 24 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 24 2016
Added on May 23 2016
43 comments
45,244 views