DBMS_CRYPTO [message #636208] |
Mon, 20 April 2015 01:35 |
|
vippysharma
Messages: 73 Registered: May 2013 Location: www
|
Member |
|
|
create table login_details
(
EMP_ID VARCHAR2(10),
USER_NAME VARCHAR2(50),
ID_PASSWORD NUMBER
);
create or replace procedure P_PASSWORD_ENCRYPT(par_id in VARCHAR2,
par_username in varchar2,
par_password in number) is
l_hash raw(2000);
begin
l_hash := dbms_crypto.hash(utl_i18n.string_to_raw(par_password,
'AL32UTF8'),
dbms_crypto.hash_sh1);
insert into login_details
(EMP_ID, USER_NAME, ID_PASSWORD)
values
(par_id, par_username, l_hash);
end P_PASSWORD_ENCRYPT;
BEGIN
P_PASS_ENCRYPT('IT_001','SCOTT',123456);
END;
* My procedure shown error as 'inconsistent datatype' which is quite obvious because raw datatype can't be stored in number field.But i want my encrypted value be in number datatype, which is same as my password field have in table.
Is that possible ?
|
|
|
|
|
|
Re: DBMS_CRYPTO [message #636218 is a reply to message #636216] |
Mon, 20 April 2015 04:31 |
|
Michel Cadot
Messages: 68645 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Actually, I mean the same thing than John.
You have one thing you can't change: the return value of SHA1 function.
You have things you can change: your encrypted column data type and requirements.
What is the business reason for an encrypted column to be a NUMBER and nothing else?
None I can see, so this requirement can be changed without any business drawback.
[Updated on: Mon, 20 April 2015 06:54] Report message to a moderator
|
|
|
Re: DBMS_CRYPTO [message #636222 is a reply to message #636218] |
Mon, 20 April 2015 06:32 |
|
vippysharma
Messages: 73 Registered: May 2013 Location: www
|
Member |
|
|
Michel Cadot wrote on Mon, 20 April 2015 14:31What is the business reason for an encrypted column to be a NUMBER and nothing else?
None I can see, so this requirement can be changed without any business drawback.
You are right,its senseless or any amendment doesn't make any drawback. But Requirement is what user's choice either useless or whatever.
|
|
|