Tuesday, June 23, 2015

Oracle get sid

create or replace function get_sid
return varchar2 is
cursor c is
  select sys_context('userenv','instance_name') from dual;
v varchar2(9);
begin
open c; fetch c into v; close c;
return v;
end;
/

select name from v$database;


No comments:

Post a Comment