01 May 2009

Generating unique identifiers

Hi,
     In web applications it is required to use unique id in certain columns in the tables, so that it does not getsrepeated. It is possible to generate unique identifiers in PL/SQL using a built in named SYS_GUID.

This builtin generates a 32 chracter length identifier, which can be used as a primary key in a column.




SQL> begin
2 dbms_output.put_line('sys_guid');
3 dbms_output.put_line('--------');
4 dbms_output.put_line(sys_guid);
5 end;
6 /
sys_guid
--------
459C2423AA744A618EACC336A8808284

PL/SQL procedure successfully completed

No comments:

Post a Comment