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!

how to trim value in Long datatype

Tony007Oct 18 2016 — edited Oct 18 2016

hi i have the following query

select -- substr(msg_name,1,8),

          fld_seq_no,

           substr(fld_name,1,40) fld_name, fld_type, fld_length,

          fld_precision

      from message_dict

     where msg_name like ('&msg')

     order by fld_seq_nO

   ;

which retun following values

                             FLD_SEQ_NO FLD_NAME                                 FLD_TYPE                              FLD_LENGTH                           FLD_PRECISION

--------------------------------------- ---------------------------------------- -------- --------------------------------------- ---------------------------------------

                                     10 IDMSTYPE_100                             CH                                             1

                                     20 SASTIME_100                              DF                                            14

                                    

  i have another query which got this

SQL> SELECT MSG_TEXT FROM msg_in WHERE stream = 'TESTBASIC'

MSG_TEXT

--------------------------------------------------------------------------------

U201605170000001122334455667788990065465465465033024tONYTEST

i what the value to display as

I what to trim the msg_text based on the FLD_LENGTH AND POPULATE in extra column

                            FLD_SEQ_NO FLD_NAME                                 FLD_TYPE                              FLD_LENGTH                           FLD_PRECISION          Value

--------------------------------------- ---------------------------------------- -------- --------------------------------------- --------------------------------------------------------------------------

                                     10 IDMSTYPE_100                             CH                                             1                                                                                                 U

                                     20 SASTIME_100                              DF                                            14                                                                                                 20160517000000

desc msg_in

Name          Type        Nullable Default Comments

------------- ----------- -------- ------- --------                            

MSG_TEXT      LONG         

This post has been answered by odie_63 on Oct 18 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2016
Added on Oct 18 2016
8 comments
3,927 views