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 generate unique ASCII value for a string of characters

imation3mApr 29 2014 — edited Apr 29 2014

I have to generate incremental data records in PL SQL.

My logic is, store for each row the ASCII value of concatenated columns in that row.

So if in the future, for generating incremental data (generate data only in case if there is any modification), if any change in the record, the ASCII value will be different and on comparing the ASCII values of new and old records, I can generate only the incremental data.

But the issue I am facing is that the ASCII value being generated is similar for two totally different records.

How can I make this ASCII value unique or is there any other way?

My function for generating the ASCII value is:

create or replace

FUNCTION             STRINGTOASCII

(

  VALTEXT IN VARCHAR2 

) return number as

  ASCII_VAL number;

BEGIN

    select SUM(ASCII(SUBSTR(VALTEXT,level,1)))

    INTO ascii_val

    from DUAL

    connect by level <= length(VALTEXT)

  ;

  return ASCII_VAL;

 

END STRINGTOASCII;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2014
Added on Apr 29 2014
20 comments
10,754 views