Skip to content
Advertisement

cast VARCHAR2 to LONG,RAW,CLOB and find HASH md5

There is a table A with fields (str1 VARCHAR2(4000 CHAR),str2 VARCHAR2(4000 CHAR))

There is a table B with fields (str1 VARCHAR2(4000 CHAR),str2 VARCHAR2(4000 CHAR),hash_code NUMBER)

As a result there is an exception when length(str1||str2) is longer than 4000 (varchar2 is too small).

How can I cast this to other type like clob in such select? to_clob(str1 || str2) does not work.

And standart_hash does not work with clob,long,raw.

What can I use to solve this after solving problem with casting?

Advertisement

Answer

The varchar2 datatype actually has a max length of 32K in PL/SQL, and standard_hash has no limit on the size of the input. Also note that standard_hash returns the RAW datatype, not NUMBER as you have the hash_code column defined in your example.

As you can see, I was able to run your example with no problem.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement