해쉬 키 생성을 위해 테이블 항목 추가
alter table "TBLA" add ("HASH_KEY" VARCHAR2(4000) GENERATED ALWAYS AS (standard_hash(po_id)));
테이블 명세에 보면 자동 생성하면서 RAWTOHEX로 변형
"HASH_KEY" VARCHAR2(4000) GENERATED ALWAYS AS (RAWTOHEX(STANDARD_HASH("PO_ID"))) VIRTUAL ,
그래서 이렇게 Query하면
select hash_key from TBLA where po_id = 26352
union all
select standard_hash(26352) from dual
Error at line 1/8: ORA-01790: expression must have same datatype as corresponding expression
결론은
select hash_key from TBLA where po_id = 26352
union all
select RAWTOHEX(standard_hash(26352)) from dual
189B82A617C42996E6AA4D5F5C291DBA18402F19
189B82A617C42996E6AA4D5F5C291DBA18402F19
성능대비 복잡도를 고려한 효율성을 따진다면 SAH-1 (다른 사이트 결과 참고)
참고
https://mikesmithers.wordpress.com/2024/01/04/using-standard_hash-to-generate-synthetic-key-values/
https://asktom.oracle.com/ords/f?p=100:11:::::P11_QUESTION_ID:9541066400346811041
댓글 없음:
댓글 쓰기